This commit is contained in:
苏尹岚
2021-01-22 10:05:43 +08:00
parent f85fa9e12a
commit 519592bc31
14 changed files with 145 additions and 30 deletions

View File

@@ -516,7 +516,23 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
} else {
retVal.Stores = storeList
}
//权限
if ctx.GetUserName() != "jxadmin" {
if user, err := dao.GetUserByID(db, "userID", ctx.GetUserID()); err == nil {
if user.Type&model.UserTypeRole != 0 {
if storeIDsMap, err := GetUserStoresResultMap(user.UserID); err == nil {
var storeList2 []*StoreExt
for _, v := range retVal.Stores {
if storeIDsMap[v.ID] != 0 {
storeList2 = append(storeList2, v)
}
}
retVal.Stores = nil
retVal.Stores = storeList2
}
}
}
}
// 订单情况过滤
storeList, err = filterStoreByOrderInfo(db, retVal.Stores, orderTimeFrom, orderTimeTo, orderCountFrom, orderCountTo)
if err != nil {
@@ -2254,7 +2270,7 @@ func SendAlarmVendorSnapshot(ctx *jxcontext.Context, parentTask tasksch.ITask, p
}
if len(userList) > 0 {
allStores, err := dao.GetStoreList(db, nil, nil, nil, nil, "")
allStores, err := dao.GetStoreList(db, nil, nil, nil, nil, nil, "")
if err != nil {
return err
}
@@ -2428,7 +2444,7 @@ func SaveAndSendAlarmVendorSnapshot(ctx *jxcontext.Context, vendorIDs, storeIDs
func SyncStoresCourierInfo(ctx *jxcontext.Context, storeIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
db := dao.GetDB()
storeList2, err := dao.GetStoreList(db, storeIDs, nil, nil, nil, "")
storeList2, err := dao.GetStoreList(db, storeIDs, nil, nil, nil, nil, "")
var storeList []*model.Store
for _, v := range storeList2 {
if v.Status != model.StoreStatusDisabled {
@@ -2957,7 +2973,7 @@ func UpdateJdStoreNameAll(ctx *jxcontext.Context) (err error) {
func DeletePrinterSeq(ctx *jxcontext.Context, storeIDs []int) (err error) {
db := dao.GetDB()
for _, v := range storeIDs {
stores, err := dao.GetStoreList(db, []int{v}, nil, nil, nil, "")
stores, err := dao.GetStoreList(db, []int{v}, nil, nil, nil, nil, "")
if err != nil || len(stores) == 0 {
return err
}
@@ -3010,7 +3026,7 @@ func checkYbParams(db *dao.DaoDB, storeMap *model.StoreMap, storeID int) (err er
}
}
}
stores, err := dao.GetStoreList(db, []int{storeID}, nil, nil, nil, "")
stores, err := dao.GetStoreList(db, []int{storeID}, nil, nil, nil, nil, "")
if len(stores) > 0 {
if configs, err := dao.QueryConfigs(dao.GetDB(), "yinbaoCookie", model.ConfigTypeCookie, ""); err == nil {
yinbaoCookie = configs[0].Value
@@ -3356,7 +3372,7 @@ func DisabledStoreWithoutVendor(ctx *jxcontext.Context, isContinueWhenError, isA
var (
db = dao.GetDB()
)
stores, err := dao.GetStoreList(db, nil, nil, []int{model.StoreStatusClosed, model.StoreStatusHaveRest, model.StoreStatusOpened}, nil, "")
stores, err := dao.GetStoreList(db, nil, nil, []int{model.StoreStatusClosed, model.StoreStatusHaveRest, model.StoreStatusOpened}, nil, nil, "")
task := tasksch.NewParallelTask("DisabledStoreWithoutVendor", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
store := batchItemList[0].(*model.Store)
@@ -3733,7 +3749,7 @@ func GetDiffJxStoreAndMTWMStoreInfo(ctx *jxcontext.Context, storeIDs []int) (err
tmpDiffStore := &TmpDiffStore{
StoreID: v.StoreID,
}
stores, err := dao.GetStoreList(db, []int{v.StoreID}, nil, nil, nil, "")
stores, err := dao.GetStoreList(db, []int{v.StoreID}, nil, nil, nil, nil, "")
store := stores[0]
place, _ := dao.GetPlaceByCode(db, store.CityCode)
tmpDiffStore.City = place.Name