优化uniapp
This commit is contained in:
1 parent
4f1acaa451
commit
8fc52c574f
49 files changed
+1952
-197
No files matched your search
@@ -436,8 +436,20 @@ func SearchTenantsForRegister(keyword string) ([]TenantSearchItem, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// JoinApplyDetail 小程序「挂靠企业」补充资料。
|
||||
// 手机号不允许前端传:统一由后端从身份表读取微信验证过的手机号。
|
||||
type JoinApplyDetail struct {
|
||||
ApplicantName string
|
||||
DepartmentID uint64
|
||||
DepartmentName string
|
||||
PositionID uint64
|
||||
PositionName string
|
||||
WechatMobile string
|
||||
}
|
||||
|
||||
// CreateJoinApply 「绑定企业」申请:等待目标企业管理员审批
|
||||
func CreateJoinApply(identityID, tid uint64) (*models.AuthTenantApply, error) {
|
||||
// detail 为可选参数,PC 两步式注册沿用原调用(不传),小程序挂靠表单传入补充资料。
|
||||
func CreateJoinApply(identityID, tid uint64, detail ...JoinApplyDetail) (*models.AuthTenantApply, error) {
|
||||
if identityID == 0 || tid == 0 {
|
||||
return nil, errors.New("参数错误")
|
||||
}
|
||||
@@ -477,7 +489,22 @@ func CreateJoinApply(identityID, tid uint64) (*models.AuthTenantApply, error) {
|
||||
TenantName: tenant.TenantName,
|
||||
Status: models.TenantApplyStatusPending,
|
||||
}
|
||||
apply.ContactPerson = identityNickname(identity)
|
||||
// 小程序挂靠表单:补充姓名 / 部门 / 职位,手机号取微信验证过的身份手机号
|
||||
if len(detail) > 0 {
|
||||
d := detail[0]
|
||||
apply.ApplicantName = strings.TrimSpace(d.ApplicantName)
|
||||
apply.DepartmentID = d.DepartmentID
|
||||
apply.DepartmentName = strings.TrimSpace(d.DepartmentName)
|
||||
apply.PositionID = d.PositionID
|
||||
apply.PositionName = strings.TrimSpace(d.PositionName)
|
||||
apply.WechatMobile = strings.TrimSpace(d.WechatMobile)
|
||||
if apply.ApplicantName != "" {
|
||||
apply.ContactPerson = apply.ApplicantName
|
||||
}
|
||||
}
|
||||
if apply.ContactPerson == "" {
|
||||
apply.ContactPerson = identityNickname(identity)
|
||||
}
|
||||
if identity.Mobile != nil {
|
||||
apply.ContactPhone = *identity.Mobile
|
||||
}
|
||||
@@ -622,6 +649,13 @@ func ApproveJoinApply(applyID, tid, reviewerID uint64, reviewerName string) erro
|
||||
if err := bindIdentityToTenant(identity, tid, models.GetTenantUserRole); err != nil {
|
||||
return err
|
||||
}
|
||||
// 挂靠申请选了部门:审批通过后把 org_id 落到认证中心绑定行
|
||||
if apply.DepartmentID > 0 {
|
||||
_, _ = models.Orm.QueryTable(new(models.AuthTenantUser)).
|
||||
Filter("tid", tid).
|
||||
Filter("identity_id", apply.IdentityID).
|
||||
Update(map[string]interface{}{"org_id": apply.DepartmentID, "update_time": time.Now()})
|
||||
}
|
||||
return finishApply(apply, models.TenantApplyStatusPassed, "", reviewerID, reviewerName)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user