- mtwm优惠券
This commit is contained in:
@@ -42,7 +42,7 @@ const (
|
||||
type FullDiscountActInfo struct {
|
||||
ActIDs string `json:"act_ids"`
|
||||
ActName string `json:"act_name"`
|
||||
StartTime int64 `json:"start_time"` // 活动开始时间,单s位秒
|
||||
StartTime int64 `json:"start_time"` // 活动开始时间,单位秒
|
||||
EndTime int64 `json:"end_time"` // 活动结束时间,单位秒
|
||||
ActType int `json:"act_type"`
|
||||
Status int `json:"-"`
|
||||
@@ -84,7 +84,7 @@ type ShippingFeeActDetail struct {
|
||||
}
|
||||
|
||||
type ShippingFeeActData struct {
|
||||
StartTime int64 `json:"start_time"` // 活动开始时间,单s位秒
|
||||
StartTime int64 `json:"start_time"` // 活动开始时间,单位秒
|
||||
EndTime int64 `json:"end_time"` // 活动结束时间,单位秒
|
||||
WeeksTime string `json:"weeks_time,omitempty"`
|
||||
Period string `json:"period,omitempty"`
|
||||
@@ -99,7 +99,7 @@ type ShippingFeeActData struct {
|
||||
type RetailActData struct {
|
||||
AppFoodCode string `json:"app_food_code"`
|
||||
UserType int `json:"user_type"`
|
||||
StartTime int64 `json:"start_time"` // 活动开始时间,单s位秒
|
||||
StartTime int64 `json:"start_time"` // 活动开始时间,单位秒
|
||||
EndTime int64 `json:"end_time"` // 活动结束时间,单位秒
|
||||
OrderLimit int `json:"order_limit"`
|
||||
DayLimit int `json:"day_limit"`
|
||||
@@ -124,6 +124,40 @@ type RetailActDataLimit struct {
|
||||
OrderLimit int `json:"order_limit,omitempty"` // 每单可购买的折扣商品数量
|
||||
}
|
||||
|
||||
type LimitTime struct {
|
||||
StartTime int64 `json:"start_time"` // 活动开始时间,单位秒
|
||||
EndTime int64 `json:"end_time"` // 活动结束时间,单位秒
|
||||
}
|
||||
|
||||
type CouponInfo struct {
|
||||
LimitPrice float64 `json:"limit_price"` //使用门槛,单位元
|
||||
CouponPrice float64 `json:"coupon_price"` // 优惠券金额,单位元
|
||||
UserType int `json:"user_type"` // 可领用户类型,新客、老客、全部
|
||||
ValidityDays int `json:"validity_days"` //使用有效期,用户领用了此商家券后在领用日起多久内可有效使用
|
||||
Stock int `json:"stock"`
|
||||
}
|
||||
|
||||
type CouponData struct {
|
||||
LimitPrice float64 `json:"limit_price"` //使用门槛,单位元
|
||||
CouponPrice float64 `json:"coupon_price"` // 优惠券金额,单位元
|
||||
UserType int `json:"user_type"` // 可领用户类型,新客、老客、全部
|
||||
ValidityDays int `json:"validity_days"` //使用有效期,用户领用了此商家券后在领用日起多久内可有效使用
|
||||
Stock int `json:"stock"`
|
||||
|
||||
UseCount int `json:"use_count"` // 劵已使用数量
|
||||
SentCount int `json:"sent_count"` // 劵已发数量
|
||||
}
|
||||
|
||||
type CouponActInfo struct {
|
||||
AppPoiCode string `json:"app_poi_code"`
|
||||
StartTime int64 `json:"start_time"` // 活动开始时间,单位秒
|
||||
EndTime int64 `json:"end_time"` // 活动结束时间,单位秒
|
||||
ActData []*CouponData `json:"act_data"` // 活动数据
|
||||
ActID int64 `json:"actId"`
|
||||
RemainDays int `json:"remain_days"` // 活动剩余天数
|
||||
Status int `json:"status"` // 活动状态
|
||||
}
|
||||
|
||||
// 批量创建指定商品满减活动或创建店内满减活动
|
||||
// http://developer.waimai.meituan.com/home/docDetail/255
|
||||
func (a *API) FullDiscountBatchSave(poiCode string, actInfo *FullDiscountActInfo, actList []*FullDiscountActDetail, actSkuList []*FullDiscountSku) (actID int64, err error) {
|
||||
@@ -335,3 +369,42 @@ func (a *API) RetailDiscountBatchLimit(poiCode, actDataList []*RetailActDataLimi
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
// 批量新增商家券(店内发券)活动
|
||||
// http://developer.waimai.meituan.com/home/docDetail/312
|
||||
func (a *API) InStoreCouponBatchSave(poiCode string, limitTime *LimitTime, couponInfoList []*CouponInfo) (actID int64, err error) {
|
||||
result, err := a.AccessAPI2("act/instore/coupon/batchsave", false, map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
"limit_time": string(utils.MustMarshal(limitTime)),
|
||||
"act_data": string(utils.MustMarshal(couponInfoList)),
|
||||
}, resultKeyMsg)
|
||||
if err == nil {
|
||||
actID = utils.MustInterface2Int64(result.([]interface{})[0].(map[string]interface{})["act_id"])
|
||||
}
|
||||
return actID, err
|
||||
}
|
||||
|
||||
// 批量删除商家券(店内发券)活动
|
||||
// http://developer.waimai.meituan.com/home/docDetail/313
|
||||
func (a *API) InStoreCouponDelete(poiCode string, actIDList []string) (err error) {
|
||||
_, err = a.AccessAPI("act/instore/coupon/delete", false, map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
"act_ids": strings.Join(actIDList, ","),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
// 查询商家券(店内发券)活动
|
||||
// http://developer.waimai.meituan.com/home/docDetail/314
|
||||
// 页码从1开始
|
||||
func (a *API) InStoreCouponList(poiCode string, pageNum, pageSize int) (couponActList []*CouponActInfo, err error) {
|
||||
result, err := a.AccessAPI("act/instore/coupon/list", false, map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
"page_num": pageNum,
|
||||
"page_size": pageSize,
|
||||
})
|
||||
if err == nil {
|
||||
err = utils.Map2StructByJson(result, &couponActList, false)
|
||||
}
|
||||
return couponActList, err
|
||||
}
|
||||
|
||||
@@ -94,3 +94,11 @@ func TestRetailDiscountDelete(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInStoreCouponList(t *testing.T) {
|
||||
result, err := api.InStoreCouponList("6783616", 1, 100)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ type CallbackRefundInfo struct {
|
||||
|
||||
OrderID int64 `json:"order_id"`
|
||||
NotifyType string `json:"notify_type"`
|
||||
RefundID int64 `json:"refund_id"`
|
||||
Ctime int64 `json:"ctime"`
|
||||
Reason string `json:"reason"`
|
||||
ResType int `json:"res_type"`
|
||||
IsAppeal int `json:"is_appeal"`
|
||||
|
||||
Reference in New Issue
Block a user