From 951978b0311a116e86a4156011b7e1744a4a3c9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 27 Jul 2023 09:10:14 +0800 Subject: [PATCH 01/21] 1 --- platformapi/mtwmapi/mtwmapi_test.go | 5 ++--- platformapi/mtwmapi/poi_test.go | 6 +++--- platformapi/tiktok_shop/tiktok_api/afs_test.go | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/platformapi/mtwmapi/mtwmapi_test.go b/platformapi/mtwmapi/mtwmapi_test.go index a5c81126..3b5a8c07 100644 --- a/platformapi/mtwmapi/mtwmapi_test.go +++ b/platformapi/mtwmapi/mtwmapi_test.go @@ -20,11 +20,10 @@ func init() { baseapi.Init(sugarLogger) // 菜市 - api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "") + //api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "") // 果园 - // api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "") - //api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "") + api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "") //商超 // api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_ovSLnyKTsMNx0RxMzJ1C7w") //token_n4TwqCntWWuvQwAawzxC0w diff --git a/platformapi/mtwmapi/poi_test.go b/platformapi/mtwmapi/poi_test.go index 7bf042b5..bc48bd3e 100644 --- a/platformapi/mtwmapi/poi_test.go +++ b/platformapi/mtwmapi/poi_test.go @@ -24,7 +24,7 @@ func TestPoiGetIDs(t *testing.T) { } func TestPoiMGet(t *testing.T) { - result, err := api.PoiMGet([]string{"8040306"}) + result, err := api.PoiMGet([]string{"15467875"}) t.Log(utils.Format4Output(result, false)) if err != nil { t.Fatal(err) @@ -44,10 +44,10 @@ func TestPoiSave(t *testing.T) { //} poiParams := map[string]interface{}{} //utils.FilterMapNilMembers(utils.Struct2FlatMap(result[0])) - poiParams["address"] = "四川省成都市龙泉驿区大面街道青台山路753号" + poiParams["address"] = "云南省楚雄彝族自治州楚雄市东瓜镇高新区永安路1号四季银座花园城6栋6-4" //poiParams["pic_url"] = "http://image.jxc4.com/image/5c9fc4fffb4d5ff1aecf85a2d2543e00.jpg" //poiParams["name"] = "京西菜市(礼嘉桥村市场店)" - err := api.PoiSave("3508345", poiParams) + err := api.PoiSave("15467875", poiParams) fmt.Println(err) } diff --git a/platformapi/tiktok_shop/tiktok_api/afs_test.go b/platformapi/tiktok_shop/tiktok_api/afs_test.go index daf688d3..2d78dc3e 100644 --- a/platformapi/tiktok_shop/tiktok_api/afs_test.go +++ b/platformapi/tiktok_shop/tiktok_api/afs_test.go @@ -18,7 +18,7 @@ import ( // "authority_id": "" //}` -var token = `{"access_token":"6045a7f5-622e-4126-b555-46a4da29e80a","expires_in":1690341662,"scope":"SCOPE","shop_id":68023619,"shop_name":"京西到家","refresh_token":"6092b5c5-af6e-4481-92e1-545632c58247","authority_id":""}` +var token = `{"access_token":"387f10da-bb2f-4416-9323-697574efc8b1","expires_in":1690696461,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"65d99337-6e0e-47fb-80af-f90929ceea64","authority_id":""}` //var token = `{"access_token":"e3173e9f-266f-4d87-88e7-e7cd837bc9d9","expires_in":1672882632,"scope":"SCOPE","shop_id":68023619,"shop_name":"京西到家","refresh_token":"5070aae2-493f-46bd-b5d6-6ea0cd64729f","authority_id":""}` From 78887ca68a39589871afee625fecba6be68e4777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 28 Jul 2023 20:09:57 +0800 Subject: [PATCH 02/21] 1 --- platformapi/jdapi/order.go | 9 +++++++++ platformapi/tao_vegetable/order_test.go | 10 ++++++++++ platformapi/tao_vegetable/store_sku_test.go | 7 +++++-- platformapi/tao_vegetable/store_test.go | 13 ++++++++++--- platformapi/tiktok_shop/tiktok_api/afs_test.go | 13 ------------- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/platformapi/jdapi/order.go b/platformapi/jdapi/order.go index c167885a..080c0361 100644 --- a/platformapi/jdapi/order.go +++ b/platformapi/jdapi/order.go @@ -2,6 +2,7 @@ package jdapi import ( "errors" + "git.rosy.net.cn/jx-callback/globals" "strings" "git.rosy.net.cn/baseapi" @@ -452,6 +453,14 @@ func (a *API) OrderAcceptOperate(orderId string, isAgreed bool, userName string) "operator": utils.GetAPIOperator(userName), } _, err := a.AccessAPINoPage("ocs/orderAcceptOperate", jdParams, nil, nil, orderOperationResultParser) + if err != nil { + printParam := map[string]interface{}{ + "orderId": utils.Str2Int64(orderId), + } + result, err := a.AccessAPINoPage("bm/open/api/order/printOrder", printParam, nil, nil, nil) + globals.SugarLogger.Debugf("============result := %s", utils.Format4Output(result, false)) + globals.SugarLogger.Debugf("============result := %s", utils.Format4Output(err, false)) + } return err } diff --git a/platformapi/tao_vegetable/order_test.go b/platformapi/tao_vegetable/order_test.go index ae3e3c08..3fde13e5 100644 --- a/platformapi/tao_vegetable/order_test.go +++ b/platformapi/tao_vegetable/order_test.go @@ -11,6 +11,7 @@ import ( "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/globals" "strconv" + "strings" "testing" "time" ) @@ -224,3 +225,12 @@ func TestQueryBillList(t *testing.T) { globals.SugarLogger.Debugf("data:= %s", utils.Format4Output(data, false)) } + +func TestName2(t *testing.T) { + emoji := `【右上角关注点亮⭐️】` + a := replaceContentOther(emoji) + fmt.Println(a) +} +func replaceContentOther(content string) string { + return strings.ReplaceAll(strings.ReplaceAll(content, "⃣️", " "), "•", "-") +} diff --git a/platformapi/tao_vegetable/store_sku_test.go b/platformapi/tao_vegetable/store_sku_test.go index 5aeb7bef..d889d197 100644 --- a/platformapi/tao_vegetable/store_sku_test.go +++ b/platformapi/tao_vegetable/store_sku_test.go @@ -169,8 +169,8 @@ func TestStoreSkuStock(t *testing.T) { func TestGetSkuDetaul(t *testing.T) { result, err := apiTao.QueryStoreSKu(&request585.AlibabaWdkSkuQueryRequest{Param: &domain585.AlibabaWdkSkuQuerySkuQueryDo{ - SkuCodes: &[]string{"84671"}, - OuCode: utils.String2Pointer("JX668998"), + SkuCodes: &[]string{"39083"}, + OuCode: utils.String2Pointer("JX666678"), }}) globals.SugarLogger.Debugf("err := %s ", utils.Format4Output(err, false)) globals.SugarLogger.Debugf("result := %s ", utils.Format4Output(result, false)) @@ -189,6 +189,9 @@ func uploadImg(api *API, imgs []string) *string { continue } body, _ := ioutil.ReadAll(resp.Body) + if strings.Contains(string(body), "Document not found") { + continue + } if newImg, _ := api.UploadImg(&request1475.AlibabaWdkPictureUploadRequest{ PictureCategoryId: utils.Int64ToPointer(0), Img: &body, diff --git a/platformapi/tao_vegetable/store_test.go b/platformapi/tao_vegetable/store_test.go index 9afbb871..d2c17e21 100644 --- a/platformapi/tao_vegetable/store_test.go +++ b/platformapi/tao_vegetable/store_test.go @@ -46,9 +46,16 @@ func TestGetStoreCategory(t *testing.T) { } func TestGetStoreAllCategory(t *testing.T) { - data, err := apiTao.GetStoreAllCategory() - globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data, false)) - globals.SugarLogger.Debugf("err := %s", utils.Format4Output(err, false)) + data, _ := apiTao.GetStoreAllCategory() + for _, v := range data { + if v.ChildCategorys != nil { + for _, v2 := range v.ChildCategorys { + globals.SugarLogger.Debugf("%s", utils.Format4Output(v2, false)) + } + } + + } + } func TestAddCategory(t *testing.T) { diff --git a/platformapi/tiktok_shop/tiktok_api/afs_test.go b/platformapi/tiktok_shop/tiktok_api/afs_test.go index 2d78dc3e..173978e9 100644 --- a/platformapi/tiktok_shop/tiktok_api/afs_test.go +++ b/platformapi/tiktok_shop/tiktok_api/afs_test.go @@ -1,7 +1,6 @@ package tiktok_api import ( - "crypto/md5" "fmt" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/globals" @@ -40,15 +39,3 @@ func TestGetSkuDetailLocalID(t *testing.T) { globals.SugarLogger.Debugf("data=%s", utils.Format4Output(data, false)) globals.SugarLogger.Debugf("data=%s", err) } - -// -func TestName(t *testing.T) { - 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) -} From 7b4929bd021bc256dba3d0572cfa45de1dcb2fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sat, 29 Jul 2023 19:42:16 +0800 Subject: [PATCH 03/21] 1 --- platformapi/jdapi/jdapi_test.go | 6 +- platformapi/jdapi/order.go | 15 ++- platformapi/jdapi/order_test.go | 2 +- platformapi/tao_vegetable/order_test.go | 4 +- .../sdk/ability3156/Ability3156.go | 1 - platformapi/tao_vegetable/store_test.go | 123 ++++++++++++++++++ 6 files changed, 137 insertions(+), 14 deletions(-) diff --git a/platformapi/jdapi/jdapi_test.go b/platformapi/jdapi/jdapi_test.go index 42fa10ff..6e49e965 100644 --- a/platformapi/jdapi/jdapi_test.go +++ b/platformapi/jdapi/jdapi_test.go @@ -28,10 +28,10 @@ func init() { // api = New("73e2e9f6-b21e-4dcd-8c92-71e4e100b07e", "1dba76d40cac446ca500c0391a0b6c9d", "a88d031a1e7b462cb1579f12e97fe7f4") // 天天果园 //api = New("c45e6510-00ba-4be2-977e-bcb9c9792cc7", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26") - // 京东果园 - //api = New("b1138139-9610-4b80-9a63-a63da4773885", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26") + // 京东果园 320406 + api = New("c454ef86-2213-4860-9a31-f2ef7e883386", "1dba76d40cac446ca500c0391a0b6c9d", "a88d031a1e7b462cb1579f12e97fe7f4") // 果切 - api = New("3ef42248-1247-4efa-8624-43cd3a3b97ae", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26") + //api = New("3ef42248-1247-4efa-8624-43cd3a3b97ae", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26") // 京东超市 381564 // api = New("f99d25b8-33a6-4251-a97c-5e24b80b0005", "d2d1e2e3213d4320bc2712a684307831", "1750f5b9848d4a6492c1c20b487074da") diff --git a/platformapi/jdapi/order.go b/platformapi/jdapi/order.go index 080c0361..3a462c68 100644 --- a/platformapi/jdapi/order.go +++ b/platformapi/jdapi/order.go @@ -452,14 +452,15 @@ func (a *API) OrderAcceptOperate(orderId string, isAgreed bool, userName string) "isAgreed": utils.Bool2String(isAgreed), "operator": utils.GetAPIOperator(userName), } + + // 接单 _, err := a.AccessAPINoPage("ocs/orderAcceptOperate", jdParams, nil, nil, orderOperationResultParser) - if err != nil { - printParam := map[string]interface{}{ - "orderId": utils.Str2Int64(orderId), - } - result, err := a.AccessAPINoPage("bm/open/api/order/printOrder", printParam, nil, nil, nil) - globals.SugarLogger.Debugf("============result := %s", utils.Format4Output(result, false)) - globals.SugarLogger.Debugf("============result := %s", utils.Format4Output(err, false)) + // 打印 + printResult, err2 := a.AccessAPINoPage("bm/open/api/order/printOrder", map[string]interface{}{ + "orderId": utils.Str2Int64(orderId), + }, nil, nil, nil) + if err2 != nil { + globals.SugarLogger.Debugf("打印订单错误: %s,%v", utils.Format4Output(printResult, false), err2) } return err } diff --git a/platformapi/jdapi/order_test.go b/platformapi/jdapi/order_test.go index 9c1ac3fb..a08dba63 100644 --- a/platformapi/jdapi/order_test.go +++ b/platformapi/jdapi/order_test.go @@ -54,7 +54,7 @@ func TestOrderQuery(t *testing.T) { } func TestOrderAcceptOperate(t *testing.T) { - err := api.OrderAcceptOperate("813344594000041", true, "") + err := api.OrderAcceptOperate("2318125162000391", true, "") if err != nil { t.Fatal(err.Error()) } diff --git a/platformapi/tao_vegetable/order_test.go b/platformapi/tao_vegetable/order_test.go index 3fde13e5..dc0985b3 100644 --- a/platformapi/tao_vegetable/order_test.go +++ b/platformapi/tao_vegetable/order_test.go @@ -60,8 +60,8 @@ func TestQueryAfsOrderDetail(t *testing.T) { func TestDeliveryFinishACCEPTED(t *testing.T) { param := &request591.AlibabaAelophyOrderWorkCallbackRequest{} param.WorkCallbackRequest = &domain591.AlibabaAelophyOrderWorkCallbackWorkCallbackRequest{ - StoreId: utils.String2Pointer("JX668594"), - BizOrderId: utils.Int64ToPointer(5000900574962430922), + StoreId: utils.String2Pointer("JX667321"), + BizOrderId: utils.Int64ToPointer(5000909465906250087), Status: utils.String2Pointer("SIGN"), StatusRemark: nil, DelivererName: utils.String2Pointer("张廷"), diff --git a/platformapi/tao_vegetable/sdk/ability3156/Ability3156.go b/platformapi/tao_vegetable/sdk/ability3156/Ability3156.go index 7596f0de..5b51b44a 100644 --- a/platformapi/tao_vegetable/sdk/ability3156/Ability3156.go +++ b/platformapi/tao_vegetable/sdk/ability3156/Ability3156.go @@ -116,7 +116,6 @@ func (ability *Ability3156) AlibabaAelophyShopUpdatestatus(req *request2.Alibaba if respStruct.Body == "" || len(respStruct.Body) == 0 { respStruct.Body = jsonStr } - globals.SugarLogger.Debugf("ShopUpdatestatus respStruct=%s", utils.Format4Output(&respStruct, false)) return &respStruct, err } diff --git a/platformapi/tao_vegetable/store_test.go b/platformapi/tao_vegetable/store_test.go index d2c17e21..5edd6205 100644 --- a/platformapi/tao_vegetable/store_test.go +++ b/platformapi/tao_vegetable/store_test.go @@ -122,3 +122,126 @@ func TestShopUpdateRange(t *testing.T) { err := apiTao.ShopUpdateRange("JX668998", points) fmt.Println(err) } + +func TestUpdateStoreTest(t *testing.T) { + aa := []string{ + "JX668691", + "JX668282", + "JX667447", + "JX667354", + "JX667319", + "JX667316", + "JX669158", + "JX667269", + "JX667267", + "JX667260", + "JX667132", + "JX667030", + "JX666965", + "JX666714", + "JX666708", + "JX666705", + "JX103437", + "JX103349", + "JX103123", + "JX103121", + "JX103106", + "JX103038", + "JX103028", + "JX103019", + "JX102831", + "JX102751", + "JX102683", + "JX102542", + "JX102514", + "JX102382", + "JX102182", + "JX102178", + "JX102173", + "JX102098", + "JX102094", + "JX102080", + "JX102072", + "JX102069", + "JX101870", + "JX101869", + "JX101868", + "JX101867", + "JX101866", + "JX101865", + "JX100956", + "JX100930", + "JX100871", + "JX100786", + "JX100746", + "JX100744", + "JX100726", + "JX100705", + "JX100400", + "JX100111", + "JX100108", + "JX100104", + "JX100103", + "JX100102", + "JX100100", + "JX100097", + "JX100096", + "JX100095", + "JX100093", + "JX100089", + "JX100087", + "JX100086", + "JX100085", + "JX100082", + "JX100079", + "JX100078", + "JX668673", + "JX667321", + "JX667268", + "JX667094", + //669158, + //667321, + //667094, + //668906, + //668886, + //668880, + //668751, + //668701, + //668569, + //668567, + //668506, + //667231, + //667068, + //103191, + //103051, + //103050, + //103037, + //103018, + //102951, + //102924, + //102920, + //102908, + //102561, + //100946, + //100720, + //100325, + //100324, + //100296, + //100290, + } + for _, v := range aa { + //err := apiTao.ShopUpdateStatus(fmt.Sprintf("jx%d", v), -1) + //fmt.Println(err) + err := apiTao.ShopUpdateStatus(v, -1) + if err != nil { + fmt.Println(err) + } + } +} + +func TestDelete(t *testing.T) { + err := apiTao.ShopUpdateStatus("JX668594", -1) + if err != nil { + fmt.Println(err) + } +} From 6b8c1210891b3f2dd351148eee7b6a0356e01c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sun, 30 Jul 2023 20:03:39 +0800 Subject: [PATCH 04/21] 1 --- platformapi/jdapi/order_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/platformapi/jdapi/order_test.go b/platformapi/jdapi/order_test.go index a08dba63..e4f34d89 100644 --- a/platformapi/jdapi/order_test.go +++ b/platformapi/jdapi/order_test.go @@ -54,12 +54,18 @@ func TestOrderQuery(t *testing.T) { } func TestOrderAcceptOperate(t *testing.T) { - err := api.OrderAcceptOperate("2318125162000391", true, "") + err := api.OrderAcceptOperate("2318183905000222", true, "") if err != nil { t.Fatal(err.Error()) } } +func TestMyself(t *testing.T) { + detail, errr := api.OrderJDZBStoreDelivery("2318183905000222", "liulei") + fmt.Println(detail) + fmt.Println(errr) +} + func TestOrderJDZBDelivery(t *testing.T) { result, err := api.OrderJDZBDelivery("911350836000622", "") if err != nil { @@ -69,7 +75,7 @@ func TestOrderJDZBDelivery(t *testing.T) { } func TestModifySellerDelivery(t *testing.T) { - result, err := api.ModifySellerDelivery("914376668000422", "") + result, err := api.ModifySellerDelivery("2318183905000222", "") if err != nil { t.Fatal(err.Error()) } @@ -132,7 +138,7 @@ func TestOrderQuery2(t *testing.T) { // PageSize: 99999, //}) orderList, _, err := api.OrderQuery2(&OrderQueryParam{ - OrderID: 2304566038000691, + OrderID: 2318183905000222, }) t.Log(utils.Format4Output(orderList, false)) if err != nil { From d856a1ffdc40290d3104c0131c504947cbfb0d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 31 Jul 2023 10:29:09 +0800 Subject: [PATCH 05/21] 1 --- platformapi/tao_vegetable/order_test.go | 4 ++-- platformapi/tao_vegetable/store_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platformapi/tao_vegetable/order_test.go b/platformapi/tao_vegetable/order_test.go index dc0985b3..a3143588 100644 --- a/platformapi/tao_vegetable/order_test.go +++ b/platformapi/tao_vegetable/order_test.go @@ -47,8 +47,8 @@ func TestQueryAfsOrderDetail(t *testing.T) { param := &request591.AlibabaWdkOrderRefundGetRequest{ OrderFrom: utils.Int64ToPointer(31), ShopId: nil, - StoreId: utils.String2Pointer("JX102751"), - RefundIds: &[]int64{1315405271}, + StoreId: utils.String2Pointer("JX100705"), + RefundIds: &[]int64{1313780273}, } data, err := apiTao.QueryAfsOrderDetail(param) globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data, false)) diff --git a/platformapi/tao_vegetable/store_test.go b/platformapi/tao_vegetable/store_test.go index 5edd6205..19a30a4f 100644 --- a/platformapi/tao_vegetable/store_test.go +++ b/platformapi/tao_vegetable/store_test.go @@ -240,7 +240,7 @@ func TestUpdateStoreTest(t *testing.T) { } func TestDelete(t *testing.T) { - err := apiTao.ShopUpdateStatus("JX668594", -1) + err := apiTao.ShopUpdateStatus("JX668594", 1) if err != nil { fmt.Println(err) } From 74e5825b73911c758949a6a64ac4cb80935c1e35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 31 Jul 2023 16:52:31 +0800 Subject: [PATCH 06/21] 1 --- platformapi/mtwmapi/mtwmapi_test.go | 8 ++++++-- platformapi/tao_vegetable/order_afs.go | 4 ++-- platformapi/tao_vegetable/order_test.go | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/platformapi/mtwmapi/mtwmapi_test.go b/platformapi/mtwmapi/mtwmapi_test.go index 3b5a8c07..f49d8fcc 100644 --- a/platformapi/mtwmapi/mtwmapi_test.go +++ b/platformapi/mtwmapi/mtwmapi_test.go @@ -20,10 +20,10 @@ func init() { baseapi.Init(sugarLogger) // 菜市 - //api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "") + api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "") // 果园 - api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "") + //api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "") //商超 // api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_ovSLnyKTsMNx0RxMzJ1C7w") //token_n4TwqCntWWuvQwAawzxC0w @@ -50,6 +50,10 @@ func TestGetOAuthCode(t *testing.T) { t.Log(utils.Format4Output(result, false)) } +func TestPreparationMealComplete(t *testing.T) { + api.PreparationMealComplete(1100657633926494664) +} + func TestGetAccessToken(t *testing.T) { result, err := api.GetAccessToken("code_ra0oUBjsRwRf0f5m0wJB9g") if err != nil { diff --git a/platformapi/tao_vegetable/order_afs.go b/platformapi/tao_vegetable/order_afs.go index bb3c5905..8845ee31 100644 --- a/platformapi/tao_vegetable/order_afs.go +++ b/platformapi/tao_vegetable/order_afs.go @@ -238,7 +238,7 @@ func (a *API) GetTransactionOrderList(req *request591.AlibabaWdkOrderListRequest // QueryBillList 获取账单信息 func (a *API) QueryBillList(req *request591.AlibabaWdkBillListRequest) (*domain591.AlibabaWdkBillListTxdBillListGetResult, error) { - //globals.SugarLogger.Debugf("进入 QueryBillList") + globals.SugarLogger.Debugf("进入 QueryBillList : %s", utils.Format4Output(req, false)) client := ability591.NewAbility591(&a.client) data, _ := client.AlibabaWdkBillList(req, a.token) @@ -251,6 +251,6 @@ func (a *API) QueryBillList(req *request591.AlibabaWdkBillListRequest) (*domain5 for _, v := range *kk.TxdBillDetailBOS { globals.SugarLogger.Debugf("kk := %s -- %s == %s", utils.Format4Output(v.BizOrderId, false), *v.OrderType, *v.ReceivableAmount) } - + globals.SugarLogger.Debugf("进入 data.ApiResult.Model : %s", utils.Format4Output(data.ApiResult.Model, false)) return data.ApiResult.Model, nil } diff --git a/platformapi/tao_vegetable/order_test.go b/platformapi/tao_vegetable/order_test.go index a3143588..613e28eb 100644 --- a/platformapi/tao_vegetable/order_test.go +++ b/platformapi/tao_vegetable/order_test.go @@ -22,8 +22,8 @@ func TestName(t *testing.T) { } func TestGetOrderDetail(t *testing.T) { requestParam := &request591.AlibabaAelophyOrderGetRequest{OrderGetRequest: &domain591.AlibabaAelophyOrderGetOrderGetRequest{ - StoreId: utils.String2Pointer("JX102751"), - BizOrderId: utils.Int64ToPointer(5000908068888360754), + StoreId: utils.String2Pointer("JX666708"), + BizOrderId: utils.Int64ToPointer(5000910858776180489), }} data, err := apiTao.QueryOrderDetail(requestParam) globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data, false)) From 6fb12ba0104df50f7e4013e50bbbca3e552564af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 1 Aug 2023 09:43:18 +0800 Subject: [PATCH 07/21] 1 --- platformapi/tao_vegetable/order_test.go | 2 +- platformapi/tao_vegetable/store_sku_test.go | 151 ++++++++++++++++++-- 2 files changed, 142 insertions(+), 11 deletions(-) diff --git a/platformapi/tao_vegetable/order_test.go b/platformapi/tao_vegetable/order_test.go index 613e28eb..6bfc557d 100644 --- a/platformapi/tao_vegetable/order_test.go +++ b/platformapi/tao_vegetable/order_test.go @@ -211,7 +211,7 @@ func TestQueryBillList(t *testing.T) { TxdBillListGetRequest: &domain591.AlibabaWdkBillListTxdBillListGetRequest{ EndBillDate: &endTime, StartBillDate: &createTime, - ShopCode: utils.String2Pointer("JX668594"), + ShopCode: utils.String2Pointer("JX667321"), PageSize: utils.Int64ToPointer(200), PageIndex: utils.Int64ToPointer(1), }, diff --git a/platformapi/tao_vegetable/store_sku_test.go b/platformapi/tao_vegetable/store_sku_test.go index d889d197..2ab95c05 100644 --- a/platformapi/tao_vegetable/store_sku_test.go +++ b/platformapi/tao_vegetable/store_sku_test.go @@ -128,16 +128,148 @@ func TestUpdateSku(t *testing.T) { globals.SugarLogger.Debugf("err = %s", utils.Format4Output(err, false)) } +var storeList = []int64{ + 669053, + 103074, + 668985, + 103065, + 668960, + 668959, + 668953, + 103029, + 668949, + 103002, + 102999, + 668932, + 668931, + 668917, + 102969, + 102966, + 668909, + 668908, + 668905, + 668901, + 102946, + 102939, + 102938, + 668894, + 102934, + 102933, + 102930, + 668884, + 668878, + 102903, + 668757, + 102293, + 668622, + 668618, + 668592, + 100945, + 668583, + 100943, + 100935, + 100905, + 668498, + 668476, + 668462, + 100309, + 100299, + 100292, + 668276, + 668180, + 667320, + 667237, + 667036, + 668691, + 668673, + 668282, + 667447, + 667354, + 667335, + 667319, + 667316, + 667269, + 667268, + 667267, + 667260, + 667132, + 667030, + 666965, + 666714, + 666708, + 666705, + 103437, + 103349, + 103123, + 103121, + 103106, + 103038, + 103028, + 103019, + 102831, + 102751, + 102683, + 102542, + 102514, + 102382, + 102182, + 102178, + 102173, + 102098, + 102094, + 102080, + 102072, + 102069, + 101870, + 101869, + 101868, + 101867, + 101866, + 101865, + 100956, + 100930, + 100871, + 100786, + 100746, + 100744, + 100705, + 100400, + 100111, + 100108, + 100106, + 100104, + 100103, + 100102, + 100100, + 100097, + 100096, + 100095, + 100093, + 100092, + 100089, + 100087, + 100086, + 100085, + 100083, + 100082, + 100081, + 100079, + 100078, +} + // 商品上下架 func TestStoreSkuUpdateOffShelf(t *testing.T) { - param := &request587.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain587.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ - SkuCode: utils.String2Pointer("19930827"), - StoreId: utils.String2Pointer("JX668594"), - ChannelCode: utils.String2Pointer("31"), - OnlineSaleFlag: utils.Int64ToPointer(0), - }} - err := apiTao.StoreSkuUpdateOffShelf(param) - globals.SugarLogger.Debugf("err := %s ", utils.Format4Output(err, false)) + for _, v := range storeList { + param := &request587.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain587.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ + SkuCode: utils.String2Pointer("19930827"), + StoreId: utils.String2Pointer(fmt.Sprintf("JX%d", v)), + ChannelCode: utils.String2Pointer("31"), + OnlineSaleFlag: utils.Int64ToPointer(0), + }} + apiTao.StoreSkuUpdateOffShelf(param) + } + + //globals.SugarLogger.Debugf("err := %s ", utils.Format4Output(err, false)) } // 商品库存修改 @@ -169,8 +301,7 @@ func TestStoreSkuStock(t *testing.T) { func TestGetSkuDetaul(t *testing.T) { result, err := apiTao.QueryStoreSKu(&request585.AlibabaWdkSkuQueryRequest{Param: &domain585.AlibabaWdkSkuQuerySkuQueryDo{ - SkuCodes: &[]string{"39083"}, - OuCode: utils.String2Pointer("JX666678"), + OuCode: utils.String2Pointer("JX666678"), }}) globals.SugarLogger.Debugf("err := %s ", utils.Format4Output(err, false)) globals.SugarLogger.Debugf("result := %s ", utils.Format4Output(result, false)) From 6de62acbc955f1c902dbe07b9200ce8a547204ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 1 Aug 2023 13:37:25 +0800 Subject: [PATCH 08/21] 1 --- platformapi/mtwmapi/mtwmapi_test.go | 2 +- platformapi/mtwmapi/order_test.go | 2 +- platformapi/tao_vegetable/store_sku_test.go | 18 +++++++----------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/platformapi/mtwmapi/mtwmapi_test.go b/platformapi/mtwmapi/mtwmapi_test.go index f49d8fcc..28d6b503 100644 --- a/platformapi/mtwmapi/mtwmapi_test.go +++ b/platformapi/mtwmapi/mtwmapi_test.go @@ -51,7 +51,7 @@ func TestGetOAuthCode(t *testing.T) { } func TestPreparationMealComplete(t *testing.T) { - api.PreparationMealComplete(1100657633926494664) + api.PreparationMealComplete(900658760944919842) } func TestGetAccessToken(t *testing.T) { diff --git a/platformapi/mtwmapi/order_test.go b/platformapi/mtwmapi/order_test.go index f57c7d65..52597d1e 100644 --- a/platformapi/mtwmapi/order_test.go +++ b/platformapi/mtwmapi/order_test.go @@ -19,7 +19,7 @@ func TestOrderViewStatus(t *testing.T) { } func TestOrderGetOrderDetail(t *testing.T) { - result, err := api.OrderGetOrderDetail(1100496043552579025, false) + result, err := api.OrderGetOrderDetail(900658760944919842, false) if err != nil { t.Fatal(err) } diff --git a/platformapi/tao_vegetable/store_sku_test.go b/platformapi/tao_vegetable/store_sku_test.go index 2ab95c05..52d5a7b5 100644 --- a/platformapi/tao_vegetable/store_sku_test.go +++ b/platformapi/tao_vegetable/store_sku_test.go @@ -259,17 +259,13 @@ var storeList = []int64{ // 商品上下架 func TestStoreSkuUpdateOffShelf(t *testing.T) { - for _, v := range storeList { - param := &request587.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain587.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ - SkuCode: utils.String2Pointer("19930827"), - StoreId: utils.String2Pointer(fmt.Sprintf("JX%d", v)), - ChannelCode: utils.String2Pointer("31"), - OnlineSaleFlag: utils.Int64ToPointer(0), - }} - apiTao.StoreSkuUpdateOffShelf(param) - } - - //globals.SugarLogger.Debugf("err := %s ", utils.Format4Output(err, false)) + param := &request587.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain587.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ + SkuCode: utils.String2Pointer("23702"), + StoreId: utils.String2Pointer(fmt.Sprintf("JX%d", 103002)), + ChannelCode: utils.String2Pointer("31"), + OnlineSaleFlag: utils.Int64ToPointer(0), + }} + apiTao.StoreSkuUpdateOffShelf(param) } // 商品库存修改 From 2d3e61762f827c386c9864a172e334fabde294c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 1 Aug 2023 14:32:17 +0800 Subject: [PATCH 09/21] 1 --- platformapi/tao_vegetable/store_sku.go | 23 +++++++++++++++++++++ platformapi/tao_vegetable/store_sku_test.go | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/platformapi/tao_vegetable/store_sku.go b/platformapi/tao_vegetable/store_sku.go index cb872466..58e85368 100644 --- a/platformapi/tao_vegetable/store_sku.go +++ b/platformapi/tao_vegetable/store_sku.go @@ -6,9 +6,11 @@ import ( "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability585/domain" "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability585/request" "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587" + domain587 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/domain" request2 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/request" "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589" request589 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589/request" + "git.rosy.net.cn/baseapi/utils" ) // AddStoreSku 新增门店商品 @@ -102,6 +104,27 @@ func (a *API) StoreSkuUpdateOffShelf(param *request2.AlibabaAxChannelSkuStatusUp return nil } +// StoreSkuUpdateOffShelfList 门店商品上下架 +func (a *API) StoreSkuUpdateOffShelfList(storeID int64, skuList []string) []string { + client := ability587.NewAbility587(&a.client) + + errs := make([]string, 0, 0) + param := &request2.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain587.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ + StoreId: utils.String2Pointer(fmt.Sprintf("JX%d", storeID)), + ChannelCode: utils.String2Pointer("31"), + OnlineSaleFlag: utils.Int64ToPointer(0), + }} + for _, v := range skuList { + param.ChannelSkuUpdateStatusReq.SkuCode = utils.String2Pointer(v) + data, _ := client.AlibabaAxChannelSkuStatusUpdate(param, a.token) + if !*data.ApiResult.Success { + errs = append(errs, *data.ApiResult.ErrMsg) + } + } + + return errs +} + // StoreSkuStock 商品库存同步 func (a *API) StoreSkuStock(param *request589.AlibabaWdkStockPublishRequest) error { //globals.SugarLogger.Debugf("进入 StoreSkuStock") diff --git a/platformapi/tao_vegetable/store_sku_test.go b/platformapi/tao_vegetable/store_sku_test.go index 52d5a7b5..cc3ecfd7 100644 --- a/platformapi/tao_vegetable/store_sku_test.go +++ b/platformapi/tao_vegetable/store_sku_test.go @@ -260,8 +260,8 @@ var storeList = []int64{ // 商品上下架 func TestStoreSkuUpdateOffShelf(t *testing.T) { param := &request587.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain587.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ - SkuCode: utils.String2Pointer("23702"), - StoreId: utils.String2Pointer(fmt.Sprintf("JX%d", 103002)), + SkuCode: utils.String2Pointer("6095768"), + StoreId: utils.String2Pointer(fmt.Sprintf("JX%d", 668960)), ChannelCode: utils.String2Pointer("31"), OnlineSaleFlag: utils.Int64ToPointer(0), }} From f6865ab586846b04da0d853ebfcdc00012db6fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 1 Aug 2023 15:36:06 +0800 Subject: [PATCH 10/21] 1 --- platformapi/tao_vegetable/store_sku.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platformapi/tao_vegetable/store_sku.go b/platformapi/tao_vegetable/store_sku.go index 58e85368..0d5e9f59 100644 --- a/platformapi/tao_vegetable/store_sku.go +++ b/platformapi/tao_vegetable/store_sku.go @@ -11,6 +11,7 @@ import ( "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589" request589 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589/request" "git.rosy.net.cn/baseapi/utils" + "git.rosy.net.cn/jx-callback/globals" ) // AddStoreSku 新增门店商品 @@ -116,7 +117,10 @@ func (a *API) StoreSkuUpdateOffShelfList(storeID int64, skuList []string) []stri }} for _, v := range skuList { param.ChannelSkuUpdateStatusReq.SkuCode = utils.String2Pointer(v) - data, _ := client.AlibabaAxChannelSkuStatusUpdate(param, a.token) + data, err := client.AlibabaAxChannelSkuStatusUpdate(param, a.token) + if err != nil { + globals.SugarLogger.Debugf("err :========= %v", err) + } if !*data.ApiResult.Success { errs = append(errs, *data.ApiResult.ErrMsg) } From 3c5d5f2bbfe3039cac0df703f08fca76978e4b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 1 Aug 2023 15:57:28 +0800 Subject: [PATCH 11/21] 1 --- platformapi/tao_vegetable/store_sku.go | 1 + 1 file changed, 1 insertion(+) diff --git a/platformapi/tao_vegetable/store_sku.go b/platformapi/tao_vegetable/store_sku.go index 0d5e9f59..711aae85 100644 --- a/platformapi/tao_vegetable/store_sku.go +++ b/platformapi/tao_vegetable/store_sku.go @@ -122,6 +122,7 @@ func (a *API) StoreSkuUpdateOffShelfList(storeID int64, skuList []string) []stri globals.SugarLogger.Debugf("err :========= %v", err) } if !*data.ApiResult.Success { + globals.SugarLogger.Debugf("Success :========= %s", *data.ApiResult.ErrMsg) errs = append(errs, *data.ApiResult.ErrMsg) } } From 5568704a522fa27968fb5576a013eca119a4272c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 1 Aug 2023 16:36:14 +0800 Subject: [PATCH 12/21] 1 --- platformapi/tao_vegetable/store_sku.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/platformapi/tao_vegetable/store_sku.go b/platformapi/tao_vegetable/store_sku.go index 711aae85..f98284d0 100644 --- a/platformapi/tao_vegetable/store_sku.go +++ b/platformapi/tao_vegetable/store_sku.go @@ -11,7 +11,7 @@ import ( "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589" request589 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589/request" "git.rosy.net.cn/baseapi/utils" - "git.rosy.net.cn/jx-callback/globals" + "time" ) // AddStoreSku 新增门店商品 @@ -115,16 +115,15 @@ func (a *API) StoreSkuUpdateOffShelfList(storeID int64, skuList []string) []stri ChannelCode: utils.String2Pointer("31"), OnlineSaleFlag: utils.Int64ToPointer(0), }} - for _, v := range skuList { - param.ChannelSkuUpdateStatusReq.SkuCode = utils.String2Pointer(v) - data, err := client.AlibabaAxChannelSkuStatusUpdate(param, a.token) - if err != nil { - globals.SugarLogger.Debugf("err :========= %v", err) - } + for i := 0; i < len(skuList); i++ { + param.ChannelSkuUpdateStatusReq.SkuCode = utils.String2Pointer(skuList[i]) + data, _ := client.AlibabaAxChannelSkuStatusUpdate(param, a.token) if !*data.ApiResult.Success { - globals.SugarLogger.Debugf("Success :========= %s", *data.ApiResult.ErrMsg) errs = append(errs, *data.ApiResult.ErrMsg) } + if i%5 == 0 { + time.Sleep(1 * time.Second) + } } return errs From 44ed7450ef85464c2a17b38416665102742d9814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 2 Aug 2023 18:50:54 +0800 Subject: [PATCH 13/21] 1 --- platformapi/tao_vegetable/order_test.go | 2 +- platformapi/tao_vegetable/store_sku.go | 47 ++- platformapi/tao_vegetable/store_sku_test.go | 370 +++++++++++++------- 3 files changed, 257 insertions(+), 162 deletions(-) diff --git a/platformapi/tao_vegetable/order_test.go b/platformapi/tao_vegetable/order_test.go index 6bfc557d..18240b20 100644 --- a/platformapi/tao_vegetable/order_test.go +++ b/platformapi/tao_vegetable/order_test.go @@ -211,7 +211,7 @@ func TestQueryBillList(t *testing.T) { TxdBillListGetRequest: &domain591.AlibabaWdkBillListTxdBillListGetRequest{ EndBillDate: &endTime, StartBillDate: &createTime, - ShopCode: utils.String2Pointer("JX667321"), + ShopCode: utils.String2Pointer("667321"), PageSize: utils.Int64ToPointer(200), PageIndex: utils.Int64ToPointer(1), }, diff --git a/platformapi/tao_vegetable/store_sku.go b/platformapi/tao_vegetable/store_sku.go index f98284d0..4a6ffa03 100644 --- a/platformapi/tao_vegetable/store_sku.go +++ b/platformapi/tao_vegetable/store_sku.go @@ -6,12 +6,9 @@ import ( "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability585/domain" "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability585/request" "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587" - domain587 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/domain" request2 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/request" "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589" request589 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589/request" - "git.rosy.net.cn/baseapi/utils" - "time" ) // AddStoreSku 新增门店商品 @@ -106,28 +103,28 @@ func (a *API) StoreSkuUpdateOffShelf(param *request2.AlibabaAxChannelSkuStatusUp } // StoreSkuUpdateOffShelfList 门店商品上下架 -func (a *API) StoreSkuUpdateOffShelfList(storeID int64, skuList []string) []string { - client := ability587.NewAbility587(&a.client) - - errs := make([]string, 0, 0) - param := &request2.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain587.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ - StoreId: utils.String2Pointer(fmt.Sprintf("JX%d", storeID)), - ChannelCode: utils.String2Pointer("31"), - OnlineSaleFlag: utils.Int64ToPointer(0), - }} - for i := 0; i < len(skuList); i++ { - param.ChannelSkuUpdateStatusReq.SkuCode = utils.String2Pointer(skuList[i]) - data, _ := client.AlibabaAxChannelSkuStatusUpdate(param, a.token) - if !*data.ApiResult.Success { - errs = append(errs, *data.ApiResult.ErrMsg) - } - if i%5 == 0 { - time.Sleep(1 * time.Second) - } - } - - return errs -} +//func (a *API) StoreSkuUpdateOffShelfList(storeID int64, skuList []string) []string { +// client := ability587.NewAbility587(&a.client) +// +// errs := make([]string, 0, 0) +// param := &request2.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain587.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ +// StoreId: utils.String2Pointer(fmt.Sprintf("JX%d", storeID)), +// ChannelCode: utils.String2Pointer("31"), +// OnlineSaleFlag: utils.Int64ToPointer(0), +// }} +// for i := 0; i < len(skuList); i++ { +// param.ChannelSkuUpdateStatusReq.SkuCode = utils.String2Pointer(skuList[i]) +// data, _ := client.AlibabaAxChannelSkuStatusUpdate(param, a.token) +// if !*data.ApiResult.Success { +// errs = append(errs, *data.ApiResult.ErrMsg) +// } +// if i%5 == 0 { +// time.Sleep(1 * time.Second) +// } +// } +// +// return errs +//} // StoreSkuStock 商品库存同步 func (a *API) StoreSkuStock(param *request589.AlibabaWdkStockPublishRequest) error { diff --git a/platformapi/tao_vegetable/store_sku_test.go b/platformapi/tao_vegetable/store_sku_test.go index cc3ecfd7..22196fd6 100644 --- a/platformapi/tao_vegetable/store_sku_test.go +++ b/platformapi/tao_vegetable/store_sku_test.go @@ -128,144 +128,242 @@ func TestUpdateSku(t *testing.T) { globals.SugarLogger.Debugf("err = %s", utils.Format4Output(err, false)) } -var storeList = []int64{ - 669053, - 103074, - 668985, - 103065, - 668960, - 668959, - 668953, - 103029, - 668949, - 103002, - 102999, - 668932, - 668931, - 668917, - 102969, - 102966, - 668909, - 668908, - 668905, - 668901, - 102946, - 102939, - 102938, - 668894, - 102934, - 102933, - 102930, - 668884, - 668878, - 102903, - 668757, - 102293, - 668622, - 668618, - 668592, - 100945, - 668583, - 100943, - 100935, - 100905, - 668498, - 668476, - 668462, - 100309, - 100299, - 100292, - 668276, - 668180, - 667320, - 667237, - 667036, - 668691, - 668673, - 668282, - 667447, - 667354, - 667335, - 667319, - 667316, - 667269, - 667268, - 667267, - 667260, - 667132, - 667030, - 666965, - 666714, - 666708, - 666705, - 103437, - 103349, - 103123, - 103121, - 103106, - 103038, - 103028, - 103019, - 102831, - 102751, - 102683, - 102542, - 102514, - 102382, - 102182, - 102178, - 102173, - 102098, - 102094, - 102080, - 102072, - 102069, - 101870, - 101869, - 101868, - 101867, - 101866, - 101865, - 100956, - 100930, - 100871, - 100786, - 100746, - 100744, - 100705, - 100400, - 100111, - 100108, - 100106, - 100104, - 100103, - 100102, - 100100, - 100097, - 100096, - 100095, - 100093, - 100092, - 100089, - 100087, - 100086, - 100085, - 100083, - 100082, - 100081, - 100079, - 100078, -} - // 商品上下架 func TestStoreSkuUpdateOffShelf(t *testing.T) { - param := &request587.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain587.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ - SkuCode: utils.String2Pointer("6095768"), - StoreId: utils.String2Pointer(fmt.Sprintf("JX%d", 668960)), - ChannelCode: utils.String2Pointer("31"), - OnlineSaleFlag: utils.Int64ToPointer(0), - }} - apiTao.StoreSkuUpdateOffShelf(param) + for _, storeID := range storeList { + param := &request587.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain587.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ + StoreId: utils.String2Pointer(fmt.Sprintf("JX%d", storeID)), + ChannelCode: utils.String2Pointer("31"), + OnlineSaleFlag: utils.Int64ToPointer(1), + }} + for _, v := range skuList { + param.ChannelSkuUpdateStatusReq.SkuCode = utils.String2Pointer(utils.Int64ToStr(v)) + err := apiTao.StoreSkuUpdateOffShelf(param) + if err != nil { + fmt.Println(err) + } + } + } + +} + +var storeList = []int64{ + 669053, 103074, 668985, 103065, 668960, 668959, 668953, 103029, 668949, 103002, 102999, 668932, 668931, 668917, 102969, 102966, 668909, 668908, 668905, 668901, 102946, 102939, 102938, 668894, 102934, 102933, 102930, 668884, 668878, 102903, 668757, 102293, 668622, 668618, 668592, 100945, 668583, 100943, 100905, 668498, 668476, 668462, 100309, 100299, 100292, 668276, 668180, 667320, 667237, 667036, 668691, 668673, 668282, 667447, 667354, 667335, 667319, 667269, 667268, 667267, 667260, 667132, 667030, 666965, 666714, 666708, 666705, 103437, 103349, 103123, 103121, 103106, 103038, 103028, 103019, 102831, 102751, 102683, 102542, 102514, 102382, 102182, 102178, 102173, 102098, 102094, 102080, 100097, 100096, 100095, 100093, 100092, 100089, 100087, 100086, 100085, 100083, 100082, 100081, 100079, 100078, 100786, 100746, 102072, 102069, 101870, 101869, 101868, 100744, 100705, 100400, 100111, 100108, 100106, 100104, 100103, 100102, 100100, 101867, 101866, 101865, 100956, 100930, 100871, +} + +var skuList = []int64{ + 26125, + 22596, + 25103, + 25104, + 25105, + 24656, + 30670, + 23422, + 24097, + 30669, + 23424, + 25535, + 23620, + 23621, + 23622, + 31308, + 25022, + 25717, + 25023, + 25718, + 25685, + 27264, + 27265, + 30396, + 24300, + 23001, + 26049, + 23002, + 26050, + 23417, + 26287, + 23419, + 26289, + 30625, + 30691, + 30611, + 23291, + 30686, + 23294, + 31254, + 30672, + 30671, + 30702, + 35420, + 30687, + 30730, + 30727, + 31312, + 31238, + 24264, + 31022, + 24266, + 31229, + 30663, + 23879, + 30777, + 30889, + 30676, + 30814, + 30219, + 30675, + 30627, + 25518, + 31518, + 25519, + 35242, + 26057, + 26058, + 26447, + 26448, + 30365, + 30830, + 25412, + 30641, + 30657, + 30656, + 23818, + 31200, + 6045175, + 33638, + 31682, + 6045386, + 24935, + 35241, + 30875, + 26700, + 30888, + 26701, + 31248, + 6042133, + 34897, + 23907, + 30559, + 30363, + 6045167, + 6041753, + 30700, + 26842, + 26843, + 26040, + 35504, + 6041970, + 26065, + 6041969, + 6045177, + 6045185, + 30094, + 6045186, + 26067, + 6045232, + 31299, + 6045404, + 30667, + 30780, + 30881, + 30644, + 6041954, + 6041955, + 30639, + 30775, + 34417, + 30811, + 6045326, + 35487, + 23408, + 31020, + 23409, + 35486, + 35490, + 23411, + 25947, + 25949, + 30522, + 24120, + 25014, + 30890, + 26864, + 6040867, + 6042128, + 25665, + 30649, + 34959, + 25668, + 35503, + 30768, + 26059, + 6045098, + 31243, + 23163, + 33156, + 6039630, + 27056, + 34826, + 30635, + 30876, + 30619, + 30645, + 30904, + 31240, + 24226, + 31524, + 25936, + 32914, + 25735, + 32913, + 29645, + 33391, + 30184, + 23841, + 34354, + 30320, + 25736, + 6045549, + 24251, + 6045550, + 24253, + 31423, + 31291, + 35152, + 22840, + 27006, + 22842, + 30900, + 26641, + 30616, + 30743, + 26642, + 30807, + 26493, + 26643, + 25059, + 25158, + 26494, + 25061, + 26495, + 31275, + 25062, + 30704, + 26936, + 31815, + 33075, + 30779, + 25335, + 25336, + 22993, + 30352, + 25417, + 25696, + 23402, + 25418, + 25419, + 26908, } // 商品库存修改 From d8e07b285a4399645f03414f1281e6a91bafe6e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 3 Aug 2023 16:37:58 +0800 Subject: [PATCH 14/21] 1 --- platformapi/tao_vegetable/sdk/util/util.go | 29 +++--- platformapi/tao_vegetable/store_sku.go | 58 +++++------ platformapi/tao_vegetable/store_sku_test.go | 22 ++-- platformapi/tao_vegetable/store_test.go | 110 +------------------- 4 files changed, 52 insertions(+), 167 deletions(-) diff --git a/platformapi/tao_vegetable/sdk/util/util.go b/platformapi/tao_vegetable/sdk/util/util.go index 5419a7fc..8ba29af0 100644 --- a/platformapi/tao_vegetable/sdk/util/util.go +++ b/platformapi/tao_vegetable/sdk/util/util.go @@ -40,12 +40,12 @@ func (t LocalTime) String() string { return time.Time(t).Format(TimeFormat) } -func UnmarshalJSON(data []byte,v interface{})(err error){ +func UnmarshalJSON(data []byte, v interface{}) (err error) { return json.Unmarshal(data, v) } func ConvertStructList(data interface{}) string { - if(data == nil) { + if data == nil { return "[]" } jsonStr, _ := json.Marshal(data) @@ -53,7 +53,7 @@ func ConvertStructList(data interface{}) string { } func ConvertStruct(data interface{}) string { - if(data == nil) { + if data == nil { return "{}" } jsonStr, _ := json.Marshal(data) @@ -61,17 +61,17 @@ func ConvertStruct(data interface{}) string { } func ConvertBasicList(data interface{}) string { - if(data == nil) { + if data == nil { return "[]" } return strings.Replace(strings.Trim(fmt.Sprint(data), "[]"), " ", ",", -1) } -func HandleJsonResponse(jsonStr string,v interface{})(err error) { +func HandleJsonResponse(jsonStr string, v interface{}) (err error) { - if(strings.Contains(jsonStr[0:20],"error_response")){ + if strings.Contains(jsonStr[0:20], "error_response") { err := &TopApiRequestError{} - jsonStr = jsonStr[18:len(jsonStr)-1] + jsonStr = jsonStr[18 : len(jsonStr)-1] err2 := json.Unmarshal([]byte(jsonStr), err) if err2 != nil { return err2 @@ -81,12 +81,12 @@ func HandleJsonResponse(jsonStr string,v interface{})(err error) { return json.Unmarshal([]byte(jsonStr), v) } -func GetSign(publicParam map[string]interface{},data map[string]interface{},secret string) string { +func GetSign(publicParam map[string]interface{}, data map[string]interface{}, secret string) string { var allParamMap = make(map[string]interface{}) - for k,v := range data { + for k, v := range data { allParamMap[k] = v } - for k,v := range publicParam { + for k, v := range publicParam { allParamMap[k] = v } var keyList []string @@ -95,21 +95,20 @@ func GetSign(publicParam map[string]interface{},data map[string]interface{},secr } sort.Strings(keyList) var signStr = "" - for _ , key := range keyList { + for _, key := range keyList { value := allParamMap[key] signStr = signStr + fmt.Sprintf("%v%v", key, value) //if(value != ""){ // signStr = signStr + fmt.Sprintf("%v%v", key, value) //} } - fmt.Println(signStr) - sign := strings.ToUpper(HmacSha256(signStr,secret)) + //fmt.Println(signStr) + sign := strings.ToUpper(HmacSha256(signStr, secret)) return sign } - func HmacSha256(data string, secret string) string { h := hmac.New(sha256.New, []byte(secret)) h.Write([]byte(data)) return hex.EncodeToString(h.Sum(nil)) -} \ No newline at end of file +} diff --git a/platformapi/tao_vegetable/store_sku.go b/platformapi/tao_vegetable/store_sku.go index 4a6ffa03..cc329311 100644 --- a/platformapi/tao_vegetable/store_sku.go +++ b/platformapi/tao_vegetable/store_sku.go @@ -6,9 +6,13 @@ import ( "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability585/domain" "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability585/request" "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587" + domain587 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/domain" request2 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/request" "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589" request589 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589/request" + "git.rosy.net.cn/baseapi/utils" + "git.rosy.net.cn/jx-callback/globals" + "time" ) // AddStoreSku 新增门店商品 @@ -82,11 +86,6 @@ func (a *API) QueryStoreSKu(param *request.AlibabaWdkSkuQueryRequest) (*[]domain return data.Result.Models, nil } -// DeleteStoreSku 删除门店商品 -func (a *API) DeleteStoreSku() { - -} - // StoreSkuUpdateOffShelf 门店商品上下架 func (a *API) StoreSkuUpdateOffShelf(param *request2.AlibabaAxChannelSkuStatusUpdateRequest) error { //globals.SugarLogger.Debugf("进入 StoreSkuUpdateOffShelf") @@ -95,36 +94,37 @@ func (a *API) StoreSkuUpdateOffShelf(param *request2.AlibabaAxChannelSkuStatusUp data, _ := client.AlibabaAxChannelSkuStatusUpdate(param, a.token) if !*data.ApiResult.Success { - //globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.ApiResult, false)) - return fmt.Errorf(*data.ApiResult.ErrMsg) + globals.SugarLogger.Debugf("storeID:%d,skuId:%d,requestId[%s],err[%s]", param.ChannelSkuUpdateStatusReq.StoreId, param.ChannelSkuUpdateStatusReq.SkuCode, data.RequestId, utils.Format4Output(data, false)) + //return fmt.Errorf(*data.ApiResult.ErrMsg) } return nil } // StoreSkuUpdateOffShelfList 门店商品上下架 -//func (a *API) StoreSkuUpdateOffShelfList(storeID int64, skuList []string) []string { -// client := ability587.NewAbility587(&a.client) -// -// errs := make([]string, 0, 0) -// param := &request2.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain587.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ -// StoreId: utils.String2Pointer(fmt.Sprintf("JX%d", storeID)), -// ChannelCode: utils.String2Pointer("31"), -// OnlineSaleFlag: utils.Int64ToPointer(0), -// }} -// for i := 0; i < len(skuList); i++ { -// param.ChannelSkuUpdateStatusReq.SkuCode = utils.String2Pointer(skuList[i]) -// data, _ := client.AlibabaAxChannelSkuStatusUpdate(param, a.token) -// if !*data.ApiResult.Success { -// errs = append(errs, *data.ApiResult.ErrMsg) -// } -// if i%5 == 0 { -// time.Sleep(1 * time.Second) -// } -// } -// -// return errs -//} +func (a *API) StoreSkuUpdateOffShelfList(storeID int64, skuList []int64) []string { + client := ability587.NewAbility587(&a.client) + + errs := make([]string, 0, 0) + param := &request2.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain587.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ + StoreId: utils.String2Pointer(fmt.Sprintf("JX%d", storeID)), + ChannelCode: utils.String2Pointer("31"), + OnlineSaleFlag: utils.Int64ToPointer(1), + }} + for i := 0; i < len(skuList); i++ { + param.ChannelSkuUpdateStatusReq.SkuCode = utils.String2Pointer(utils.Int64ToStr(skuList[i])) + data, _ := client.AlibabaAxChannelSkuStatusUpdate(param, a.token) + globals.SugarLogger.Debugf("data = %s", utils.Format4Output(data, false)) + //if !*data.ApiResult.Success { + // errs = append(errs, *data.ApiResult.ErrMsg) + //} + if i%5 == 0 { + time.Sleep(1 * time.Second) + } + } + + return errs +} // StoreSkuStock 商品库存同步 func (a *API) StoreSkuStock(param *request589.AlibabaWdkStockPublishRequest) error { diff --git a/platformapi/tao_vegetable/store_sku_test.go b/platformapi/tao_vegetable/store_sku_test.go index 22196fd6..38274370 100644 --- a/platformapi/tao_vegetable/store_sku_test.go +++ b/platformapi/tao_vegetable/store_sku_test.go @@ -5,8 +5,6 @@ import ( request1475 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability1475/request" domain585 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability585/domain" request585 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability585/request" - domain587 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/domain" - request587 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/request" domain589 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589/domain" request589 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589/request" "git.rosy.net.cn/baseapi/utils" @@ -131,25 +129,17 @@ func TestUpdateSku(t *testing.T) { // 商品上下架 func TestStoreSkuUpdateOffShelf(t *testing.T) { for _, storeID := range storeList { - param := &request587.AlibabaAxChannelSkuStatusUpdateRequest{ChannelSkuUpdateStatusReq: &domain587.AlibabaAxChannelSkuStatusUpdateChannelSkuUpdateStatusReq{ - StoreId: utils.String2Pointer(fmt.Sprintf("JX%d", storeID)), - ChannelCode: utils.String2Pointer("31"), - OnlineSaleFlag: utils.Int64ToPointer(1), - }} - for _, v := range skuList { - param.ChannelSkuUpdateStatusReq.SkuCode = utils.String2Pointer(utils.Int64ToStr(v)) - err := apiTao.StoreSkuUpdateOffShelf(param) - if err != nil { - fmt.Println(err) - } + globals.SugarLogger.Debugf("store %d", storeID) + err := apiTao.StoreSkuUpdateOffShelfList(storeID, skuList) + if err != nil { + globals.SugarLogger.Debugf("err := %s", utils.Format4Output(err, false)) } } } -var storeList = []int64{ - 669053, 103074, 668985, 103065, 668960, 668959, 668953, 103029, 668949, 103002, 102999, 668932, 668931, 668917, 102969, 102966, 668909, 668908, 668905, 668901, 102946, 102939, 102938, 668894, 102934, 102933, 102930, 668884, 668878, 102903, 668757, 102293, 668622, 668618, 668592, 100945, 668583, 100943, 100905, 668498, 668476, 668462, 100309, 100299, 100292, 668276, 668180, 667320, 667237, 667036, 668691, 668673, 668282, 667447, 667354, 667335, 667319, 667269, 667268, 667267, 667260, 667132, 667030, 666965, 666714, 666708, 666705, 103437, 103349, 103123, 103121, 103106, 103038, 103028, 103019, 102831, 102751, 102683, 102542, 102514, 102382, 102182, 102178, 102173, 102098, 102094, 102080, 100097, 100096, 100095, 100093, 100092, 100089, 100087, 100086, 100085, 100083, 100082, 100081, 100079, 100078, 100786, 100746, 102072, 102069, 101870, 101869, 101868, 100744, 100705, 100400, 100111, 100108, 100106, 100104, 100103, 100102, 100100, 101867, 101866, 101865, 100956, 100930, 100871, -} +// +var storeList = []int64{667354, 667319, 667269, 667268, 667267, 667260, 667132, 667030, 666965, 666714, 666708, 666705, 103437, 103349, 103123, 103121, 103106, 103038, 103028, 103019, 102831, 102751, 102683, 102542, 102514, 102382, 102182, 102178, 102173, 102098, 102094, 102080, 100097, 100096, 100095, 100093, 100092, 100089, 100087, 100086, 100085, 100083, 100082, 100079, 100078, 100786, 100746, 102072, 102069, 101870, 101869, 101868, 100744, 100705, 100400, 100111, 100108, 100106, 100104, 100103, 100102, 100100, 101867, 101866, 101865, 100956, 100930, 100871} var skuList = []int64{ 26125, diff --git a/platformapi/tao_vegetable/store_test.go b/platformapi/tao_vegetable/store_test.go index 19a30a4f..791f3d90 100644 --- a/platformapi/tao_vegetable/store_test.go +++ b/platformapi/tao_vegetable/store_test.go @@ -124,115 +124,11 @@ func TestShopUpdateRange(t *testing.T) { } func TestUpdateStoreTest(t *testing.T) { - aa := []string{ - "JX668691", - "JX668282", - "JX667447", - "JX667354", - "JX667319", - "JX667316", - "JX669158", - "JX667269", - "JX667267", - "JX667260", - "JX667132", - "JX667030", - "JX666965", - "JX666714", - "JX666708", - "JX666705", - "JX103437", - "JX103349", - "JX103123", - "JX103121", - "JX103106", - "JX103038", - "JX103028", - "JX103019", - "JX102831", - "JX102751", - "JX102683", - "JX102542", - "JX102514", - "JX102382", - "JX102182", - "JX102178", - "JX102173", - "JX102098", - "JX102094", - "JX102080", - "JX102072", - "JX102069", - "JX101870", - "JX101869", - "JX101868", - "JX101867", - "JX101866", - "JX101865", - "JX100956", - "JX100930", - "JX100871", - "JX100786", - "JX100746", - "JX100744", - "JX100726", - "JX100705", - "JX100400", - "JX100111", - "JX100108", - "JX100104", - "JX100103", - "JX100102", - "JX100100", - "JX100097", - "JX100096", - "JX100095", - "JX100093", - "JX100089", - "JX100087", - "JX100086", - "JX100085", - "JX100082", - "JX100079", - "JX100078", - "JX668673", - "JX667321", - "JX667268", - "JX667094", - //669158, - //667321, - //667094, - //668906, - //668886, - //668880, - //668751, - //668701, - //668569, - //668567, - //668506, - //667231, - //667068, - //103191, - //103051, - //103050, - //103037, - //103018, - //102951, - //102924, - //102920, - //102908, - //102561, - //100946, - //100720, - //100325, - //100324, - //100296, - //100290, + aa := []int64{ + 102969, 102966, 668909, 668908, 668905, 668901, 102946, 102939, 102938, 668894, 102934, 102933, 102930, 668884, 668878, 102903, 668757, 102293, 668622, 668618, 668592, 100945, 668583, 100943, 100905, 668498, 668476, 668462, 100309, 100299, 100292, 668276, 668180, 667320, 667237, 667036, 668691, 668673, 668282, 667447, 667354, 667319, 667269, 667268, 667267, 667260, 667132, 667030, 666965, 666714, 666708, 666705, 103437, 103349, 103123, 103121, 103106, 103038, 103028, 103019, 102831, 102751, 102683, 102542, 102514, 102382, 102182, 102178, 102173, 102098, 102094, 102080, 100097, 100096, 100095, 100093, 100092, 100089, 100087, 100086, 100085, 100083, 100082, 100079, 100078, 100786, 100746, 102072, 102069, 101870, 101869, 101868, 100744, 100705, 100400, 100111, 100108, 100106, 100104, 100103, 100102, 100100, 101867, 101866, 101865, 100956, 100930, 100871, } for _, v := range aa { - //err := apiTao.ShopUpdateStatus(fmt.Sprintf("jx%d", v), -1) - //fmt.Println(err) - err := apiTao.ShopUpdateStatus(v, -1) + err := apiTao.ShopUpdateStatus(fmt.Sprintf("JX%d", v), 1) if err != nil { fmt.Println(err) } From 5df61357d45fa2cf6cef4bd44e03bcbfb7c74d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 3 Aug 2023 22:15:30 +0800 Subject: [PATCH 15/21] 1 --- platformapi/tao_vegetable/store_sku.go | 1 + platformapi/tao_vegetable/store_sku_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/platformapi/tao_vegetable/store_sku.go b/platformapi/tao_vegetable/store_sku.go index cc329311..e1e3b900 100644 --- a/platformapi/tao_vegetable/store_sku.go +++ b/platformapi/tao_vegetable/store_sku.go @@ -17,6 +17,7 @@ import ( // AddStoreSku 新增门店商品 func (a *API) AddStoreSku(param *request.AlibabaWdkSkuAddRequest) (*[]VegetableResultList, error) { + globals.SugarLogger.Debugf("=========AddStoreSku taboabo") client := ability585.NewAbility585(&a.client) data, _ := client.AlibabaWdkSkuAdd(param, a.token) var foodList = make([]VegetableResultList, 0, len(*data.Result.Models)) diff --git a/platformapi/tao_vegetable/store_sku_test.go b/platformapi/tao_vegetable/store_sku_test.go index 38274370..c3c1d4bd 100644 --- a/platformapi/tao_vegetable/store_sku_test.go +++ b/platformapi/tao_vegetable/store_sku_test.go @@ -139,7 +139,7 @@ func TestStoreSkuUpdateOffShelf(t *testing.T) { } // -var storeList = []int64{667354, 667319, 667269, 667268, 667267, 667260, 667132, 667030, 666965, 666714, 666708, 666705, 103437, 103349, 103123, 103121, 103106, 103038, 103028, 103019, 102831, 102751, 102683, 102542, 102514, 102382, 102182, 102178, 102173, 102098, 102094, 102080, 100097, 100096, 100095, 100093, 100092, 100089, 100087, 100086, 100085, 100083, 100082, 100079, 100078, 100786, 100746, 102072, 102069, 101870, 101869, 101868, 100744, 100705, 100400, 100111, 100108, 100106, 100104, 100103, 100102, 100100, 101867, 101866, 101865, 100956, 100930, 100871} +var storeList = []int64{100930, 100871} var skuList = []int64{ 26125, From 862b44487e799b30cf5fc2fa6dccd411f663299f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 3 Aug 2023 22:41:13 +0800 Subject: [PATCH 16/21] 1 --- platformapi/tao_vegetable/order_delivery.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformapi/tao_vegetable/order_delivery.go b/platformapi/tao_vegetable/order_delivery.go index f2106239..fd2b095b 100644 --- a/platformapi/tao_vegetable/order_delivery.go +++ b/platformapi/tao_vegetable/order_delivery.go @@ -47,7 +47,7 @@ func (a *API) DeliveryFinish(req *request2.AlibabaAelophyOrderWorkCallbackReques //globals.SugarLogger.Debugf("param := %s", utils.Format4Output(req, false)) data, _ := client.AlibabaAelophyOrderWorkCallback(req, a.token) - if !*data.ApiResult.Success { + if data != nil && !*data.ApiResult.Success { //globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false)) return fmt.Errorf(*data.ApiResult.ErrMsg) } From 8daeec06c265170a7456a8de1b09fbd75f3c8688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 4 Aug 2023 12:48:48 +0800 Subject: [PATCH 17/21] 1 --- platformapi/tao_vegetable/sdk/util/util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformapi/tao_vegetable/sdk/util/util.go b/platformapi/tao_vegetable/sdk/util/util.go index 8ba29af0..c6f97622 100644 --- a/platformapi/tao_vegetable/sdk/util/util.go +++ b/platformapi/tao_vegetable/sdk/util/util.go @@ -102,7 +102,7 @@ func GetSign(publicParam map[string]interface{}, data map[string]interface{}, se // signStr = signStr + fmt.Sprintf("%v%v", key, value) //} } - //fmt.Println(signStr) + fmt.Println(signStr) sign := strings.ToUpper(HmacSha256(signStr, secret)) return sign } From 95a51a803452f3b83c60fd8fc157f17bf2834831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 7 Aug 2023 16:46:10 +0800 Subject: [PATCH 18/21] 1 --- platformapi/tao_vegetable/order_afs.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/platformapi/tao_vegetable/order_afs.go b/platformapi/tao_vegetable/order_afs.go index 8845ee31..70e41473 100644 --- a/platformapi/tao_vegetable/order_afs.go +++ b/platformapi/tao_vegetable/order_afs.go @@ -247,10 +247,6 @@ func (a *API) QueryBillList(req *request591.AlibabaWdkBillListRequest) (*domain5 globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false)) return nil, fmt.Errorf(*data.ApiResult.ErrMsg) } - kk := *data.ApiResult.Model - for _, v := range *kk.TxdBillDetailBOS { - globals.SugarLogger.Debugf("kk := %s -- %s == %s", utils.Format4Output(v.BizOrderId, false), *v.OrderType, *v.ReceivableAmount) - } - globals.SugarLogger.Debugf("进入 data.ApiResult.Model : %s", utils.Format4Output(data.ApiResult.Model, false)) + return data.ApiResult.Model, nil } From 9df2b7fdc88412f62d78042ccf8660f65fe885f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 8 Aug 2023 09:09:58 +0800 Subject: [PATCH 19/21] 1 --- platformapi/tao_vegetable/order_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformapi/tao_vegetable/order_test.go b/platformapi/tao_vegetable/order_test.go index 18240b20..6bfc557d 100644 --- a/platformapi/tao_vegetable/order_test.go +++ b/platformapi/tao_vegetable/order_test.go @@ -211,7 +211,7 @@ func TestQueryBillList(t *testing.T) { TxdBillListGetRequest: &domain591.AlibabaWdkBillListTxdBillListGetRequest{ EndBillDate: &endTime, StartBillDate: &createTime, - ShopCode: utils.String2Pointer("667321"), + ShopCode: utils.String2Pointer("JX667321"), PageSize: utils.Int64ToPointer(200), PageIndex: utils.Int64ToPointer(1), }, From 6ad1a24cefe918017bbee8428676df130df83609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 8 Aug 2023 11:17:25 +0800 Subject: [PATCH 20/21] 1 --- platformapi/tao_vegetable/store_categary.go | 1 - platformapi/tao_vegetable/store_sku_test.go | 2 +- platformapi/tao_vegetable/store_test.go | 9 +++++---- platformapi/tao_vegetable/upload_img.go | 6 +++++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/platformapi/tao_vegetable/store_categary.go b/platformapi/tao_vegetable/store_categary.go index 5939baf2..9349efc8 100644 --- a/platformapi/tao_vegetable/store_categary.go +++ b/platformapi/tao_vegetable/store_categary.go @@ -68,7 +68,6 @@ func (a *API) AddStoreCategoryInfo(param *request.AlibabaWdkSkuCategoryAddReques // DeleteStoreCategoryInfo 删除门店分类 func (a *API) DeleteStoreCategoryInfo(param *request.AlibabaWdkSkuCategoryDeleteRequest) error { - return nil // 不支持程序删除 //globals.SugarLogger.Debugf("进入 DeleteStoreCategoryInfo") storeCategory := ability587.NewAbility587(&a.client) resp, _ := storeCategory.AlibabaWdkSkuCategoryDelete(param, a.token) diff --git a/platformapi/tao_vegetable/store_sku_test.go b/platformapi/tao_vegetable/store_sku_test.go index c3c1d4bd..d345d582 100644 --- a/platformapi/tao_vegetable/store_sku_test.go +++ b/platformapi/tao_vegetable/store_sku_test.go @@ -18,7 +18,7 @@ import ( // 上传图片 func TestUploadImg(t *testing.T) { - uploadImg(apiTao, []string{"http://image.jxc4.com/9e8e8471ba959d10166d0cf4f08ccb2d.jpg"}) + uploadImg(apiTao, []string{"http://img20.360buyimg.com/vc/jfs/t2473/147/1629369634/4242813/e73adcd0/566a65f3N8aa04ec1.jpg"}) } func TestAddStoreSku(t *testing.T) { diff --git a/platformapi/tao_vegetable/store_test.go b/platformapi/tao_vegetable/store_test.go index 791f3d90..e494146a 100644 --- a/platformapi/tao_vegetable/store_test.go +++ b/platformapi/tao_vegetable/store_test.go @@ -60,9 +60,10 @@ func TestGetStoreAllCategory(t *testing.T) { func TestAddCategory(t *testing.T) { data, err := apiTao.AddStoreCategoryInfo(&request.AlibabaWdkSkuCategoryAddRequest{Param: &domain.AlibabaWdkSkuCategoryAddCategoryDo{ - Code: utils.String2Pointer("175"), - Name: utils.String2Pointer("赠品专区"), - Leaf: utils.Bool2Point(false), + Code: utils.String2Pointer("1751"), + Name: utils.String2Pointer("特色赠品"), + Leaf: utils.Bool2Point(true), + ParentCode: utils.String2Pointer("175"), }}) globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data, false)) globals.SugarLogger.Debugf("err := %s", utils.Format4Output(err, false)) @@ -81,7 +82,7 @@ func TestDeleteCategory(t *testing.T) { } func TestDeleteCate(t *testing.T) { - err := apiTao.DeleteStoreCategoryInfo(&request.AlibabaWdkSkuCategoryDeleteRequest{Param: &domain.AlibabaWdkSkuCategoryDeleteCategoryDo{Code: utils.String2Pointer("175")}}) + err := apiTao.DeleteStoreCategoryInfo(&request.AlibabaWdkSkuCategoryDeleteRequest{Param: &domain.AlibabaWdkSkuCategoryDeleteCategoryDo{Code: utils.String2Pointer("1751")}}) fmt.Println(err) } diff --git a/platformapi/tao_vegetable/upload_img.go b/platformapi/tao_vegetable/upload_img.go index 8d921bf5..ba4a9a49 100644 --- a/platformapi/tao_vegetable/upload_img.go +++ b/platformapi/tao_vegetable/upload_img.go @@ -16,5 +16,9 @@ func (a *API) UploadImg(param *request.AlibabaWdkPictureUploadRequest) (string, return "", fmt.Errorf(*data.Result.ErrMsg) } - return *data.Result.Model.FullUrl, nil + if data.Result.Model != nil { + return *data.Result.Model.FullUrl, nil + } + + return "", fmt.Errorf("图片上传返回异常") } From 7bcf02f96f4262d3e621554c9a5d173b9540d29b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 8 Aug 2023 11:36:40 +0800 Subject: [PATCH 21/21] 1 --- platformapi/tao_vegetable/store_categary.go | 1 + platformapi/tao_vegetable/store_sku_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/platformapi/tao_vegetable/store_categary.go b/platformapi/tao_vegetable/store_categary.go index 9349efc8..1fb4e469 100644 --- a/platformapi/tao_vegetable/store_categary.go +++ b/platformapi/tao_vegetable/store_categary.go @@ -68,6 +68,7 @@ func (a *API) AddStoreCategoryInfo(param *request.AlibabaWdkSkuCategoryAddReques // DeleteStoreCategoryInfo 删除门店分类 func (a *API) DeleteStoreCategoryInfo(param *request.AlibabaWdkSkuCategoryDeleteRequest) error { + return fmt.Errorf("暂不支持删除分类") //globals.SugarLogger.Debugf("进入 DeleteStoreCategoryInfo") storeCategory := ability587.NewAbility587(&a.client) resp, _ := storeCategory.AlibabaWdkSkuCategoryDelete(param, a.token) diff --git a/platformapi/tao_vegetable/store_sku_test.go b/platformapi/tao_vegetable/store_sku_test.go index d345d582..982609e2 100644 --- a/platformapi/tao_vegetable/store_sku_test.go +++ b/platformapi/tao_vegetable/store_sku_test.go @@ -18,7 +18,7 @@ import ( // 上传图片 func TestUploadImg(t *testing.T) { - uploadImg(apiTao, []string{"http://img20.360buyimg.com/vc/jfs/t2473/147/1629369634/4242813/e73adcd0/566a65f3N8aa04ec1.jpg"}) + uploadImg(apiTao, []string{"http://img20.360buyimg.com/vc/jfs/t2473/147/1629369634/4242813/e73adcd0/566a65f3N8aa04ec1.jpg,http://img20.360buyimg.com/vc/jfs/t1/109293/32/7166/234234/5e576c17E8e493056/cd6b8ba6db7f1522.png"}) } func TestAddStoreSku(t *testing.T) {