Merge remote-tracking branch 'origin/mark' into don
This commit is contained in:
@@ -8,7 +8,10 @@ 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/dingdingapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
@@ -167,6 +170,11 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
t1.operator_phone,
|
||||
t1.printer_disabled,
|
||||
|
||||
t1.market_man_role,
|
||||
t1.operator_role,
|
||||
t1.operator_role2,
|
||||
t1.printer_font_size,
|
||||
|
||||
city.name city_name,
|
||||
district.name district_name,
|
||||
CONCAT('[', GROUP_CONCAT(DISTINCT CONCAT('{"vendorStoreID":"', m1.vendor_store_id, '", "vendorID":', m1.vendor_id,
|
||||
@@ -319,7 +327,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
}
|
||||
|
||||
sql += sqlWhere + `
|
||||
GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58
|
||||
GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62
|
||||
ORDER BY t1.id DESC
|
||||
/*LIMIT ? OFFSET ?*/`
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
@@ -534,7 +542,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
|
||||
valid := dao.StrictMakeMapByStructObject(payload, store, userName)
|
||||
if globals.EnableWXAuth2 {
|
||||
if err = dao.ValidateRoles(db, utils.Interface2String(valid["marketManRole"]), utils.Interface2String(valid["OperatorRole"])); err != nil {
|
||||
if err = dao.ValidateRoles(db, utils.Interface2String(valid["marketManRole"]), utils.Interface2String(valid["operatorRole"]), utils.Interface2String(valid["operatorRole2"])); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
@@ -653,7 +661,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
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 {
|
||||
BindMobile2Store(ctx, utils.Interface2String(valid["tel1"]), storeID)
|
||||
AddStoreBossByMoble(ctx, utils.Interface2String(valid["tel1"]), storeID)
|
||||
}
|
||||
if syncStatus&model.SyncFlagStoreAddress != 0 && valid["tel1"] != nil || valid["payeeName"] != nil {
|
||||
updateCourierStores(ctx, storeID)
|
||||
@@ -716,7 +724,7 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
|
||||
}
|
||||
db := dao.GetDB()
|
||||
if globals.EnableWXAuth2 {
|
||||
if err = dao.ValidateRoles(db, store.MarketManRole, store.OperatorRole); err != nil {
|
||||
if err = dao.ValidateRoles(db, store.MarketManRole, store.OperatorRole, store.OperatorRole2); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
@@ -749,7 +757,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)
|
||||
BindMobile2Store(ctx, storeExt.Tel1, storeExt.ID)
|
||||
AddStoreBossByMoble(ctx, storeExt.Tel1, storeExt.ID)
|
||||
return store.ID, err
|
||||
}
|
||||
return 0, err
|
||||
@@ -1739,3 +1747,23 @@ 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
|
||||
}
|
||||
}
|
||||
} else {
|
||||
num, err = BindMobile2Store(ctx, mobile, storeID)
|
||||
}
|
||||
}
|
||||
return num, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user