mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-12-25 09:15:56 +08:00
feat: now user can top up via redemption code (close #9)
This commit is contained in:
@@ -123,3 +123,8 @@ func DecreaseTokenRemainTimesById(id int) (err error) {
|
||||
err = DB.Model(&Token{}).Where("id = ?", id).Update("remain_times", gorm.Expr("remain_times - ?", 1)).Error
|
||||
return err
|
||||
}
|
||||
|
||||
func TopUpToken(id int, times int) (err error) {
|
||||
err = DB.Model(&Token{}).Where("id = ?", id).Update("remain_times", gorm.Expr("remain_times + ?", times)).Error
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user