禁用没有绑定三方平台的门店
This commit is contained in:
@@ -767,14 +767,16 @@ func AddSkuName(ctx *jxcontext.Context, skuNameExt *model.SkuNameExt, userName s
|
||||
sql := "SELECT * FROM sku_name WHERE yb_name_suffix <> '' ORDER BY yb_name_suffix DESC LIMIT 1"
|
||||
dao.GetRow(db, &name, sql, nil)
|
||||
if name != nil {
|
||||
prefix := utils.Int64ToStr(utils.Str2Int64(name.YbNameSuffix) + 1)
|
||||
realPrefix := prefix
|
||||
for i := 0; i < 4-len(prefix); i++ {
|
||||
realPrefix = "0" + realPrefix
|
||||
}
|
||||
skuNameExt.YbNameSuffix = realPrefix
|
||||
if utils.Str2Int64(prefix) > 9999 {
|
||||
return nil, fmt.Errorf("银豹的商品后缀已超过9999!")
|
||||
if skuNameExt.Unit == model.UnitNames[0] {
|
||||
prefix := utils.Int64ToStr(utils.Str2Int64(name.YbNameSuffix) + 1)
|
||||
realPrefix := prefix
|
||||
for i := 0; i < 4-len(prefix); i++ {
|
||||
realPrefix = "0" + realPrefix
|
||||
}
|
||||
skuNameExt.YbNameSuffix = realPrefix
|
||||
if utils.Str2Int64(prefix) > 9999 {
|
||||
return nil, fmt.Errorf("银豹的商品后缀已超过9999!")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -343,6 +343,8 @@ func doDailyWork() {
|
||||
cms.RefreshJdLevel(jxcontext.AdminCtx)
|
||||
//删除操作日志
|
||||
event.DeleteOperateEventAndDetail(jxcontext.AdminCtx, time.Now().AddDate(0, -1, 0))
|
||||
//禁用没有绑定的门店
|
||||
cms.DisabledStoreWithoutVendor(jxcontext.AdminCtx, true, true)
|
||||
}
|
||||
|
||||
func RefreshRealMobile(ctx *jxcontext.Context, vendorID int, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
|
||||
Reference in New Issue
Block a user