适配dall-e-3

This commit is contained in:
CaIon
2023-11-09 17:08:32 +08:00
parent 7237d20ec4
commit 3ff4210fc4
5 changed files with 224 additions and 179 deletions

View File

@@ -17,6 +17,7 @@ type Redemption struct {
CreatedTime int64 `json:"created_time" gorm:"bigint"`
RedeemedTime int64 `json:"redeemed_time" gorm:"bigint"`
Count int `json:"count" gorm:"-:all"` // only for api request
UsedUserId int `json:"used_user_id"`
}
func GetAllRedemptions(startIdx int, num int) ([]*Redemption, error) {
@@ -69,6 +70,7 @@ func Redeem(key string, userId int) (quota int, err error) {
}
redemption.RedeemedTime = common.GetTimestamp()
redemption.Status = common.RedemptionCodeStatusUsed
redemption.UsedUserId = userId
err = tx.Save(redemption).Error
return err
})