1
This commit is contained in:
@@ -244,7 +244,7 @@ const (
|
||||
maxStoreNameBind = 10000 // 最大门店SkuName bind个数
|
||||
maxStoreNameBind2 = 10000 // 最大门店乘SkuName个数
|
||||
|
||||
AutoSaleAtStr = "22:00:00"
|
||||
AutoSaleAtStr = "09:35:00"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -3664,22 +3664,20 @@ func AutoSaleStoreSku(ctx *jxcontext.Context, storeIDs []int, isNeedSync bool) (
|
||||
for _, v := range storeSkuList {
|
||||
storeSkuMap[v.StoreID] = append(storeSkuMap[v.StoreID], v)
|
||||
}
|
||||
now := time.Now()
|
||||
for storeID, storeSkuList := range storeSkuMap {
|
||||
var skuIDs []int
|
||||
for _, storeSku := range storeSkuList {
|
||||
if now.Sub(storeSku.AutoSaleAt) >= 0 {
|
||||
storeSku.AutoSaleAt = utils.DefaultTimeValue
|
||||
if storeSku.Status != model.SkuStatusNormal {
|
||||
storeSku.Status = model.SkuStatusNormal
|
||||
skuIDs = append(skuIDs, storeSku.SkuID)
|
||||
}
|
||||
if _, err = dao.UpdateEntity(db, storeSku, "AutoSaleAt", model.FieldStatus); err != nil {
|
||||
return err
|
||||
}
|
||||
storeSku.AutoSaleAt = utils.DefaultTimeValue
|
||||
if storeSku.Status != model.SkuStatusNormal {
|
||||
storeSku.Status = model.SkuStatusNormal
|
||||
skuIDs = append(skuIDs, storeSku.SkuID)
|
||||
}
|
||||
if _, err = dao.UpdateEntity(db, storeSku, "AutoSaleAt", model.FieldStatus); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if isNeedSync && len(skuIDs) > 0 {
|
||||
globals.SugarLogger.Debugf("---------------AutoSaleStoreSku- := %s", utils.Format4Output(skuIDs, false))
|
||||
if _, err = CurVendorSync.SyncStoresSkus(ctx, nil, model.SyncFlagSaleMask, db, nil, []int{storeID}, skuIDs, false, true, true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user