redeem code function is ready

This commit is contained in:
RockYang
2024-08-09 18:19:51 +08:00
parent c77843424b
commit 67c7132e6b
18 changed files with 979 additions and 123 deletions

View File

@@ -94,6 +94,7 @@ func (h *SunoHandler) Create(c *gin.Context) {
RefTaskId: data.RefTaskId,
ExtendSecs: data.ExtendSecs,
Power: h.App.SysConfig.SunoPower,
SongId: utils.RandString(32),
}
if data.Lyrics != "" {
job.Prompt = data.Lyrics
@@ -226,11 +227,11 @@ func (h *SunoHandler) Remove(c *gin.Context) {
return
}
var user model.User
h.DB.Where("id = ?", job.UserId).First(&user)
tx.Where("id = ?", job.UserId).First(&user)
err = tx.Create(&model.PowerLog{
UserId: user.Id,
Username: user.Username,
Type: types.PowerConsume,
Type: types.PowerRefund,
Amount: job.Power,
Balance: user.Power,
Mark: types.PowerAdd,