...
|
...
|
@@ -35,6 +35,7 @@ func (l *MiniUserApplyJoinCompanyLogic) MiniUserApplyJoinCompany(req *types.Mini |
|
|
company *domain.Company
|
|
|
user *domain.User
|
|
|
name = fmt.Sprintf("用户%s", tool.Krand(6, tool.KC_RAND_KIND_NUM))
|
|
|
token string
|
|
|
)
|
|
|
if company, err = l.svcCtx.CompanyRepository.FindOneByCode(l.ctx, conn, req.Code); err != nil {
|
|
|
return nil, xerr.NewErrMsgErr("公司不存在", err)
|
...
|
...
|
@@ -48,12 +49,14 @@ func (l *MiniUserApplyJoinCompanyLogic) MiniUserApplyJoinCompany(req *types.Mini |
|
|
return nil, xerr.NewErrMsgErr("申请失败", err)
|
|
|
}
|
|
|
if user != nil {
|
|
|
if user.AuditStatus == domain.UserAuditStatusWait {
|
|
|
return nil, xerr.NewErrMsgErr("已申请,待审核中", err)
|
|
|
token, err = generateToken(l.svcCtx, user)
|
|
|
if err != nil {
|
|
|
return nil, xerr.NewErrMsgErr("登录失败", err)
|
|
|
}
|
|
|
if user.AuditStatus == domain.UserAuditStatusPassed {
|
|
|
return nil, xerr.NewErrMsgErr("公司已申请", err)
|
|
|
resp = &types.MiniUserApplyJoinCompanyResponse{
|
|
|
Token: token,
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
queryOptions := domain.NewQueryOptions().
|
|
|
WithOffsetLimit(1, 1).
|
...
|
...
|
@@ -87,6 +90,12 @@ func (l *MiniUserApplyJoinCompanyLogic) MiniUserApplyJoinCompany(req *types.Mini |
|
|
}, true); err != nil {
|
|
|
return nil, xerr.NewErrMsgErr("申请失败", err)
|
|
|
}
|
|
|
resp = &types.MiniUserApplyJoinCompanyResponse{}
|
|
|
token, err = generateToken(l.svcCtx, user)
|
|
|
if err != nil {
|
|
|
return nil, xerr.NewErrMsgErr("登录失败", err)
|
|
|
}
|
|
|
resp = &types.MiniUserApplyJoinCompanyResponse{
|
|
|
Token: token,
|
|
|
}
|
|
|
return
|
|
|
} |
...
|
...
|
|