🐛 代理信息修改
This commit is contained in:
@@ -140,8 +140,10 @@ func (s *AgentServiceV1) AgentPutInfoReq(ctx context.Context, req *v1.AgentPutIn
|
||||
err = tx.Commit()
|
||||
//按照新费率计算余额
|
||||
newBalance := utils.TransformBalance(oldBalance, req.Rate)
|
||||
// 6. 更新用户余额
|
||||
balance.BalanceService.ChangeUserBalance(ctx, user.ID, newBalance.Sub(oldBalance))
|
||||
// 6. 更新用户余额(如果更新了费率或者第一次改为代理)
|
||||
if user.Edges.Agent == nil || !user.Edges.Agent.Rate.Equal(req.Rate) {
|
||||
balance.BalanceService.ChangeUserBalance(ctx, user.ID, newBalance.Sub(user.Balance))
|
||||
}
|
||||
utils.OkOrPanic(err, func(err error) error {
|
||||
return oops.
|
||||
WithContext(ctx).
|
||||
|
||||
Reference in New Issue
Block a user