This commit is contained in:
Mrx
2026-02-09 11:12:49 +08:00
parent ad809f6f8b
commit ad28fc2301
4 changed files with 22 additions and 5 deletions

View File

@@ -105,13 +105,14 @@ func (l *ApplyForAgentLogic) ApplyForAgent(req *types.AgentApplyReq) (resp *type
userID = user.Id
}
// 3. 检查是否已是代理
// 3. 检查是否已是代理H5 已注册过代理时,小程序绑定手机后视为自动登录,此处直接返回成功)
existingAgent, err := l.svcCtx.AgentModel.FindOneByUserId(transCtx, userID)
if err != nil && !errors.Is(err, model.ErrNotFound) {
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查询代理信息失败, %v", err)
}
if existingAgent != nil {
return errors.Wrapf(xerr.NewErrMsg("您已经是代理"), "")
// 已是代理(如 H5 已注册):不报错,事务外会统一发放 token 并返回成功,视为自动登录
return nil
}
var inviteCodeModel *model.AgentInviteCode