opt: record user_id for reward verify

This commit is contained in:
RockYang 2023-07-22 08:42:30 +08:00
parent e02badf7bb
commit 94d8d8a9d4
3 changed files with 5 additions and 1 deletions

View File

@ -59,6 +59,7 @@ func (h *RewardHandler) Verify(c *gin.Context) {
// 更新核销状态 // 更新核销状态
item.Status = true item.Status = true
item.UserId = user.Id
res = h.db.Updates(&item) res = h.db.Updates(&item)
if res.Error != nil { if res.Error != nil {
tx.Rollback() tx.Rollback()

View File

@ -4,6 +4,7 @@ package model
type Reward struct { type Reward struct {
BaseModel BaseModel
UserId uint // 用户 ID
TxId string // 交易ID TxId string // 交易ID
Amount float64 // 打赏金额 Amount float64 // 打赏金额
Remark string // 打赏备注 Remark string // 打赏备注

View File

@ -17,3 +17,5 @@ ALTER TABLE `chatgpt_rewards`
MODIFY `id` int NOT NULL AUTO_INCREMENT; MODIFY `id` int NOT NULL AUTO_INCREMENT;
update chatgpt_users set calls=0 update chatgpt_users set calls=0
ALTER TABLE `chatgpt_rewards` ADD `user_id` INT(11) NOT NULL COMMENT '用户 ID' AFTER `id`;