查询推荐品,新增活动系列字段

This commit is contained in:
苏尹岚
2020-01-13 09:03:02 +08:00
parent 65a54b603b
commit 78fcdeaf39
3 changed files with 40 additions and 15 deletions

View File

@@ -2276,11 +2276,28 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam
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))) 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 * payPercentage / 100 v.UnitPrice = priceReferList[0].MidUnitPrice * payPercentage / 100
} }
v.Type = skuNameMap[v.ID].BrandID v.Type = skuNameMap[v.ID].BrandID
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
var storeSkuNameExt []*dao.StoreSkuNameExt
for _, vv := range skuList {
storeSkuName := &dao.StoreSkuNameExt{
SkuID: vv.ID,
}
var skuNamesInfo = &dao.StoreSkuNamesInfo{
SkuNames: storeSkuNameExt,
}
dao.UpdateActPrice4StoreSkuNameNew(db, []int{storeID}, []int{vv.ID}, skuNamesInfo, -1)
vv.StoreSkuStatus = model.StoreSkuBindStatusDontSale
vv.ActPrice = skuNamesInfo.SkuNames[0].Skus[0].ActPrice
vv.ActID = skuNamesInfo.SkuNames[0].Skus[0].ActID
vv.ActType = skuNamesInfo.SkuNames[0].Skus[0].ActType
vv.EarningPrice = skuNamesInfo.SkuNames[0].Skus[0].EarningPrice
vv.EarningActID = skuNamesInfo.SkuNames[0].Skus[0].EarningActID
storeSkuNameExt = append(storeSkuNameExt, storeSkuName)
}
skuNameAndPlaceList = append(skuNameAndPlaceList, v) skuNameAndPlaceList = append(skuNameAndPlaceList, v)
} }
} }

View File

@@ -210,12 +210,13 @@ type StoreSkuExt struct {
type SkuNameAndPlace struct { type SkuNameAndPlace struct {
model.SkuName model.SkuName
CityCode int `json:"cityCode"` UnitPrice int `json:"unitPrice"`
CityName string `json:"cityName"` CityCode int `json:"cityCode"`
Sequence int `json:"sequence"` CityName string `json:"cityName"`
Count int `json:"count"` Sequence int `json:"sequence"`
Type int `json:"type"` Count int `json:"count"`
Skus []*model.SkuAndName `json:"skus"` Type int `json:"type"`
Skus []*model.SkuAndName `json:"skus"`
} }
type StoreSkuPriceAndWeight struct { type StoreSkuPriceAndWeight struct {

View File

@@ -231,14 +231,21 @@ type Sku struct {
type SkuAndName struct { type SkuAndName struct {
Sku Sku
Name string Name string
Unit string Unit string
Prefix string Prefix string
IsSpu int IsSpu int
ExPrefix string ExPrefix string
ExPrefixBegin *time.Time ExPrefixBegin *time.Time
ExPrefixEnd *time.Time ExPrefixEnd *time.Time
Price int Price int
StoreSkuStatus int
ActPrice int `json:"actPrice"`
ActID int `orm:"column(act_id)" json:"actID"`
ActType int `orm:"column(act_type)" json:"actType"`
EarningPrice int `json:"earningPrice"`
EarningActID int `orm:"column(earning_act_id)" json:"earningActID"`
} }
func (*Sku) TableUnique() [][]string { func (*Sku) TableUnique() [][]string {