畅销品查询终极修改

This commit is contained in:
苏尹岚
2020-01-13 12:51:14 +08:00
parent 31cc85e21c
commit ce74fb7128
2 changed files with 6 additions and 9 deletions

View File

@@ -2273,28 +2273,25 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam
payPercentage = store.PayPercentage
}
for _, v := range skuNameAndPlace {
var skuMap = make(map[int]*dao.StoreSkuSyncInfo)
if skuNameMap[v.ID] != nil {
var skuList []*model.SkuAndName
storeSkuSyncInfo, _ := dao.GetStoreSkusAndSkuName(db, []int{storeID}, nil, []int{v.ID})
for _, storeSkuSync := range storeSkuSyncInfo {
skuMap[storeSkuSync.ID] = storeSkuSync
globals.SugarLogger.Debugf("test, %v ,%v", storeSkuSync.ID, storeSkuSync.Price)
sku, _ := dao.GetSkus(db, []int{storeSkuSync.ID}, nil, nil, nil)
sku[0].Price = int(storeSkuSync.Price)
skuList = append(skuList, sku...)
}
v.UnitPrice = int(storeSkuSyncInfo[0].UnitPrice)
skuList, _ := dao.GetSkus(db, nil, []int{v.ID}, nil, nil)
v.Skus = skuList
for _, vv := range skuList {
var (
storeSkuNameExt []*dao.StoreSkuNameExt
skusList []*dao.StoreSkuExt
price int
)
vv.StoreSkuStatus = model.StoreSkuBindStatusDontSale
price = int(skuMap[vv.ID].Price)
vv.Price = price
skus := &dao.StoreSkuExt{
SkuID: vv.ID,
BindPrice: price,
BindPrice: vv.Price,
}
skusList = append(skusList, skus)
storeSkuName := &dao.StoreSkuNameExt{

View File

@@ -1535,7 +1535,7 @@ func GetPriceReferPrice(db *DaoDB, cityCode int, skuID int, snapDate time.Time)
func GetStoreSkusAndSkuName(db *DaoDB, storeIDs, skuIDs, nameIDs []int) (storeSkuSyncInfo []*StoreSkuSyncInfo, err error) {
sql := `
SELECT a.id bind_id, a.store_id, a.jd_sync_status, a.mtwm_sync_status, a.ebai_sync_status, a.unit_price,
SELECT a.id bind_id, a.store_id, a.jd_sync_status, a.mtwm_sync_status, a.ebai_sync_status, a.unit_price, a.price,
c.id name_id, c.unit, b.*
FROM store_sku_bind a
JOIN sku b ON b.id = a.sku_id AND b.deleted_at = ?