feat: allow admins to bind member phone numbers
Members page previously only displayed phone status; add bind/replace UI and admin member update phone support for login and sync identity.
This commit is contained in:
@@ -64,3 +64,19 @@ func (l *MemberLogic) Update(userID int64, role string, orgUnitID int64, status
|
||||
}
|
||||
return l.svcCtx.Users.UpdateMember(l.ctx, tid, userID, role, orgUnitID, status)
|
||||
}
|
||||
|
||||
// SetPhone 管理员为本公司成员绑定/更换/清空手机号(空字符串解绑)。
|
||||
func (l *MemberLogic) SetPhone(userID int64, phone string) (*userstore.User, error) {
|
||||
tid := authx.TenantID(l.ctx)
|
||||
if tid <= 0 {
|
||||
return nil, fmt.Errorf("missing tenant")
|
||||
}
|
||||
u, err := l.svcCtx.Users.GetByID(l.ctx, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if u.TenantID != tid {
|
||||
return nil, fmt.Errorf("成员不属于本公司")
|
||||
}
|
||||
return l.svcCtx.Users.BindPhone(l.ctx, userID, phone)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user