畅销品查询修改
This commit is contained in:
@@ -2234,7 +2234,7 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam
|
|||||||
var skuNameList []*model.SkuName
|
var skuNameList []*model.SkuName
|
||||||
//不可售的商品nameID列表
|
//不可售的商品nameID列表
|
||||||
sql := `
|
sql := `
|
||||||
SELECT DISTINCT b.name_id id,1 brand_id
|
SELECT DISTINCT b.name_id id
|
||||||
FROM store_sku_bind a
|
FROM store_sku_bind a
|
||||||
JOIN sku b ON a.sku_id = b.id AND b.deleted_at = ?
|
JOIN sku b ON a.sku_id = b.id AND b.deleted_at = ?
|
||||||
WHERE a.deleted_at = ?
|
WHERE a.deleted_at = ?
|
||||||
@@ -2273,12 +2273,13 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam
|
|||||||
payPercentage = store.PayPercentage
|
payPercentage = store.PayPercentage
|
||||||
}
|
}
|
||||||
for _, v := range skuNameAndPlace {
|
for _, v := range skuNameAndPlace {
|
||||||
|
var skuMap = make(map[int]*dao.StoreSkuSyncInfo)
|
||||||
if skuNameMap[v.ID] != nil {
|
if skuNameMap[v.ID] != nil {
|
||||||
priceReferList, _ := dao.GetPriceReferSnapshotNoPage(db, []int{cityCode}, nil, []int{v.ID}, utils.Time2Date(time.Now().AddDate(0, 0, -1)))
|
storeSkuSyncInfo, _ := dao.GetStoreSkusAndSkuName(db, []int{storeID}, nil, []int{v.ID})
|
||||||
if len(priceReferList) > 0 {
|
for _, storeSkuSync := range storeSkuSyncInfo {
|
||||||
v.UnitPrice = priceReferList[0].MidUnitPrice * payPercentage / 100
|
skuMap[storeSkuSync.ID] = storeSkuSync
|
||||||
}
|
}
|
||||||
v.Type = skuNameMap[v.ID].BrandID
|
v.UnitPrice = int(storeSkuSyncInfo[0].UnitPrice)
|
||||||
skuList, _ := dao.GetSkus(db, nil, []int{v.ID}, nil, nil)
|
skuList, _ := dao.GetSkus(db, nil, []int{v.ID}, nil, nil)
|
||||||
v.Skus = skuList
|
v.Skus = skuList
|
||||||
for _, vv := range skuList {
|
for _, vv := range skuList {
|
||||||
@@ -2286,20 +2287,9 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam
|
|||||||
storeSkuNameExt []*dao.StoreSkuNameExt
|
storeSkuNameExt []*dao.StoreSkuNameExt
|
||||||
skusList []*dao.StoreSkuExt
|
skusList []*dao.StoreSkuExt
|
||||||
price int
|
price int
|
||||||
specQuality float64
|
|
||||||
)
|
)
|
||||||
vv.StoreSkuStatus = model.StoreSkuBindStatusDontSale
|
vv.StoreSkuStatus = model.StoreSkuBindStatusDontSale
|
||||||
if vv.Unit == model.SpecialUnit {
|
vv.Price = int(skuMap[vv.ID].Price)
|
||||||
if vv.SpecUnit == model.SpecUnitNames[1] || vv.SpecUnit == model.SpecUnitNames[2] {
|
|
||||||
specQuality = float64(vv.SpecQuality) * 1000
|
|
||||||
} else {
|
|
||||||
specQuality = float64(vv.SpecQuality)
|
|
||||||
}
|
|
||||||
price = int(utils.Float64TwoInt64(specQuality / utils.Int2Float64(model.SpecialSpecQuality) * utils.Int2Float64(v.UnitPrice)))
|
|
||||||
} else {
|
|
||||||
price = v.UnitPrice
|
|
||||||
}
|
|
||||||
vv.Price = price
|
|
||||||
skus := &dao.StoreSkuExt{
|
skus := &dao.StoreSkuExt{
|
||||||
SkuID: vv.ID,
|
SkuID: vv.ID,
|
||||||
BindPrice: price,
|
BindPrice: price,
|
||||||
|
|||||||
Reference in New Issue
Block a user