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