This commit is contained in:
邹宗楠
2023-11-20 09:36:43 +08:00
parent 7ed1aa66e9
commit 763580877a
8 changed files with 59 additions and 25 deletions

View File

@@ -1,6 +1,7 @@
package ebaiapi package ebaiapi
import ( import (
"fmt"
"strings" "strings"
"git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils"
@@ -347,13 +348,14 @@ type ActMultiChannelQueryInfosSkuList struct {
Skuid string `json:"skuId"` Skuid string `json:"skuId"`
} }
// 多渠道查询活动详情 // 多渠道查询活动详情(此接口成功率不达标,原因是上一个接口获取门店活动id时,把门店结束活动id查询出来了,但是此接口查询结束活动时,失效了)
func (a *API) ActMultiChannelQueryInfos(activityID, shopID string, baiduShopID int64) (actMultiChannelQueryInfosResult *ActMultiChannelQueryInfosResult, err error) { func (a *API) ActMultiChannelQueryInfos(activityID, shopID string, baiduShopID int64) (actMultiChannelQueryInfosResult *ActMultiChannelQueryInfosResult, err error) {
pageSize := 100 pageSize := 100
params := a.genShopIDParams(shopID, baiduShopID, 0) params := a.genShopIDParams(shopID, baiduShopID, 0)
params["activity_id"] = activityID params["activity_id"] = activityID
params["page_size"] = pageSize params["page_size"] = pageSize
result, err := a.AccessAPI("act.multi.channel.queryinfos", params) result, err := a.AccessAPI("act.multi.channel.queryinfos", params)
fmt.Println(err)
if err == nil { if err == nil {
if result.Data != nil { if result.Data != nil {
utils.Map2StructByJson(result.Data.(map[string]interface{}), &actMultiChannelQueryInfosResult, false) utils.Map2StructByJson(result.Data.(map[string]interface{}), &actMultiChannelQueryInfosResult, false)

View File

@@ -1,6 +1,7 @@
package ebaiapi package ebaiapi
import ( import (
"fmt"
"testing" "testing"
"time" "time"
@@ -103,11 +104,27 @@ func TestActMultiChannelQueryIDs(t *testing.T) {
} }
//2233065924
//2233065928
//2233065934
//2233065955
//2233065956
func TestActMultiChannelQueryInfos(t *testing.T) { func TestActMultiChannelQueryInfos(t *testing.T) {
result, err := api.ActMultiChannelQueryInfos("6000000418366727", "", 100000045925) for _, v1 := range []int64{2233065924} { // , 2233065928, 2233065934, 2233065955, 2233065956
if err != nil { acts, err := api.ActMultiChannelQueryIDs("", v1, "2")
t.Fatal(err) fmt.Println(acts)
if err != nil {
fmt.Println(err)
}
for _, v := range acts {
_, err2 := api.ActMultiChannelQueryInfos(utils.Int64ToStr(v), "", v1)
if err2 != nil {
fmt.Println(err2)
}
//t.Log(utils.Format4Output(result, false))
}
} }
t.Log(utils.Format4Output(result, false))
//_, err2 := api.ActMultiChannelQueryInfos("6000000927837760", "", 2233065924)
//fmt.Println(err2)
} }

View File

@@ -169,7 +169,7 @@ func TestShopOpen(t *testing.T) {
} }
func TestShopClose(t *testing.T) { func TestShopClose(t *testing.T) {
err := api.ShopClose("", testShopBaiduID) err := api.ShopClose("", 2233065924)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@@ -23,16 +23,10 @@ func init() {
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "") //api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
// 果园 // 果园
api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "") //api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//商超 //商超
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_nngsVP37s-HXY86xe85H7Q") //token_n4TwqCntWWuvQwAawzxC0w api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_vvkN5u8ZfJgjwCQrOUNNsQ") //token_n4TwqCntWWuvQwAawzxC0w
<<<<<<< HEAD
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_rfAD6OxSVxkTeCO1XmNCZg") //token_n4TwqCntWWuvQwAawzxC0w
=======
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_rn25Arxm_1JSvQM6CWpJzQ") //token_n4TwqCntWWuvQwAawzxC0w
>>>>>>> 9b9473f25286de4923c0006093e3e6c0a928211c
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_r36FEse6_ywebQI65FNNWA") //token_n4TwqCntWWuvQwAawzxC0w
cookieStr := ` cookieStr := `
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1; acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
` `

View File

@@ -93,15 +93,36 @@ func TestRetailCatDelete(t *testing.T) {
} }
func TestRetailList(t *testing.T) { func TestRetailList(t *testing.T) {
result, err := api.RetailList("785527", 1, 100) offset := 0
if err != nil { skus := make(map[string]string, 0)
t.Fatal(err) for {
result, err := api.RetailList("17211186", offset, 100)
if err != nil {
t.Fatal(err)
}
if len(result) == 0 {
t.Fatal("should have items")
}
for _, v := range result {
if v.SkuList != nil && len(v.SkuList) > 0 {
for _, v2 := range v.SkuList {
mapSkuList := utils.Struct2MapByJson(v2)
if mapSkuList["upc"].(string) != "" {
skus[mapSkuList["upc"].(string)] = mapSkuList["price"].(string)
break
}
}
}
}
if len(result) < 100 {
break
}
offset++
} }
if len(result) == 0 {
t.Fatal("should have items") t.Log(utils.Format4Output(skus, false))
} t.Log(utils.Format4Output(len(skus), false))
t.Log(utils.Format4Output(result, false))
t.Log(len(result))
} }
func TestRetailGet(t *testing.T) { func TestRetailGet(t *testing.T) {

View File

@@ -8,7 +8,7 @@ import (
) )
// 京西速食(蔬菜) // 京西速食(蔬菜)
var token1 = `{"access_token":"624d864c-7750-4248-aecf-ac3f75b9b58e","expires_in":1700092125,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"70f8ffd2-7fe7-44f2-983f-d9db650b9fdb","authority_id":""}` var token1 = `{"access_token":"74cfcbc2-4515-4a41-b9fb-f29f39efd4ba","expires_in":1700695057,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"621872c3-5b67-452d-8e45-f5ec25cc1b86","authority_id":""}`
// 美好菜市 // 美好菜市
//var token1 = `{"access_token":"9a315a03-c737-4a82-ae52-c9a6ce827007","expires_in":1699490747,"scope":"SCOPE","shop_id":68032645,"shop_name":"美好菜市","refresh_token":"8334c006-5301-4d25-911b-4d8cc7b70ebb","authority_id":""}` //var token1 = `{"access_token":"9a315a03-c737-4a82-ae52-c9a6ce827007","expires_in":1699490747,"scope":"SCOPE","shop_id":68032645,"shop_name":"美好菜市","refresh_token":"8334c006-5301-4d25-911b-4d8cc7b70ebb","authority_id":""}`

View File

@@ -8,7 +8,7 @@ import (
) )
func TestBillDetail(t *testing.T) { func TestBillDetail(t *testing.T) {
orderDetail, err := a.GetTiktokOrderDetail("6923379475577116595") orderDetail, err := a.GetTiktokOrderDetail("6923675806562457471")
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }

View File

@@ -16,7 +16,7 @@ func TestGetDispatcherInfo(t *testing.T) {
} }
func TestCancelWaybill(t *testing.T) { func TestCancelWaybill(t *testing.T) {
err := a.ShopOrderDispatcher(103926218, "6923441722750145796", DispatcherFeeTypeCancel) err := a.ShopOrderDispatcher(64251630, "6923758679166948853", DispatcherFeeTypeCancel)
fmt.Println(err) fmt.Println(err)
} }