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

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 {
priceReferList, _ := dao.GetPriceReferSnapshotNoPage(db, []int{cityCode}, nil, []int{v.ID}, utils.Time2Date(time.Now().AddDate(0, 0, -1)))
if len(priceReferList) > 0 {
v.Price = priceReferList[0].MidUnitPrice * payPercentage / 100
v.UnitPrice = priceReferList[0].MidUnitPrice * payPercentage / 100
}
v.Type = skuNameMap[v.ID].BrandID
skuList, _ := dao.GetSkus(db, nil, []int{v.ID}, nil, nil)
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)
}
}

View File

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

View File

@@ -231,14 +231,21 @@ type Sku struct {
type SkuAndName struct {
Sku
Name string
Unit string
Prefix string
IsSpu int
ExPrefix string
ExPrefixBegin *time.Time
ExPrefixEnd *time.Time
Price int
Name string
Unit string
Prefix string
IsSpu int
ExPrefix string
ExPrefixBegin *time.Time
ExPrefixEnd *time.Time
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 {