- UpdateStoresSkusSale中对于autoSaleAt按服务器设置处理,不管客户端传的具体值

This commit is contained in:
gazebo
2019-08-15 18:43:55 +08:00
parent 5e6c087ba2
commit b36f8b3ae1
3 changed files with 15 additions and 3 deletions

View File

@@ -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 {

View File

@@ -52,7 +52,7 @@ var (
}
autoSaleStoreSkuTimeList = []string{
"20:20:00",
cms.AutoSaleAtStr,
}
importantTaskMap = &sync.Map{}

View File

@@ -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