new
This commit is contained in:
@@ -72,7 +72,11 @@ func (l *ReviewEnterpriseLogic) ReviewEnterprise(in *user.ReviewEnterpriseReq) (
|
||||
if insertEnterpriseErr != nil {
|
||||
return insertEnterpriseErr
|
||||
}
|
||||
_, InsertWalletsTransErr := l.svcCtx.WalletsModel.InsertWalletsTrans(l.ctx, &model.Wallets{UserId: enterpriseAuth.UserId}, session)
|
||||
userConfig, FindUserConfigErr := l.svcCtx.UserConfigModel.FindOne(l.ctx, 1)
|
||||
if FindUserConfigErr != nil {
|
||||
return FindUserConfigErr
|
||||
}
|
||||
_, InsertWalletsTransErr := l.svcCtx.WalletsModel.InsertWalletsTrans(l.ctx, &model.Wallets{UserId: enterpriseAuth.UserId, Balance: userConfig.GiftAmount}, session)
|
||||
if InsertWalletsTransErr != nil {
|
||||
return InsertWalletsTransErr
|
||||
}
|
||||
@@ -83,7 +87,6 @@ func (l *ReviewEnterpriseLogic) ReviewEnterprise(in *user.ReviewEnterpriseReq) (
|
||||
return createSecretErr
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
@@ -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
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user