禁用没有绑定三方平台的门店
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"
|
sql := "SELECT * FROM sku_name WHERE yb_name_suffix <> '' ORDER BY yb_name_suffix DESC LIMIT 1"
|
||||||
dao.GetRow(db, &name, sql, nil)
|
dao.GetRow(db, &name, sql, nil)
|
||||||
if name != nil {
|
if name != nil {
|
||||||
prefix := utils.Int64ToStr(utils.Str2Int64(name.YbNameSuffix) + 1)
|
if skuNameExt.Unit == model.UnitNames[0] {
|
||||||
realPrefix := prefix
|
prefix := utils.Int64ToStr(utils.Str2Int64(name.YbNameSuffix) + 1)
|
||||||
for i := 0; i < 4-len(prefix); i++ {
|
realPrefix := prefix
|
||||||
realPrefix = "0" + realPrefix
|
for i := 0; i < 4-len(prefix); i++ {
|
||||||
}
|
realPrefix = "0" + realPrefix
|
||||||
skuNameExt.YbNameSuffix = realPrefix
|
}
|
||||||
if utils.Str2Int64(prefix) > 9999 {
|
skuNameExt.YbNameSuffix = realPrefix
|
||||||
return nil, fmt.Errorf("银豹的商品后缀已超过9999!")
|
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)
|
UpdateConfig(jxcontext.AdminCtx, "yinbaoCookie", model.ConfigTypeCookie, cookie)
|
||||||
return err
|
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)
|
cms.RefreshJdLevel(jxcontext.AdminCtx)
|
||||||
//删除操作日志
|
//删除操作日志
|
||||||
event.DeleteOperateEventAndDetail(jxcontext.AdminCtx, time.Now().AddDate(0, -1, 0))
|
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) {
|
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