美团力荐修改

This commit is contained in:
苏尹岚
2020-02-20 14:49:47 +08:00
parent da1dde3c1a
commit 37e61e2780
2 changed files with 32 additions and 28 deletions

BIN
111.xlsx Normal file

Binary file not shown.

View File

@@ -185,6 +185,12 @@ type JdStoreSkus struct {
Price int `json:"price"` Price int `json:"price"`
} }
type tUpdateSkuSpecTag struct {
StoreID int `json:"storeID"`
SkuID int `json:"skuID"`
IsSpec int `json:"isSpec"`
}
const ( const (
maxStoreNameBind = 10000 // 最大门店SkuName bind个数 maxStoreNameBind = 10000 // 最大门店SkuName bind个数
maxStoreNameBind2 = 10000 // 最大门店乘SkuName个数 maxStoreNameBind2 = 10000 // 最大门店乘SkuName个数
@@ -3315,8 +3321,8 @@ func UpdateStoreSkusSpecTag(ctx *jxcontext.Context, vendorIDs []int, files []*mu
func UpdateStoreSkusSpecTagBin(ctx *jxcontext.Context, reader io.Reader, vendorIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) { func UpdateStoreSkusSpecTagBin(ctx *jxcontext.Context, reader io.Reader, vendorIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
var ( var (
db = dao.GetDB() db = dao.GetDB()
storeSkuMap = make(map[int][]*partner.StoreSkuInfo) results []*tUpdateSkuSpecTag
) )
taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) { taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
switch step { switch step {
@@ -3331,32 +3337,29 @@ func UpdateStoreSkusSpecTagBin(ctx *jxcontext.Context, reader io.Reader, vendorI
if rowNum < 1 { if rowNum < 1 {
continue continue
} }
getCellForSpecTag(rowNum, row, storeSkuMap) getCellForSpecTag(rowNum, row, results)
} }
case 1: case 1:
for storeID, storeSkuInfos := range storeSkuMap { for i := 0; i < len(results)/2; i++ {
for i := 0; i < len(storeSkuInfos)/2; i++ { tmp := results[i]
tmp := storeSkuInfos[i] results[i] = results[len(results)-i-1]
storeSkuInfos[i] = storeSkuInfos[len(storeSkuInfos)-i-1] results[len(results)-i-1] = tmp
storeSkuInfos[len(storeSkuInfos)-i-1] = tmp }
for _, v := range results {
store, err := dao.GetStoreDetail(db, v.StoreID, model.VendorIDMTWM)
storeSkus, err := dao.GetStoresSkusInfo(db, []int{v.StoreID}, []int{v.SkuID})
if err != nil || store == nil {
continue
} }
for _, v := range storeSkuInfos { var foodData = make(map[string]interface{})
store, err := dao.GetStoreDetail(db, storeID, model.VendorIDMTWM) if v.IsSpec != 0 && v.IsSpec == -1 {
storeSkus, err := dao.GetStoresSkusInfo(db, []int{storeID}, []int{v.SkuID}) v.IsSpec = 0
if err != nil || store == nil { }
continue foodData["is_specialty"] = v.IsSpec
} foodData["price"] = storeSkus[0].MtwmPrice
var foodData = make(map[string]interface{}) if globals.EnableMtwmStoreWrite {
if v.IsSpecialty != 0 && v.IsSpecialty == -1 { err = api.MtwmAPI.RetailInitData(ctx.GetTrackInfo(), store.VendorStoreID, utils.Int2Str(v.SkuID), foodData)
v.IsSpecialty = 0
}
foodData["is_specialty"] = v.IsSpecialty
foodData["price"] = storeSkus[0].MtwmPrice
if globals.EnableMtwmStoreWrite {
err = api.MtwmAPI.RetailInitData(ctx.GetTrackInfo(), store.VendorStoreID, utils.Int2Str(v.SkuID), foodData)
}
} }
} }
} }
return result, err return result, err
@@ -3372,9 +3375,9 @@ func UpdateStoreSkusSpecTagBin(ctx *jxcontext.Context, reader io.Reader, vendorI
return hint, err return hint, err
} }
func getCellForSpecTag(rowNum int, row []string, storeSkuMap map[int][]*partner.StoreSkuInfo) { func getCellForSpecTag(rowNum int, row []string, storeSkuMap []*tUpdateSkuSpecTag) {
var ( var (
skuMap = &partner.StoreSkuInfo{} skuMap = &tUpdateSkuSpecTag{}
storeID int storeID int
skuID int skuID int
isSpec int isSpec int
@@ -3393,8 +3396,9 @@ func getCellForSpecTag(rowNum int, row []string, storeSkuMap map[int][]*partner.
} }
} }
skuMap.SkuID = skuID skuMap.SkuID = skuID
skuMap.IsSpecialty = isSpec skuMap.IsSpec = isSpec
storeSkuMap[storeID] = append(storeSkuMap[storeID], skuMap) skuMap.StoreID = storeID
storeSkuMap = append(storeSkuMap, skuMap)
} }
func SendSeckillSkusCountMsg(ctx *jxcontext.Context, vendorIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) { func SendSeckillSkusCountMsg(ctx *jxcontext.Context, vendorIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {