fix agent apply
This commit is contained in:
parent
a77598e330
commit
25bf65e096
@ -64,7 +64,7 @@ func (l *ApplyForAgentLogic) ApplyForAgent(req *types.AgentApplyReq) (resp *type
|
|||||||
// 两种情况,1. 已注册账号然后申请代理 2. 未注册账号申请代理
|
// 两种情况,1. 已注册账号然后申请代理 2. 未注册账号申请代理
|
||||||
user, findUserErr := l.svcCtx.UserModel.FindOneByMobile(l.ctx, sql.NullString{String: encryptedMobile, Valid: true})
|
user, findUserErr := l.svcCtx.UserModel.FindOneByMobile(l.ctx, sql.NullString{String: encryptedMobile, Valid: true})
|
||||||
if findUserErr != nil && !errors.Is(findUserErr, model.ErrNotFound) {
|
if findUserErr != nil && !errors.Is(findUserErr, model.ErrNotFound) {
|
||||||
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "代理申请, 读取数据库获取用户失败, mobile: %s, err: %+v", encryptedMobile, err)
|
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "代理申请, 读取数据库获取用户失败, mobile: %s, err: %+v", encryptedMobile, findUserErr)
|
||||||
}
|
}
|
||||||
if user == nil {
|
if user == nil {
|
||||||
if claims != nil && claims.UserType == model.UserTypeNormal {
|
if claims != nil && claims.UserType == model.UserTypeNormal {
|
||||||
@ -86,7 +86,7 @@ func (l *ApplyForAgentLogic) ApplyForAgent(req *types.AgentApplyReq) (resp *type
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 使用SelectBuilder构建查询,查找符合user_id的记录并按创建时间降序排序获取最新一条
|
// 使用SelectBuilder构建查询,查找符合user_id的记录并按创建时间降序排序获取最新一条
|
||||||
builder := l.svcCtx.AgentAuditModel.SelectBuilder().Where("user_id = ?", user.Id).OrderBy("create_time DESC").Limit(1)
|
builder := l.svcCtx.AgentAuditModel.SelectBuilder().Where("user_id = ?", userID).OrderBy("create_time DESC").Limit(1)
|
||||||
agentAuditList, findAgentAuditErr := l.svcCtx.AgentAuditModel.FindAll(transCtx, builder, "")
|
agentAuditList, findAgentAuditErr := l.svcCtx.AgentAuditModel.FindAll(transCtx, builder, "")
|
||||||
if findAgentAuditErr != nil {
|
if findAgentAuditErr != nil {
|
||||||
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "代理申请, 查找审核列表失败%+v", findAgentAuditErr)
|
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "代理申请, 查找审核列表失败%+v", findAgentAuditErr)
|
||||||
@ -102,7 +102,7 @@ func (l *ApplyForAgentLogic) ApplyForAgent(req *types.AgentApplyReq) (resp *type
|
|||||||
}
|
}
|
||||||
|
|
||||||
var agentAudit model.AgentAudit
|
var agentAudit model.AgentAudit
|
||||||
agentAudit.UserId = user.Id
|
agentAudit.UserId = userID
|
||||||
agentAudit.Mobile = encryptedMobile
|
agentAudit.Mobile = encryptedMobile
|
||||||
agentAudit.Region = req.Region
|
agentAudit.Region = req.Region
|
||||||
agentAudit.Status = 1
|
agentAudit.Status = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user