价格统计

This commit is contained in:
苏尹岚
2020-01-06 08:51:24 +08:00
parent c616808290
commit 36a46455ce
4 changed files with 12 additions and 15 deletions

View File

@@ -99,13 +99,13 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
var (
citySkuMap = make(map[int]map[int][]int)
resultMap = make(map[int]map[int]*model.PriceReferSnapshot)
tList []*tStoreSkuBindAndSkuName
)
storeList, err := dao.GetStoreList(db, nil, nil, "")
if err != nil {
return result, err
}
for _, v := range storeList {
var tList []*tStoreSkuBindAndSkuName
sql := `
SELECT DISTINCT b.city_code, a.store_id, Round(a.unit_price/IF(b.pay_percentage < 50 , 70, b.pay_percentage) * 100) AS unit_price, c.name_id
FROM store_sku_bind a
@@ -145,9 +145,6 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
if len(tList) > 0 {
for _, vv := range tList {
skuNameMap[vv.NameID] = append(skuNameMap[vv.NameID], vv.UnitPrice)
if v.CityCode == 110100 && vv.NameID == 11410 {
fmt.Println(v.ID, vv)
}
}
if citySkuMap[v.CityCode] != nil {
for nameID, unitPriceList := range skuNameMap {
@@ -162,7 +159,6 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
}
}
}
fmt.Println(citySkuMap)
for k1, v := range citySkuMap {
skuNameMap := make(map[int]*model.PriceReferSnapshot)
for k2, _ := range v {