fix applyforagent
This commit is contained in:
		| @@ -67,6 +67,9 @@ func (l *ApplyForAgentLogic) ApplyForAgent(req *types.AgentApplyReq) (resp *type | ||||
| 			return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "代理申请, 读取数据库获取用户失败, mobile: %s, err: %+v", encryptedMobile, err) | ||||
| 		} | ||||
| 		if user == nil { | ||||
| 			if claims != nil && claims.UserType == model.UserTypeNormal { | ||||
| 				return errors.Wrapf(xerr.NewErrMsg("当前用户已注册,请输入注册的手机号"), "代理申请, 当前用户已注册") | ||||
| 			} | ||||
| 			userID, err = l.svcCtx.UserService.RegisterUser(l.ctx, encryptedMobile) | ||||
| 			if err != nil { | ||||
| 				return errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "代理申请, 注册用户失败: %+v", err) | ||||
|   | ||||
| @@ -31,10 +31,18 @@ func NewGetAgentInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetA | ||||
| } | ||||
|  | ||||
| func (l *GetAgentInfoLogic) GetAgentInfo() (resp *types.AgentInfoResp, err error) { | ||||
| 	userID, err := ctxdata.GetUidFromCtx(l.ctx) | ||||
| 	claims, err := ctxdata.GetClaimsFromCtx(l.ctx) | ||||
| 	if err != nil { | ||||
| 		return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "获取代理信息, %v", err) | ||||
| 	} | ||||
| 	userID := claims.UserId | ||||
| 	userType := claims.UserType | ||||
| 	if userType == model.UserTypeTemp { | ||||
| 		return &types.AgentInfoResp{ | ||||
| 			IsAgent: false, | ||||
| 			Status:  3, | ||||
| 		}, nil | ||||
| 	} | ||||
| 	agent, err := l.svcCtx.AgentModel.FindOneByUserId(l.ctx, userID) | ||||
| 	if err != nil { | ||||
| 		if errors.Is(err, sql.ErrNoRows) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user