Merge remote-tracking branch 'origin/mark' into don

This commit is contained in:
Rosy-zhudan
2019-08-27 18:13:52 +08:00
5 changed files with 37 additions and 27 deletions

View File

@@ -115,7 +115,14 @@ func TransferLegacyWeixins(mobile string) (err error) {
}
} else {
if mobile != "" {
api2.RoleMan.DeleteRole4User(user.GetID(), autils.NewRole(authz.StoreRoleBoss, v.JxStoreID))
rList, err2 := api2.RoleMan.GetUserRoleList(user.GetID())
if err = err2; err == nil {
for _, role := range rList {
if role.StoreID > 0 {
api2.RoleMan.DeleteRole4User(user.GetID(), autils.NewRole(authz.StoreRoleBoss, role.StoreID))
}
}
}
}
}
}

View File

@@ -87,11 +87,13 @@ func RegisterUser(user *model.User, mobileVerifyCode string, inAuthInfo *auth2.A
mobileAuth, err2 := auth2.Login(auth2.AuthTypeMobile, user.Mobile, auth2.UserIDMobile, mobileVerifyCode)
if err = err2; err == nil {
if !mobileAuth.IsUserEmpty() {
return nil, jsonerr.New(mobileAuth, model.ErrCodeJsonActSkuConflict)
return nil, jsonerr.New(mobileAuth, model.ErrCodeJsonUserAlreadyExist)
}
user.Type = model.UserTypeConsumer | model.UserTypeBoss
user.Type = model.UserTypeConsumer
if inAuthInfo.AuthBindInfo.Type == dingding.AuthTypeStaff {
user.Type |= model.UserTypeOperator
} else {
user.Type |= model.UserTypeStoreBoss
}
if err = CreateUser(user, "RegisterUser"); err == nil {
if outAuthInfo, err = auth2.BindUser(mobileAuth, user); err == nil && inAuthInfo != nil {