禁用没有绑定三方平台的门店

This commit is contained in:
苏尹岚
2020-04-10 15:39:39 +08:00
parent 28a1907bf7
commit 444f8fd661
3 changed files with 37 additions and 8 deletions

View File

@@ -3038,3 +3038,28 @@ func ChangeYbCookie() (err error) {
UpdateConfig(jxcontext.AdminCtx, "yinbaoCookie", model.ConfigTypeCookie, cookie)
return err
}
func DisabledStoreWithoutVendor(ctx *jxcontext.Context, isContinueWhenError, isAsync bool) (hint string, err error) {
var (
db = dao.GetDB()
)
stores, err := dao.GetStoreList(db, nil, nil, []int{model.StoreStatusClosed, model.StoreStatusHaveRest, model.StoreStatusOpened}, nil, "")
task := tasksch.NewParallelTask("RefreshOrdersPriceInfo", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
store := batchItemList[0].(*model.Store)
storeMaps, err := dao.GetStoresMapList(db, []int{model.VendorIDYB, model.VendorIDJD, model.VendorIDJX, model.VendorIDEBAI, model.VendorIDMTWM}, []int{store.ID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "")
if len(storeMaps) == 0 {
store.Status = model.StoreStatusDisabled
dao.UpdateEntity(db, store, "Status")
}
return retVal, err
}, stores)
tasksch.HandleTask(task, nil, true).Run()
if isAsync {
hint = task.GetID()
} else {
_, err = task.GetResult(0)
hint = "1"
}
return hint, err
}