- 创建或更新京西门店,注册用户时,自动根据门店的tel1,tel2添加门店老板角色
This commit is contained in:
@@ -8,10 +8,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
"git.rosy.net.cn/jx-callback/business/authz"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/baidunavi"
|
||||
@@ -700,8 +697,8 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
dao.Commit(db)
|
||||
globals.SugarLogger.Debugf("UpdateStore track:%s, before call SyncStore", ctx.GetTrackInfo())
|
||||
_, err = CurVendorSync.SyncStore(ctx, db, -1, store.ID, false, userName)
|
||||
if valid["tel1"] != nil {
|
||||
AddStoreBossByMoble(ctx, utils.Interface2String(valid["tel1"]), storeID)
|
||||
if valid["tel1"] != nil || valid["tel2"] != nil {
|
||||
TryAddStoreBossRole4StoreByMobile(ctx, store.ID, []string{utils.Interface2String(valid["tel1"]), utils.Interface2String(valid["tel2"])})
|
||||
}
|
||||
if syncStatus&model.SyncFlagStoreAddress != 0 || valid["tel1"] != nil || valid["payeeName"] != nil {
|
||||
updateCourierStores(ctx, storeID)
|
||||
@@ -797,7 +794,7 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
|
||||
store.ID = existingID
|
||||
if err = dao.CreateEntity(db, store); err == nil {
|
||||
UpdateOrCreateCourierStores(ctx, store.ID, false, false, false)
|
||||
AddStoreBossByMoble(ctx, storeExt.Tel1, storeExt.ID)
|
||||
TryAddStoreBossRole4StoreByMobile(ctx, storeExt.ID, []string{storeExt.Tel1, storeExt.Tel2})
|
||||
return store.ID, err
|
||||
}
|
||||
return 0, err
|
||||
@@ -1791,24 +1788,3 @@ func SyncStoresQualify(ctx *jxcontext.Context, storeIDs []int, isAsync, isContin
|
||||
}
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func AddStoreBossByMoble(ctx *jxcontext.Context, mobile string, storeID int) (num int64, err error) {
|
||||
if mobile != "" {
|
||||
if globals.EnableWXAuth2 {
|
||||
db := dao.GetDB()
|
||||
userList, _, err2 := dao.GetUsers(db, 0, "", nil, "", mobile, 0, 0)
|
||||
globals.SugarLogger.Debugf("AddStoreBossByMoble mobile:%s, userList:%s", mobile, utils.Format4Output(userList, true))
|
||||
if err = err2; err == nil && len(userList) > 0 {
|
||||
if err = AddRoles4User(ctx, userList[0].GetID(), []*authz.RoleInfo{
|
||||
autils.NewRole(authz.StoreRoleBoss, storeID),
|
||||
}); err == nil {
|
||||
num = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
if !globals.DisableWXAuth1 {
|
||||
num, err = BindMobile2Store(ctx, mobile, storeID)
|
||||
}
|
||||
}
|
||||
return num, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user