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 {
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"crypto/aes"
|
||||
"crypto/cipher"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"golang.org/x/text/encoding/simplifiedchinese"
|
||||
@@ -758,7 +757,7 @@ func h8l82int(h, l string) (i int64) {
|
||||
for j := 0; j < flag2; j++ {
|
||||
s2 = "0" + s2
|
||||
}
|
||||
i, _ = strconv.ParseInt(s1+s2, 2, 10)
|
||||
i, _ = strconv.ParseInt(s1+s2, 2, 32)
|
||||
return i
|
||||
}
|
||||
|
||||
@@ -778,10 +777,11 @@ func TestUpdateStatus(t *testing.T) {
|
||||
// json.Unmarshal(result, &mobile)
|
||||
//}
|
||||
//fmt.Println(utils.Format4Output(mobile, true))
|
||||
str := "z"
|
||||
printDataGBK, _ := Utf8ToGbk([]byte(str))
|
||||
printData := hex.EncodeToString(printDataGBK)
|
||||
fmt.Println(printData)
|
||||
//data := "1e00180200015032303231303631353030303031308628e9"
|
||||
//orderNo := h8l82int(data[len(data)-6:len(data)-4], data[len(data)-4:len(data)-2])
|
||||
//base, _ := strconv.ParseInt(data[len(data)-6:len(data)-4]+data[len(data)-4:len(data)-2], 16, 10)
|
||||
i, _ := strconv.ParseInt("8628", 16, 32)
|
||||
fmt.Println(xtob("86"), xtob("28"), i)
|
||||
}
|
||||
|
||||
func sss() (data2 []byte) {
|
||||
|
||||
@@ -154,7 +154,7 @@ func TestRetailDiscountBatchSave(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRetailDiscountList(t *testing.T) {
|
||||
result, err := api.RetailDiscountList(testPoiCode, RetailActTypeDirectDown)
|
||||
result, err := api.RetailDiscountList("12405467", RetailActTypeDirectDown)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -19,13 +19,13 @@ func init() {
|
||||
baseapi.Init(sugarLogger)
|
||||
|
||||
// 菜市
|
||||
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||
|
||||
// 果园
|
||||
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||
|
||||
//商超
|
||||
// api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_tE0txRtx7CRuPIOjh2BH4w") //token_nH_IlcWQKAkZBqklwItNRw
|
||||
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_gbUPuDi9v0BKfnjdFz5IYw") //token_nH_IlcWQKAkZBqklwItNRw
|
||||
cookieStr := `
|
||||
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user