diff --git a/platformapi/tiktok_shop/sdk-golang/api/warehouse_getWarehouseByStore/response/warehouse_getWarehouseByStore_response.go b/platformapi/tiktok_shop/sdk-golang/api/warehouse_getWarehouseByStore/response/warehouse_getWarehouseByStore_response.go index f71fcd34..9be27ab3 100644 --- a/platformapi/tiktok_shop/sdk-golang/api/warehouse_getWarehouseByStore/response/warehouse_getWarehouseByStore_response.go +++ b/platformapi/tiktok_shop/sdk-golang/api/warehouse_getWarehouseByStore/response/warehouse_getWarehouseByStore_response.go @@ -37,5 +37,5 @@ type WarehouseInfoMapItem struct { } type WarehouseGetWarehouseByStoreData struct { // 仓信息map - WarehouseInfoMap map[string]WarehouseInfoMapItem `json:"warehouse_info_map"` + WarehouseInfoMap map[string][]*WarehouseInfoMapItem `json:"warehouse_info_map"` } diff --git a/platformapi/tiktok_shop/tiktok_api/afs_test.go b/platformapi/tiktok_shop/tiktok_api/afs_test.go index d5c0e1f6..3eda358f 100644 --- a/platformapi/tiktok_shop/tiktok_api/afs_test.go +++ b/platformapi/tiktok_shop/tiktok_api/afs_test.go @@ -1,11 +1,11 @@ package tiktok_api import ( + "crypto/md5" "fmt" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/globals" "testing" - "time" ) var token = `{"access_token":"2baa1126-bba0-4510-8ffa-6af55ba0bdbd","expires_in":1670828768,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"23b3eb4e-bb00-4b85-952d-de47801de80d","authority_id":""}` @@ -30,5 +30,12 @@ func TestGetSkuDetailLocalID(t *testing.T) { // func TestName(t *testing.T) { - fmt.Println(time.Now().Day()) + body := `[{ + "tag": "101", + "msg_id": "69793528590852580050:0:101:1670233754:1024588978:7136048270014416392", + "data": "{\"biz\":2,\"order_status\":2,\"order_type\":0,\"p_id\":5008525809582539796,\"pay_amount\":2640,\"pay_time\":1670233752,\"pay_type\":1,\"s_ids\":[5008525809582539796],\"shop_id\":57939570}" +}]` + signParam := a.appKey + body + a.appSecret + sign := fmt.Sprintf("%X", md5.Sum([]byte(signParam))) + fmt.Println(sign) } diff --git a/platformapi/tiktok_shop/tiktok_api/api_test.go b/platformapi/tiktok_shop/tiktok_api/api_test.go index 8f558da9..8361167c 100644 --- a/platformapi/tiktok_shop/tiktok_api/api_test.go +++ b/platformapi/tiktok_shop/tiktok_api/api_test.go @@ -21,7 +21,7 @@ func TestApi(t *testing.T) { } func TestQueryOrderDetail(t *testing.T) { - data, err := a.GetTiktokOrderDetail("4996895368866964710") + data, err := a.GetTiktokOrderDetail("5008526050099613284") globals.SugarLogger.Debugf("=====%s", utils.Format4Output(data, false)) globals.SugarLogger.Debugf("=====%s", err) } diff --git a/platformapi/tiktok_shop/tiktok_api/store_test.go b/platformapi/tiktok_shop/tiktok_api/store_test.go index e26bca0b..bd4a6c1c 100644 --- a/platformapi/tiktok_shop/tiktok_api/store_test.go +++ b/platformapi/tiktok_shop/tiktok_api/store_test.go @@ -9,7 +9,6 @@ import ( shop_batchCreateStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_batchCreateStore/request" shop_bindStoreSaleLimit_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_bindStoreSaleLimit/request" shop_editStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_editStore/request" - shop_getStoreDetail_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_getStoreDetail/request" shop_getStoreList_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_getStoreList/request" shop_storeSuspend_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_storeSuspend/request" shop_unsuspendStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_unsuspendStore/request" @@ -57,21 +56,6 @@ func TestCreateStore(t *testing.T) { fmt.Println("err==", err) } -//单个获取门店详情 -func TestGetStoreDetail(t *testing.T) { - accesstoken := `{"access_token":"8de708c3-f2d1-4b45-bc56-31f704ca0f1e","expires_in":1670227126,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"86ef17a7-7964-4f57-ae2d-4f8bcbfff97e","authority_id":""}` - a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", accesstoken) - data, err := a.GetStoreDetail(&shop_getStoreDetail_request.ShopGetStoreDetailParam{ - //StoreId: 76879546, - StoreId: "76879546", - IsNeedRelShopUser: false, - IsNeedPoiAuditInfo: false, - IsNeedChargeInfo: false, - }) - fmt.Println("data==========", utils.Format4Output(data, false)) - fmt.Println(err) -} - //门店列表分页查询 func TestGetStoreList(t *testing.T) { data, err := a.GetStoreList(&shop_getStoreList_request.ShopGetStoreListParam{ @@ -249,7 +233,7 @@ func TestUpdateStore(t *testing.T) { fmt.Println(err) } -//获取门店绑定仓库以及电子围栏 +//获取门店绑定仓库 func TestGetWarehouseByStore(t *testing.T) { resp, err := a.GetWarehouseByStore(63520016) fmt.Println(resp) diff --git a/platformapi/weixinapi/sns.go b/platformapi/weixinapi/sns.go index 09c4ba45..dd69fb92 100644 --- a/platformapi/weixinapi/sns.go +++ b/platformapi/weixinapi/sns.go @@ -172,20 +172,24 @@ func (a *API) SNSGetUserPhone(jsCode string) (string, error) { // 获取小程序短连接CBRetrieveToken func (a *API) MiniProgramSortLink() (string, error) { weChatToken := "" - if token := a.CBGetToken(); token == "" { + token := a.CBGetToken() + if token == "" { newToken, err := a.CBRetrieveToken() if err != nil { return "", err } weChatToken = newToken.AccessToken + } else { + weChatToken = token } parmaJson := map[string]interface{}{ "access_token": weChatToken, } bodyJson := map[string]interface{}{ - "access_token ": weChatToken, - "expire_type ": 0, + //"access_token ": weChatToken, + "expire_type ": 1, + "expire_time": 1, } body, _ := json.Marshal(bodyJson) result, err := a.AccessAPI("wxa/generate_urllink", parmaJson, string(body)) diff --git a/platformapi/weixinapi/weixinapi.go b/platformapi/weixinapi/weixinapi.go index ea559cae..568602fe 100644 --- a/platformapi/weixinapi/weixinapi.go +++ b/platformapi/weixinapi/weixinapi.go @@ -73,7 +73,7 @@ func isSNSAction(action string) bool { } func (a *API) AccessAPI(action string, params map[string]interface{}, body string) (retVal map[string]interface{}, err error) { - if params != nil && body != "" { + if params == nil && body == "" { panic("params and body can not all be empty") } params2 := make(map[string]interface{})