aa
This commit is contained in:
@@ -44,6 +44,15 @@ var (
|
||||
"38", //:跨seller商品满减券,
|
||||
"39", //:跨seller运费券
|
||||
}
|
||||
|
||||
//优惠类型
|
||||
DiscountTypeMap = map[int]string{
|
||||
1: "减钱",
|
||||
2: "折扣",
|
||||
3: "一口价",
|
||||
4: "买赠",
|
||||
5: "下单返券",
|
||||
}
|
||||
)
|
||||
|
||||
type ActivityRule struct {
|
||||
@@ -272,6 +281,7 @@ func (a *API) ActivitySkuUpdateBatch(activityID int64, actSkuInfoList []*Activit
|
||||
func (a *API) ActMultiChannelQueryIDs(shopID string, baiduShopID int64, actType string) (actIDs []int64, err error) {
|
||||
params := a.genShopIDParams(shopID, baiduShopID, 0)
|
||||
params["query_activity_type"] = actType
|
||||
params["page_size"] = 100
|
||||
result, err := a.AccessAPI("act.multi.channel.queryids", params)
|
||||
if err == nil {
|
||||
if result.Data != nil {
|
||||
@@ -283,3 +293,94 @@ func (a *API) ActMultiChannelQueryIDs(shopID string, baiduShopID int64, actType
|
||||
}
|
||||
return actIDs, err
|
||||
}
|
||||
|
||||
type ActMultiChannelQueryInfosResult struct {
|
||||
Activityplatform int `json:"activityPlatform"`
|
||||
Childtype int `json:"childType"`
|
||||
Periodsandruleapilist []struct {
|
||||
Periods []struct {
|
||||
Weekday string `json:"weekday"`
|
||||
Closetime string `json:"closeTime"`
|
||||
Opentime string `json:"openTime"`
|
||||
} `json:"periods"`
|
||||
} `json:"periodsAndRuleApiList"`
|
||||
Skulist []*ActMultiChannelQueryInfosSkuList `json:"skuList"`
|
||||
Deliverychannel int `json:"deliveryChannel"`
|
||||
Limitruleapi struct {
|
||||
Usertotalcountlimit int `json:"userTotalCountLimit"`
|
||||
Userdaycountlimit int `json:"userDayCountLimit"`
|
||||
} `json:"limitRuleApi"`
|
||||
Activityname string `json:"activityName"`
|
||||
Activityid int64 `json:"activityId"`
|
||||
Createtime int64 `json:"createTime"`
|
||||
Starttime int64 `json:"startTime"`
|
||||
Endtime int64 `json:"endTime"`
|
||||
Skutotal int `json:"skuTotal"`
|
||||
Activitytype int `json:"activityType"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
|
||||
type ActMultiChannelQueryInfosSkuList struct {
|
||||
Itemid int64 `json:"itemId"`
|
||||
Periodsandruleapilist []struct {
|
||||
Ruleapi struct {
|
||||
Subsidyapi struct {
|
||||
Agentsubsidy int `json:"agentSubsidy"`
|
||||
Elemesubsidy int `json:"elemeSubsidy"`
|
||||
Shopsubsidy int `json:"shopSubsidy"`
|
||||
} `json:"subsidyApi"`
|
||||
Discount int `json:"discount"`
|
||||
Discounttype int `json:"discountType"`
|
||||
} `json:"ruleApi"`
|
||||
} `json:"periodsAndRuleApiList"`
|
||||
Wid int64 `json:"wid"`
|
||||
Limitruleapi struct {
|
||||
Usertotalcountlimit int `json:"userTotalCountLimit"`
|
||||
Detaildaycountlimit int `json:"detailDayCountLimit"`
|
||||
Detailcountlimit int `json:"detailCountLimit"`
|
||||
Userdaycountlimit int `json:"userDayCountLimit"`
|
||||
} `json:"limitRuleApi"`
|
||||
Realstock int `json:"realStock"`
|
||||
Dayrealstock int `json:"dayRealStock"`
|
||||
Storeid int `json:"storeId"`
|
||||
Upcname string `json:"upcName"`
|
||||
Skuid string `json:"skuId"`
|
||||
}
|
||||
|
||||
// 多渠道查询活动详情
|
||||
func (a *API) ActMultiChannelQueryInfos(activityID, shopID string, baiduShopID int64) (actMultiChannelQueryInfosResult *ActMultiChannelQueryInfosResult, err error) {
|
||||
pageSize := 100
|
||||
params := a.genShopIDParams(shopID, baiduShopID, 0)
|
||||
params["activity_id"] = activityID
|
||||
params["page_size"] = pageSize
|
||||
result, err := a.AccessAPI("act.multi.channel.queryinfos", params)
|
||||
if err == nil {
|
||||
if result.Data != nil {
|
||||
utils.Map2StructByJson(result.Data.(map[string]interface{}), &actMultiChannelQueryInfosResult, false)
|
||||
if actMultiChannelQueryInfosResult.Skutotal > pageSize {
|
||||
for page := 2; page < actMultiChannelQueryInfosResult.Skutotal/pageSize+2; page++ {
|
||||
actMultiChannelQueryInfosResult.Skulist = append(actMultiChannelQueryInfosResult.Skulist, a.ActMultiChannelQueryInfosPage(activityID, shopID, baiduShopID, page)...)
|
||||
}
|
||||
} else {
|
||||
return actMultiChannelQueryInfosResult, err
|
||||
}
|
||||
}
|
||||
}
|
||||
return actMultiChannelQueryInfosResult, err
|
||||
}
|
||||
|
||||
// 多渠道查询活动详情
|
||||
func (a *API) ActMultiChannelQueryInfosPage(activityID, shopID string, baiduShopID int64, page int) (actMultiChannelQueryInfosSkuList []*ActMultiChannelQueryInfosSkuList) {
|
||||
pageSize := 100
|
||||
params := a.genShopIDParams(shopID, baiduShopID, 0)
|
||||
params["activity_id"] = activityID
|
||||
params["page_size"] = pageSize
|
||||
params["page"] = page
|
||||
result, err := a.AccessAPI("act.multi.channel.queryinfos", params)
|
||||
if err == nil {
|
||||
if result.Data != nil {
|
||||
utils.Map2StructByJson(result.Data.(map[string]interface{})["skuList"], &actMultiChannelQueryInfosSkuList, false)
|
||||
}
|
||||
}
|
||||
return actMultiChannelQueryInfosSkuList
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func TestActivityUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestActivityGet(t *testing.T) {
|
||||
activityInfo, err := api.ActivityGet(0, "", 0, 0)
|
||||
activityInfo, err := api.ActivityGet(6000000380161091, "", 100000045925, 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
@@ -95,7 +95,16 @@ func TestActivitySkuList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestActMultiChannelQueryIDs(t *testing.T) {
|
||||
result, err := api.ActMultiChannelQueryIDs("", 200000066556, "2")
|
||||
result, err := api.ActMultiChannelQueryIDs("", 100000045925, "2")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
|
||||
}
|
||||
|
||||
func TestActMultiChannelQueryInfos(t *testing.T) {
|
||||
result, err := api.ActMultiChannelQueryInfos("6000000418366727", "", 100000045925)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
func TestOrderGet(t *testing.T) {
|
||||
result, err := api.OrderGet("5027183668737301717")
|
||||
result, err := api.OrderGet("2157781636259071682")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user