畅销品查询
This commit is contained in:
@@ -2220,17 +2220,6 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam
|
|||||||
WHERE a.deleted_at = ?
|
WHERE a.deleted_at = ?
|
||||||
AND a.store_id = ?
|
AND a.store_id = ?
|
||||||
AND a.status = ?)
|
AND a.status = ?)
|
||||||
UNION
|
|
||||||
SELECT DISTINCT a.name_id id,0 brand_id
|
|
||||||
FROM sku a
|
|
||||||
LEFT JOIN (SELECT DISTINCT b.name_id
|
|
||||||
FROM store_sku_bind a
|
|
||||||
JOIN sku b ON a.sku_id = b.id
|
|
||||||
WHERE a.deleted_at = ?
|
|
||||||
AND store_id = ?)b ON a.name_id = b.name_id
|
|
||||||
WHERE a.status = ?
|
|
||||||
AND a.deleted_at = ?
|
|
||||||
AND b.name_id IS NULL
|
|
||||||
`
|
`
|
||||||
sqlParams := []interface{}{
|
sqlParams := []interface{}{
|
||||||
utils.DefaultTimeValue,
|
utils.DefaultTimeValue,
|
||||||
@@ -2253,11 +2242,13 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam
|
|||||||
}
|
}
|
||||||
for _, v := range skuNameAndPlace {
|
for _, v := range skuNameAndPlace {
|
||||||
if skuNameMap[v.ID] != nil {
|
if skuNameMap[v.ID] != nil {
|
||||||
priceReferList, _, _ := dao.GetPriceReferSnapshot(db, []int{cityCode}, nil, v.ID, utils.Time2Date(time.Now().AddDate(0, 0, -1)), 0, 9999)
|
priceReferList, _ := dao.GetPriceReferSnapshotNoPage(db, []int{cityCode}, nil, []int{v.ID}, utils.Time2Date(time.Now().AddDate(0, 0, -1)))
|
||||||
if len(priceReferList) > 0 {
|
if len(priceReferList) > 0 {
|
||||||
v.Price = priceReferList[0].MidUnitPrice
|
v.Price = priceReferList[0].MidUnitPrice
|
||||||
}
|
}
|
||||||
v.Type = skuNameMap[v.ID].BrandID
|
v.Type = skuNameMap[v.ID].BrandID
|
||||||
|
skuList, _ := dao.GetSkus(db, nil, []int{v.ID}, nil, nil)
|
||||||
|
v.Skus = skuList
|
||||||
skuNameAndPlaceList = append(skuNameAndPlaceList, v)
|
skuNameAndPlaceList = append(skuNameAndPlaceList, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,6 +207,7 @@ type SkuNameAndPlace struct {
|
|||||||
Sequence int `json:"sequence"`
|
Sequence int `json:"sequence"`
|
||||||
Count int `json:"count"`
|
Count int `json:"count"`
|
||||||
Type int `json:"type"`
|
Type int `json:"type"`
|
||||||
|
Skus []*model.SkuAndName `json:"skus"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StoreSkuPriceAndWeight struct {
|
type StoreSkuPriceAndWeight struct {
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ type PriceReferSnapshot struct {
|
|||||||
|
|
||||||
func (*PriceReferSnapshot) TableUnique() [][]string {
|
func (*PriceReferSnapshot) TableUnique() [][]string {
|
||||||
return [][]string{
|
return [][]string{
|
||||||
[]string{"CityCode", "SkuID", "SnapshotAt"},
|
[]string{"CityCode", "NameID", "SkuID", "SnapshotAt"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user