From b36f8b3ae1ab60ab6acf2ee74a2a0e7e716626f6 Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 15 Aug 2019 18:43:55 +0800 Subject: [PATCH] =?UTF-8?q?-=20UpdateStoresSkusSale=E4=B8=AD=E5=AF=B9?= =?UTF-8?q?=E4=BA=8EautoSaleAt=E6=8C=89=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=A4=84=E7=90=86=EF=BC=8C=E4=B8=8D=E7=AE=A1?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E4=BC=A0=E7=9A=84=E5=85=B7=E4=BD=93?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 12 ++++++++++++ business/jxstore/misc/misc.go | 2 +- business/model/api_config.go | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index ef0b820f2..9d904f2e1 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -163,6 +163,8 @@ type tGetStoresSkusInfo struct { const ( maxStoreNameBind = 3000 // 最大门店SkuName bind个数 maxStoreNameBind2 = 10000 // 最大门店乘SkuName个数 + + AutoSaleAtStr = "20:25:00" ) func GetStoreSkus(ctx *jxcontext.Context, storeID int, skuIDs []int, isFocus bool, keyword string, isBySku bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *StoreSkuNamesInfo, err error) { @@ -1307,6 +1309,15 @@ func getSkuSaleStatus(inSkuBind *StoreSkuBindSkuInfo, skuBindInfo *StoreSkuBindI return model.StoreSkuBindStatusNA } +func formatAutoSaleTime(autoSaleTime time.Time) (outAutoSaleTime time.Time) { + if utils.IsTimeZero(autoSaleTime) { + outAutoSaleTime = utils.DefaultTimeValue + } else { + outAutoSaleTime = jxutils.GetNextTimeFromList(time.Now(), []string{AutoSaleAtStr}) + } + return outAutoSaleTime +} + // todo 应该用updateStoresSkusWithoutSync实现 func updateStoreSkusSaleWithoutSync(ctx *jxcontext.Context, storeID int, skuBindSkuInfos []*StoreSkuBindSkuInfo, autoSaleTime time.Time, userName string) (needSyncSkus []int, err error) { var num int64 @@ -1331,6 +1342,7 @@ func updateStoreSkusSaleWithoutSync(ctx *jxcontext.Context, storeID int, skuBind dao.Rollback(db) return nil, err } + autoSaleTime = formatAutoSaleTime(autoSaleTime) for _, skuBind := range storeSkuList { if v := skuBindSkuInfosMap[skuBind.SkuID]; v != nil && v.IsSale != 0 { if v.IsSale == 1 { diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 398cb170d..7895ca639 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -52,7 +52,7 @@ var ( } autoSaleStoreSkuTimeList = []string{ - "20:20:00", + cms.AutoSaleAtStr, } importantTaskMap = &sync.Map{} diff --git a/business/model/api_config.go b/business/model/api_config.go index 1aad8ff93..3c879208f 100644 --- a/business/model/api_config.go +++ b/business/model/api_config.go @@ -3,9 +3,9 @@ package model type AppKeyConfig struct { ModelIDCULD VendorID int - AppKey string // 同一平台下不同的Key + AppCode string // 同一平台下不同的商户代码 - Name string + AppName string AppType int Value1 string Value2 string