This commit is contained in:
2024-10-16 20:46:46 +08:00
parent fdfdbb5ff6
commit 185b8aef90
14 changed files with 546 additions and 306 deletions

View File

@@ -68,6 +68,22 @@ func (l *RechargeWalletLogic) RechargeWallet(in *user.RechargeWalletRequest) (*u
if err != nil {
return err
}
wallet, findWalletErr := l.svcCtx.WalletsModel.FindOneByUserId(l.ctx, in.UserId)
if findWalletErr != nil {
return err
}
if wallet.Balance > 0 {
userModel, findUserErr := l.svcCtx.UserModel.FindOne(l.ctx, in.UserId)
if findUserErr != nil {
return findUserErr
}
userModel.QuotaExceeded = 0
_, updateUserErr := l.svcCtx.UserModel.UpdateUserTrans(l.ctx, userModel, session)
if updateUserErr != nil {
return updateUserErr
}
}
return nil
})