From c741ad227aa17f16f9b871fdb428d1db85cfb298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 19 Oct 2020 15:51:41 +0800 Subject: [PATCH] sns user --- platformapi/jdapi/jdapi_test.go | 2 +- platformapi/jdapi/sku_test.go | 36 +++++++++++++------ platformapi/jdshopapi/order_test.go | 2 +- platformapi/weixinapi/sns.go | 3 +- platformapi/yilianyunapi/yilianyunapi_test.go | 10 +++--- 5 files changed, 35 insertions(+), 18 deletions(-) diff --git a/platformapi/jdapi/jdapi_test.go b/platformapi/jdapi/jdapi_test.go index fa2c481f..00553a30 100644 --- a/platformapi/jdapi/jdapi_test.go +++ b/platformapi/jdapi/jdapi_test.go @@ -28,7 +28,7 @@ func init() { // api = New("c45e6510-00ba-4be2-977e-bcb9c9792cc7", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26") //prod zs - api = New("5e2c0a60-4450-40c0-a1da-b560051251ea", "21b627c23ea04c69b64b48d0b361213e", "51cd27a748e64c829b4b7f83f4844610") + api = New("6f8d3290-0120-4ad7-8b53-943c67c84f3f", "789279b9ae814ba091ac52815566b54d", "5d668cd227644637bb0fd73ed8118ec8") // const cookieValue = "YYJV3NHVBPHLD36FWP6F3EM5PTXJ2XZQS7U4HWRIDPP4IWGUKUIB4XG5N26CZRDLDF7PKOXBPD6BNTUAJLETLZOIWMCVFI3K6MYZIY4QBIXIMXYDJNUKFGJVQTN5356SAD6WPCIHWNQAG7DDMF7L7S3SHCT3RM3CQG7IJIPUQ3THS5UIUYWMKINM7ETUOQB7OBPOPZVCT3ZJY55243TDVXLO25PP4UYSPTTPMNQ7HPMWOJKJ3BJWGVHD243MXH7NZWW264TKN5UOCJBSSSOKD2QQII" const cookieValue = "OPJQMA7B3FTKCAUGO7FHCH5NMBGAWGGXYRNLEHYYZNGNPNIBCAM4IOEPG3NT3RIA44G5C3535Q5LGG4F4SR4AZVLGYKYTKFJJKEAOXENVBL5VXNILRP3GLNVVWA26XZ3VGSYOHA72RICMVZS3G53DTEH3J7VMEGG2RGQEK6VMGIWEIL3X66ZYUZZOKKUUBKAWCWZPLF745R6MSYFJJ6EXUPLU4UGKXFQWEBUCQAMIOV7EVR4JGDPUMIPCVZVKBP5XQU32N7XTB6LGOP5RZQCH7DRHM" api.SetJdCookie(cookieValue) diff --git a/platformapi/jdapi/sku_test.go b/platformapi/jdapi/sku_test.go index 9db4c55e..8cace522 100644 --- a/platformapi/jdapi/sku_test.go +++ b/platformapi/jdapi/sku_test.go @@ -1,6 +1,7 @@ package jdapi import ( + "fmt" "testing" "git.rosy.net.cn/baseapi" @@ -41,16 +42,8 @@ func TestQueryChildCategoriesForOP(t *testing.T) { func TestBatchUpdateOutSkuId(t *testing.T) { result, err := api.BatchUpdateOutSkuId([]*SkuIDPair{ &SkuIDPair{ - SkuId: 2012286956, - OutSkuId: "2", - }, - &SkuIDPair{ - SkuId: 2029317908, - OutSkuId: "34523", - }, - &SkuIDPair{ - SkuId: 2012286957, - OutSkuId: "3", + SkuId: 2037664182, + OutSkuId: "", }, }) baseapi.SugarLogger.Debug(utils.Format4Output(result, false), err) @@ -260,3 +253,26 @@ func TestUpdateShopCategory(t *testing.T) { t.Fatal(err) } } + +func TestQueren(t *testing.T) { + for i := 1; i < 85; i++ { + result, _, _ := api.QuerySkuInfos(&QuerySkuParam{ + PageNo: i, + }) + fmt.Println(i) + for _, v := range result { + api.UpdateSku2(&OpSkuParam{ + TraceID: utils.GetUUID(), + OutSkuID: v.OutSkuID, + }) + } + } + + // result, _, err := api.QuerySkuInfos(&QuerySkuParam{ + // PageNo: 1, + // }) + // if err != nil { + // t.Fatal(err) + // } + // t.Log(utils.Format4Output(result, false)) +} diff --git a/platformapi/jdshopapi/order_test.go b/platformapi/jdshopapi/order_test.go index db795da3..465a6793 100644 --- a/platformapi/jdshopapi/order_test.go +++ b/platformapi/jdshopapi/order_test.go @@ -44,7 +44,7 @@ func TestKeyGet(t *testing.T) { } func TestGetOrderExtInfoByOrderId(t *testing.T) { - result, err := api.GetOrderExtInfoByOrderId("127152338712") + result, err := api.GetOrderExtInfoByOrderId("132558137476") if err != nil { t.Fatal(err) } diff --git a/platformapi/weixinapi/sns.go b/platformapi/weixinapi/sns.go index fe602a8d..02c45687 100644 --- a/platformapi/weixinapi/sns.go +++ b/platformapi/weixinapi/sns.go @@ -62,7 +62,8 @@ func mapData2SNSToken(result map[string]interface{}) *SNSTokenInfo { } func (a *API) SNSRetrieveToken(code string) (tokenInfo *SNSTokenInfo, err error) { - result, err := a.AccessAPI("sns/oauth2/access_token", utils.Params2Map("grant_type", "authorization_code", "code", code), "") + //"grant_type", "authorization_code", + result, err := a.AccessAPI("sns/oauth2/access_token", utils.Params2Map("code", code), "") if err != nil { return nil, err } diff --git a/platformapi/yilianyunapi/yilianyunapi_test.go b/platformapi/yilianyunapi/yilianyunapi_test.go index a046b83e..4e14246e 100644 --- a/platformapi/yilianyunapi/yilianyunapi_test.go +++ b/platformapi/yilianyunapi/yilianyunapi_test.go @@ -20,11 +20,11 @@ func init() { baseapi.Init(sugarLogger) // 自有应用 - api = New("1039586024", "4885d07c2997b661102e4b6099c0bf3b") - api.SetToken("852dd259dc244c579e2a987857932606") + // api = New("1039586024", "4885d07c2997b661102e4b6099c0bf3b") + // api.SetToken("07e5895c70114395a285ae20119d83b1") // 开放应用 - // api = New("1098307169", "d5eedb40c99e6691b1ca2ba82a363d6a") + api = New("1098307169", "d5eedb40c99e6691b1ca2ba82a363d6a") } func handleError(t *testing.T, err error) { @@ -65,13 +65,13 @@ func TestPrintMsgWithToken(t *testing.T) { } func TestGetPrintStatus(t *testing.T) { - state, err := api.GetPrintStatus("4004615546") + state, err := api.GetPrintStatus("4004653390") handleError(t, err) baseapi.SugarLogger.Debug(state) } func TestGetPrintStatusWithToken(t *testing.T) { - state, err := api.GetPrintStatusWithToken("4004617242", "88de89a384714436a5d1ca23e8991e15") + state, err := api.GetPrintStatusWithToken("4004653390", "07e5895c70114395a285ae20119d83b1") handleError(t, err) baseapi.SugarLogger.Debug(state) }