This commit is contained in:
邹宗楠
2023-03-30 11:21:41 +08:00
parent 5440383ee4
commit 76981718b9
3 changed files with 199 additions and 93 deletions

View File

@@ -134,6 +134,29 @@ type RetailDiscountActData struct {
//SkuId string `json:"sku_id"` // 京西商品id
}
type GetStoreRetailDiscountActData struct {
AppFoodCode string `json:"app_food_code"`
UserType int `json:"user_type"`
StartTime int64 `json:"start_time"` // 活动开始时间,单位秒
EndTime int64 `json:"end_time"` // 活动结束时间,单位秒
OrderLimit int `json:"order_limit"` // 每单限购1)只能是正整数或-1。2)最大为10。
DayLimit int `json:"day_limit"` // 当日活动库存:只能是正整数或-1。
Period string `json:"period,omitempty"`
WeeksTime string `json:"weeks_time,omitempty"`
SettingType int `json:"setting_type"`
ActPrice float64 `json:"act_price,omitempty"` // 折扣价格(单位元)必须为大于0的数字且不能超过2位小数。
DiscountCoefficient float64 `json:"discount_coefficient,omitempty"` // 折扣系数必须大于0小于9.8最多支持两位小数。如输入3即为3折
Sequence int `json:"sequence,omitempty"`
ItemID int64 `json:"item_id,omitempty"` // 活动ID为什么这里又是int64
// list时用
OriginalPrice float64 `json:"origin_price,omitempty"` // 商品原价,单位元
Stock int `json:"stock,omitempty"` // 当日剩余活动商品数量。只有当发起查询时间处于活动生效时段内时(start_time、end_time、period、weeks_time均需满足),该字段才代表实际剩余活动商品数量,否则显示的是创建活动时规定的当日活动库存
Status int `json:"status,omitempty"` // 活动状态0:已过期1:已生效2:待生效。
Name string `json:"name,omitempty"`
SkuId string `json:"sku_id"` // 京西商品id
}
type RetailDiscountActResult struct {
AppFoodCode string `json:"app_food_code"`
StartTime int64 `json:"start_time"` // 活动开始时间,单位秒
@@ -391,7 +414,7 @@ func parseErr4ErrList(msg string) (failedList []*AppFoodResult) {
// 查询门店零售折扣商品
// http://developer.waimai.meituan.com/home/docDetail/288
func (a *API) RetailDiscountList(poiCode string, actType int) (actList []*RetailDiscountActData, err error) {
func (a *API) RetailDiscountList(poiCode string, actType int) (actList []*GetStoreRetailDiscountActData, err error) {
limit := 200
offset := 0
if actType == 0 {
@@ -406,7 +429,7 @@ func (a *API) RetailDiscountList(poiCode string, actType int) (actList []*Retail
"offset": offset,
})
if err == nil {
var tmpActList []*RetailDiscountActData
var tmpActList []*GetStoreRetailDiscountActData
if err = utils.Map2StructByJson(result, &tmpActList, false); err != nil {
return nil, err
}