From fae696dd912c8141f204c783a87c34569d02b502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 10 Oct 2023 16:26:01 +0800 Subject: [PATCH 01/14] 1 --- platformapi/tiktok_shop/tiktok_api/afs_test.go | 2 +- .../tiktok_shop/tiktok_api/sku_delete_test.go | 14 +++++++++++--- platformapi/tiktok_shop/tiktok_api/store_test.go | 12 +++--------- .../tiktok_shop/tiktok_api/transport_test.go | 2 -- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/platformapi/tiktok_shop/tiktok_api/afs_test.go b/platformapi/tiktok_shop/tiktok_api/afs_test.go index e9aa38b0..a95ae649 100644 --- a/platformapi/tiktok_shop/tiktok_api/afs_test.go +++ b/platformapi/tiktok_shop/tiktok_api/afs_test.go @@ -7,7 +7,7 @@ import ( "testing" ) -var token = `{"access_token":"719db06b-3fbf-461b-8cf2-e5ae70293cdc","expires_in":1695876413,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"8c478de3-8fbd-4535-a78c-06792b8a20a4","authority_id":""}` +var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}` var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token) diff --git a/platformapi/tiktok_shop/tiktok_api/sku_delete_test.go b/platformapi/tiktok_shop/tiktok_api/sku_delete_test.go index fddca0f6..d7db4aea 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku_delete_test.go +++ b/platformapi/tiktok_shop/tiktok_api/sku_delete_test.go @@ -18,9 +18,17 @@ func TestN2ame(t *testing.T) { } func TestGetRecommendCategory(t *testing.T) { - img, _, err := GetTiktokImgListTest(a, "668707", "", "", "http://img20.360buyimg.com/vc/jfs/t1/8979/39/8591/236012/5c0e45f3E1537c120/a66aafc95cf66977.jpg", "http://img20.360buyimg.com/vc/jfs/t1/23027/3/955/82830/5c0e45f3E0855eeae/ae65ee9555a29579.jpg") - fmt.Println(err) - data, err := a.GetRecommendCategory(strings.Split(img, "|")) + //img, _, err := GetTiktokImgListTest(a, "668707", "", "", "http://img20.360buyimg.com/vc/jfs/t1/8979/39/8591/236012/5c0e45f3E1537c120/a66aafc95cf66977.jpg", "http://img20.360buyimg.com/vc/jfs/t1/23027/3/955/82830/5c0e45f3E0855eeae/ae65ee9555a29579.jpg") + //fmt.Println(err) + img := []string{ + //"https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_f229ad3ce7a93d906a2412709e363825_sx_762890_www750-3527", + "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_7457cda4c101d05bcd2a1258b61d2ba1_sx_223234_www800-800", + //"https://p3-aio.ecombdimg.com/obj/ecom-shop-material/v1_GhxlaZ_70852585116381186630419_c55b8401b00e96e4114431a1dbd7c99c_sx_582346_www1000-1000", + } + var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}` + var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token) + + data, err := a.GetRecommendCategory(img) fmt.Println(data) fmt.Println(err) } diff --git a/platformapi/tiktok_shop/tiktok_api/store_test.go b/platformapi/tiktok_shop/tiktok_api/store_test.go index e28a17d7..14290e29 100644 --- a/platformapi/tiktok_shop/tiktok_api/store_test.go +++ b/platformapi/tiktok_shop/tiktok_api/store_test.go @@ -285,10 +285,8 @@ func TestGetWarehouseByStore(t *testing.T) { storeIDs := []int64{87542533} need := []int64{} errList := errlist.New() - var str = `{"access_token":"719db06b-3fbf-461b-8cf2-e5ae70293cdc","expires_in":1695876413,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"8c478de3-8fbd-4535-a78c-06792b8a20a4","authority_id":""}` - var apis = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", str) for _, v := range storeIDs { - resp, err := apis.GetWarehouseByStore(v) + resp, err := a.GetWarehouseByStore(v) if resp.WarehouseInfoMap[utils.Int64ToStr(v)] == nil || len(resp.WarehouseInfoMap[utils.Int64ToStr(v)][0].OutFenceIds) == 0 { need = append(need, v) } else { @@ -483,10 +481,8 @@ func TestCreateWarehouse(t *testing.T) { // 批量创建区域仓 func TestBatchCreateWarehouse(t *testing.T) { - token3 := `{"access_token":"719db06b-3fbf-461b-8cf2-e5ae70293cdc","expires_in":1695876413,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"8c478de3-8fbd-4535-a78c-06792b8a20a4","authority_id":""}` - a2 := New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token3) - data, err := a2.BatchCreateWarehouse(&warehouse_createBatch_request.WarehouseCreateBatchParam{ + data, err := a.BatchCreateWarehouse(&warehouse_createBatch_request.WarehouseCreateBatchParam{ OutWarehouseList: []warehouse_createBatch_request.OutWarehouseListItem{ { OutWarehouseId: "668841", @@ -507,9 +503,7 @@ func TestBatchCreateWarehouse(t *testing.T) { //查询四级地址全量省份信息 func TestGetProvince(t *testing.T) { - token3 := `{"access_token":"719db06b-3fbf-461b-8cf2-e5ae70293cdc","expires_in":1695876413,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"8c478de3-8fbd-4535-a78c-06792b8a20a4","authority_id":""}` - a2 := New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token3) - retVal, err := a2.GetProvince() + retVal, err := a.GetProvince() fmt.Println(utils.Format4Output(retVal, false)) fmt.Println(err) } diff --git a/platformapi/tiktok_shop/tiktok_api/transport_test.go b/platformapi/tiktok_shop/tiktok_api/transport_test.go index e919a9bb..4bb7332a 100644 --- a/platformapi/tiktok_shop/tiktok_api/transport_test.go +++ b/platformapi/tiktok_shop/tiktok_api/transport_test.go @@ -39,8 +39,6 @@ func Test(t *testing.T) { } func TestGetShipmentInfo(t *testing.T) { - var token = `{"access_token":"719db06b-3fbf-461b-8cf2-e5ae70293cdc","expires_in":1695876413,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"8c478de3-8fbd-4535-a78c-06792b8a20a4","authority_id":""}` - var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token) data, err := a.GetShipmentInfo(6922112012008166892, 0, ShipmentTypeInvoice) globals.SugarLogger.Debugf("======data := %s", utils.Format4Output(data, false)) globals.SugarLogger.Debugf("======data := %s", utils.Format4Output(err, false)) From 1f32f08835bddcc59b8b41f7abceff4bdcf7fd33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 10 Oct 2023 17:02:25 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8A=96=E9=9F=B3?= =?UTF-8?q?=E5=88=86=E7=B1=BBid=E8=8E=B7=E5=8F=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/tiktok_shop/tiktok_api/sku.go | 54 +++++++++++++++++++ .../tiktok_shop/tiktok_api/sku_delete_test.go | 13 ++--- 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/platformapi/tiktok_shop/tiktok_api/sku.go b/platformapi/tiktok_shop/tiktok_api/sku.go index bc9f745b..8df3607b 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku.go +++ b/platformapi/tiktok_shop/tiktok_api/sku.go @@ -571,6 +571,60 @@ func (a *API) GetProductAuditList(page, pageSize, status int64) ([]product_audit return result.Data.Records, result.Data.Total, nil } +// GetRecommendCategoryByName 根据名称预测商品类目,优先四级>三级>二级>1级 +func (a *API) GetRecommendCategoryByName(name string) (int64, error) { + if name == "" { + return 0, errors.New("抖音根据名称预测分类,名称不能为空") + } + request := product_GetRecommendCategory_request.New() + request.Param.Scene = "category_infer" + request.Param.Name = name + + result, err := request.Execute(a.accessTokenObj) + if err != nil { + return 0, err + } + if result.Code != RequestSuccessCode { + return 0, errors.New(result.SubMsg + ":" + result.LogId) + } + + if len(result.Data.CategoryDetails) == 0 { + return 0, errors.New("抖音根据图片获取分类,返回值为0") + } + + var firstCid int64 + var secondCid int64 + var thirdCid int64 + var fourthCid int64 + + index := len(result.Data.CategoryDetails) - 1 + if result.Data.CategoryDetails[index].CategoryDetail.FirstCid != 0 { + firstCid = result.Data.CategoryDetails[index].CategoryDetail.FirstCid + } + if result.Data.CategoryDetails[index].CategoryDetail.SecondCid != 0 { + secondCid = result.Data.CategoryDetails[index].CategoryDetail.SecondCid + } + if result.Data.CategoryDetails[index].CategoryDetail.ThirdCid != 0 { + thirdCid = result.Data.CategoryDetails[index].CategoryDetail.ThirdCid + } + if result.Data.CategoryDetails[index].CategoryDetail.FourthCid != 0 { + fourthCid = result.Data.CategoryDetails[index].CategoryDetail.FourthCid + } + if fourthCid != 0 { + return fourthCid, nil + } + if thirdCid != 0 { + return thirdCid, nil + } + if secondCid != 0 { + return secondCid, nil + } + if firstCid != 0 { + return firstCid, nil + } + return 0, errors.New("抖音获取推荐分类异常") +} + // GetRecommendCategory 根据图片预测商品类目,优先四级>三级>二级>1级 func (a *API) GetRecommendCategory(picParams []string) (int64, error) { if len(picParams) == 0 { diff --git a/platformapi/tiktok_shop/tiktok_api/sku_delete_test.go b/platformapi/tiktok_shop/tiktok_api/sku_delete_test.go index d7db4aea..6359c7d7 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku_delete_test.go +++ b/platformapi/tiktok_shop/tiktok_api/sku_delete_test.go @@ -20,15 +20,16 @@ func TestN2ame(t *testing.T) { func TestGetRecommendCategory(t *testing.T) { //img, _, err := GetTiktokImgListTest(a, "668707", "", "", "http://img20.360buyimg.com/vc/jfs/t1/8979/39/8591/236012/5c0e45f3E1537c120/a66aafc95cf66977.jpg", "http://img20.360buyimg.com/vc/jfs/t1/23027/3/955/82830/5c0e45f3E0855eeae/ae65ee9555a29579.jpg") //fmt.Println(err) - img := []string{ - //"https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_f229ad3ce7a93d906a2412709e363825_sx_762890_www750-3527", - "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_7457cda4c101d05bcd2a1258b61d2ba1_sx_223234_www800-800", - //"https://p3-aio.ecombdimg.com/obj/ecom-shop-material/v1_GhxlaZ_70852585116381186630419_c55b8401b00e96e4114431a1dbd7c99c_sx_582346_www1000-1000", - } + //img := []string{ + // //"https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_f229ad3ce7a93d906a2412709e363825_sx_762890_www750-3527", + // "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_7457cda4c101d05bcd2a1258b61d2ba1_sx_223234_www800-800", + // //"https://p3-aio.ecombdimg.com/obj/ecom-shop-material/v1_GhxlaZ_70852585116381186630419_c55b8401b00e96e4114431a1dbd7c99c_sx_582346_www1000-1000", + //} var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}` var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token) - data, err := a.GetRecommendCategory(img) + name := "广茄 " + data, err := a.GetRecommendCategoryByName(name) fmt.Println(data) fmt.Println(err) } From 973a82476d2efc5355f3f03f1edd90074edc1257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 10 Oct 2023 17:24:19 +0800 Subject: [PATCH 03/14] 1 --- platformapi/tiktok_shop/tiktok_api/sku.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platformapi/tiktok_shop/tiktok_api/sku.go b/platformapi/tiktok_shop/tiktok_api/sku.go index 8df3607b..2ebb66ff 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku.go +++ b/platformapi/tiktok_shop/tiktok_api/sku.go @@ -691,6 +691,8 @@ func (a *API) CreateSubProduct(mainProductId int64, storeId int64) (int64, error request.Param.StoreId = storeId result, err := request.Execute(a.accessTokenObj) + globals.SugarLogger.Debugf("=========result := %s",utils.Format4Output(result,false)) + globals.SugarLogger.Debugf("=========result := %s",utils.Format4Output(err,false)) if err != nil { return 0, err } From 595a2ee4642e8eca4a284b51977c5f83f92f6bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 11 Oct 2023 10:22:39 +0800 Subject: [PATCH 04/14] 1 --- platformapi/tao_vegetable/store_sku.go | 1 - .../api/product_detail/request/product_detail_request.go | 2 +- platformapi/tiktok_shop/tiktok_api/afs_test.go | 1 - platformapi/tiktok_shop/tiktok_api/sku.go | 7 +++++-- platformapi/tiktok_shop/tiktok_api/sku_test.go | 5 ++++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/platformapi/tao_vegetable/store_sku.go b/platformapi/tao_vegetable/store_sku.go index e1e3b900..cc329311 100644 --- a/platformapi/tao_vegetable/store_sku.go +++ b/platformapi/tao_vegetable/store_sku.go @@ -17,7 +17,6 @@ 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/tiktok_shop/sdk-golang/api/product_detail/request/product_detail_request.go b/platformapi/tiktok_shop/sdk-golang/api/product_detail/request/product_detail_request.go index 6dd6b737..2007f519 100644 --- a/platformapi/tiktok_shop/sdk-golang/api/product_detail/request/product_detail_request.go +++ b/platformapi/tiktok_shop/sdk-golang/api/product_detail/request/product_detail_request.go @@ -48,7 +48,7 @@ type ProductDetailParam struct { // 商品ID,抖店系统生成,店铺下唯一;长度19位。 ProductId string `json:"product_id"` // 外部商家编码,商家自定义字段 - //OutProductId string `json:"out_product_id"` + OutProductId string `json:"out_product_id"` //// true:读取草稿数据;false:读取线上数据;不传默认为false //ShowDraft string `json:"show_draft"` } diff --git a/platformapi/tiktok_shop/tiktok_api/afs_test.go b/platformapi/tiktok_shop/tiktok_api/afs_test.go index a95ae649..8cacbf70 100644 --- a/platformapi/tiktok_shop/tiktok_api/afs_test.go +++ b/platformapi/tiktok_shop/tiktok_api/afs_test.go @@ -8,7 +8,6 @@ import ( ) var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}` - var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token) // 查询售后单详情 diff --git a/platformapi/tiktok_shop/tiktok_api/sku.go b/platformapi/tiktok_shop/tiktok_api/sku.go index 2ebb66ff..7fb35163 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku.go +++ b/platformapi/tiktok_shop/tiktok_api/sku.go @@ -281,6 +281,9 @@ func (a *API) GetSkuDetail(productId, outProductId string) (*product_detail_resp if productId != "" { param.ProductId = productId } + if outProductId != "" { + param.OutProductId = outProductId + } result, err := request.Execute(a.accessTokenObj) if err != nil { @@ -691,8 +694,8 @@ func (a *API) CreateSubProduct(mainProductId int64, storeId int64) (int64, error request.Param.StoreId = storeId result, err := request.Execute(a.accessTokenObj) - globals.SugarLogger.Debugf("=========result := %s",utils.Format4Output(result,false)) - globals.SugarLogger.Debugf("=========result := %s",utils.Format4Output(err,false)) + globals.SugarLogger.Debugf("=========result := %s", utils.Format4Output(result, false)) + globals.SugarLogger.Debugf("=========result := %s", utils.Format4Output(err, false)) if err != nil { return 0, err } diff --git a/platformapi/tiktok_shop/tiktok_api/sku_test.go b/platformapi/tiktok_shop/tiktok_api/sku_test.go index cf99a62d..4dc4c3c6 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku_test.go +++ b/platformapi/tiktok_shop/tiktok_api/sku_test.go @@ -55,7 +55,10 @@ func TestGetSkuDetail(t *testing.T) { // 查询商品详情本地商品id func TestGetSkuDetailLocalId(t *testing.T) { - data, err := a.GetSkuDetail("3592382914735826936", "") + var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}` + var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token) + + data, err := a.GetSkuDetail("3592503538749683119", "") fmt.Println(err) globals.SugarLogger.Debugf("====%s", utils.Format4Output(data, false)) } From 6a59963c20c4b62fed1833af88eea4854d463081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 11 Oct 2023 17:23:24 +0800 Subject: [PATCH 05/14] 1 --- platformapi/tao_vegetable/order_delivery.go | 8 +++++--- platformapi/tao_vegetable/order_test.go | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/platformapi/tao_vegetable/order_delivery.go b/platformapi/tao_vegetable/order_delivery.go index 93760577..a6807695 100644 --- a/platformapi/tao_vegetable/order_delivery.go +++ b/platformapi/tao_vegetable/order_delivery.go @@ -6,6 +6,8 @@ import ( "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591" "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591/domain" request2 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591/request" + "git.rosy.net.cn/baseapi/utils" + "git.rosy.net.cn/jx-callback/globals" "io/ioutil" "net/http" ) @@ -27,12 +29,12 @@ func (a *API) ReaderOrderInfo(c *http.Request) (*CallbackOrder, string, error) { // QueryOrderDetail 自配送查询订单详情 func (a *API) QueryOrderDetail(req *request2.AlibabaAelophyOrderGetRequest) (*domain.AlibabaAelophyOrderGetOrderResponse, error) { - //globals.SugarLogger.Debugf("进入 QueryOrderDetail") + globals.SugarLogger.Debugf("req ===== %s", utils.Format4Output(req, false)) + globals.SugarLogger.Debugf("req ===== %s", utils.Format4Output(a, false)) client := ability591.NewAbility591(&a.client) data, _ := client.AlibabaAelophyOrderGet(req, a.token) - + globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false)) if !*data.ApiResult.Success { - //globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false)) return nil, fmt.Errorf(*data.ApiResult.ErrMsg) } diff --git a/platformapi/tao_vegetable/order_test.go b/platformapi/tao_vegetable/order_test.go index 078bfb84..4f9ef826 100644 --- a/platformapi/tao_vegetable/order_test.go +++ b/platformapi/tao_vegetable/order_test.go @@ -23,8 +23,8 @@ func TestName(t *testing.T) { } func TestGetOrderDetail(t *testing.T) { requestParam := &request591.AlibabaAelophyOrderGetRequest{OrderGetRequest: &domain591.AlibabaAelophyOrderGetOrderGetRequest{ - StoreId: utils.String2Pointer("JX101983"), - BizOrderId: utils.Int64ToPointer(5000921008118200880), + StoreId: utils.String2Pointer("JX102956"), + BizOrderId: utils.Int64ToPointer(5000947260022600875), }} data, err := apiTao.QueryOrderDetail(requestParam) globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data, false)) From ef4fc5bbb0b3f1d94861ac1f05e4e1f5d3943fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 11 Oct 2023 17:30:33 +0800 Subject: [PATCH 06/14] 1 --- platformapi/tao_vegetable/order_delivery.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/platformapi/tao_vegetable/order_delivery.go b/platformapi/tao_vegetable/order_delivery.go index a6807695..6791cebf 100644 --- a/platformapi/tao_vegetable/order_delivery.go +++ b/platformapi/tao_vegetable/order_delivery.go @@ -6,8 +6,6 @@ import ( "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591" "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591/domain" request2 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591/request" - "git.rosy.net.cn/baseapi/utils" - "git.rosy.net.cn/jx-callback/globals" "io/ioutil" "net/http" ) @@ -29,11 +27,8 @@ func (a *API) ReaderOrderInfo(c *http.Request) (*CallbackOrder, string, error) { // QueryOrderDetail 自配送查询订单详情 func (a *API) QueryOrderDetail(req *request2.AlibabaAelophyOrderGetRequest) (*domain.AlibabaAelophyOrderGetOrderResponse, error) { - globals.SugarLogger.Debugf("req ===== %s", utils.Format4Output(req, false)) - globals.SugarLogger.Debugf("req ===== %s", utils.Format4Output(a, false)) client := ability591.NewAbility591(&a.client) data, _ := client.AlibabaAelophyOrderGet(req, a.token) - globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false)) if !*data.ApiResult.Success { return nil, fmt.Errorf(*data.ApiResult.ErrMsg) } From f0a4b25baceb86ef9b122000298179d2a2f7d93b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 12 Oct 2023 11:28:27 +0800 Subject: [PATCH 07/14] 1 --- platformapi/tao_vegetable/order_test.go | 12 ++++++------ platformapi/tao_vegetable/tao_consts.go | 2 +- .../tiktok_shop/tiktok_api/settl_bill_detail_test.go | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/platformapi/tao_vegetable/order_test.go b/platformapi/tao_vegetable/order_test.go index 4f9ef826..eb7d15f3 100644 --- a/platformapi/tao_vegetable/order_test.go +++ b/platformapi/tao_vegetable/order_test.go @@ -61,12 +61,12 @@ func TestQueryAfsOrderDetail(t *testing.T) { func TestDeliveryFinishACCEPTED(t *testing.T) { param := &request591.AlibabaAelophyOrderWorkCallbackRequest{} param.WorkCallbackRequest = &domain591.AlibabaAelophyOrderWorkCallbackWorkCallbackRequest{ - StoreId: utils.String2Pointer("JX667321"), - BizOrderId: utils.Int64ToPointer(5000909465906250087), - Status: utils.String2Pointer("SIGN"), - StatusRemark: nil, - DelivererName: utils.String2Pointer("张廷"), - DelivererPhone: utils.String2Pointer("SIGN"), + StoreId: utils.String2Pointer("JX102985"), + BizOrderId: utils.Int64ToPointer(5000947518268240783), + Status: utils.String2Pointer(OrderStatusNew), + StatusRemark: nil, + //DelivererName: utils.String2Pointer("张廷"), + //DelivererPhone: utils.String2Pointer("SIGN"), WorkCallbackSubOrderInfoList: nil, DelivererCompany: nil, LogisticsNo: nil, diff --git a/platformapi/tao_vegetable/tao_consts.go b/platformapi/tao_vegetable/tao_consts.go index bd121879..7c7a878e 100644 --- a/platformapi/tao_vegetable/tao_consts.go +++ b/platformapi/tao_vegetable/tao_consts.go @@ -65,8 +65,8 @@ const MAXHandleCount = 20 // 批量处理一次最大数据量 // 订单状态通知 const ( - OrderStatusNew = "ACCEPTED" // 商户接单 OrderStatusPayFinsh = "PAID" // 订单支付完成 + OrderStatusNew = "ACCEPTED" // 商户接单 OrderStatusPickedUp = "PICKED" // 拣货完成 OrderStatusCallRider = "PACKAGED" // 打包出库(呼叫骑手,骑手到店,骑手取货) OrderStatusDelivery = "SHIPPING" // 配送中 diff --git a/platformapi/tiktok_shop/tiktok_api/settl_bill_detail_test.go b/platformapi/tiktok_shop/tiktok_api/settl_bill_detail_test.go index dabc7cfb..c06a4add 100644 --- a/platformapi/tiktok_shop/tiktok_api/settl_bill_detail_test.go +++ b/platformapi/tiktok_shop/tiktok_api/settl_bill_detail_test.go @@ -7,9 +7,12 @@ import ( ) func TestBillDetail(t *testing.T) { + var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}` + var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token) + a.GetSettleBillDetailV3(&order_getSettleBillDetailV3_request.OrderGetSettleBillDetailV3Param{ Size: 10, - OrderId: "5035210591285239695", + OrderId: "6922140885578684202", }) } From 959db37afda469f375781d2d887abf038dcf4e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 12 Oct 2023 14:06:07 +0800 Subject: [PATCH 08/14] 1 --- platformapi/ebaiapi/order.go | 8 +++++--- platformapi/ebaiapi/order_test.go | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/platformapi/ebaiapi/order.go b/platformapi/ebaiapi/order.go index 5a544937..bc8d2986 100644 --- a/platformapi/ebaiapi/order.go +++ b/platformapi/ebaiapi/order.go @@ -592,7 +592,7 @@ func (a *API) OrderDisagreeRefund(param *RefundOrderExamine) (err error) { //return err } -//售后 同意用户多次部分取消 +// 商家主动发起多次部分退 func (a *API) OrderPartRefund(orderID string, removeSkuList []*RefundSku) (err error) { //return a.EbaiRefundOrder(param) @@ -603,7 +603,7 @@ func (a *API) OrderPartRefund(orderID string, removeSkuList []*RefundSku) (err e return err } -//售后 同意用户多次部分取消 +// 用户多次退商家同意 func (a *API) OrderAgreePartRefund(param *RefundOrderExamine) (err error) { return a.EbaiRefundOrder(param) @@ -671,7 +671,9 @@ func (a *API) GetReverseOrder(orderId string) ([]interface{}, error) { if err != nil { return nil, err } - + if len(refundOrder.Data.(map[string]interface{})["reverse_order_list"].([]interface{})[0].(map[string]interface{})) == 0 { + return nil, nil + } return refundOrder.Data.(map[string]interface{})["reverse_order_list"].([]interface{})[0].(map[string]interface{})["sub_reverse_order_list"].([]interface{}), nil } diff --git a/platformapi/ebaiapi/order_test.go b/platformapi/ebaiapi/order_test.go index 8db7f303..24666e65 100644 --- a/platformapi/ebaiapi/order_test.go +++ b/platformapi/ebaiapi/order_test.go @@ -23,14 +23,14 @@ func TestOrderGet(t *testing.T) { func TestOrderAgreePartRefund(t *testing.T) { param := &RefundOrderExamine{ - OrderId: "4015750049354953219", + OrderId: "4003000128728616633", IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), ActionType: RefundTypeAgree, ReasonCode: "", ReasonRemarks: "", } refundProductList := make([]*RefundProductList, 0, 0) - date, _ := api.GetReverseOrder("4035480124822912660") + date, _ := api.GetReverseOrder("4003000128728616633") for _, v := range date { v2 := v.(map[string]interface{}) refundProduct := &RefundProductList{ From f050d3055d6f834d8681c388352d6e39e1021ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 12 Oct 2023 14:30:37 +0800 Subject: [PATCH 09/14] 1 --- platformapi/mtwmapi/retail.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platformapi/mtwmapi/retail.go b/platformapi/mtwmapi/retail.go index 0fdfeec2..ec676df0 100644 --- a/platformapi/mtwmapi/retail.go +++ b/platformapi/mtwmapi/retail.go @@ -291,7 +291,6 @@ func (a *API) RetailInitData(trackInfo, poiCode, foodCode string, params map[str } func (a *API) RetailBatchInitData(trackInfo, poiCode string, foodDataList []map[string]interface{}) (failedFoodList []*AppFoodResult, err error) { - globals.SugarLogger.Debugf("foodDataList :%s", utils.Format4Output(foodDataList, false)) result, err := a.AccessAPI2("retail/batchinitdata", false, map[string]interface{}{ KeyAppPoiCode: poiCode, "food_data": string(utils.MustMarshal(foodDataList)), @@ -300,7 +299,7 @@ func (a *API) RetailBatchInitData(trackInfo, poiCode string, foodDataList []map[ failedFoodList, err = handleRetailBatchResult(result) } globals.SugarLogger.Debugf("result :%s", utils.Format4Output(result, false)) - globals.SugarLogger.Debugf("err :%s", utils.Format4Output(err, false)) + globals.SugarLogger.Debugf("err :%v", err) return failedFoodList, err } From 12f87bccc7af789524c645dcf70e04de2a7400e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 12 Oct 2023 14:58:46 +0800 Subject: [PATCH 10/14] 1 --- platformapi/mtwmapi/retail.go | 1 + 1 file changed, 1 insertion(+) diff --git a/platformapi/mtwmapi/retail.go b/platformapi/mtwmapi/retail.go index ec676df0..673d02b7 100644 --- a/platformapi/mtwmapi/retail.go +++ b/platformapi/mtwmapi/retail.go @@ -291,6 +291,7 @@ func (a *API) RetailInitData(trackInfo, poiCode, foodCode string, params map[str } func (a *API) RetailBatchInitData(trackInfo, poiCode string, foodDataList []map[string]interface{}) (failedFoodList []*AppFoodResult, err error) { + globals.SugarLogger.Debugf("foodDataList ============ %s", utils.Format4Output(foodDataList, false)) result, err := a.AccessAPI2("retail/batchinitdata", false, map[string]interface{}{ KeyAppPoiCode: poiCode, "food_data": string(utils.MustMarshal(foodDataList)), From 16dc42708e7c3aae738f460ad385b79f4e42607d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 12 Oct 2023 15:30:41 +0800 Subject: [PATCH 11/14] 1 --- platformapi/mtwmapi/retail.go | 1 - platformapi/tao_vegetable/api_model.go | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/platformapi/mtwmapi/retail.go b/platformapi/mtwmapi/retail.go index 673d02b7..ec676df0 100644 --- a/platformapi/mtwmapi/retail.go +++ b/platformapi/mtwmapi/retail.go @@ -291,7 +291,6 @@ func (a *API) RetailInitData(trackInfo, poiCode, foodCode string, params map[str } func (a *API) RetailBatchInitData(trackInfo, poiCode string, foodDataList []map[string]interface{}) (failedFoodList []*AppFoodResult, err error) { - globals.SugarLogger.Debugf("foodDataList ============ %s", utils.Format4Output(foodDataList, false)) result, err := a.AccessAPI2("retail/batchinitdata", false, map[string]interface{}{ KeyAppPoiCode: poiCode, "food_data": string(utils.MustMarshal(foodDataList)), diff --git a/platformapi/tao_vegetable/api_model.go b/platformapi/tao_vegetable/api_model.go index a44ceb9b..52f824af 100644 --- a/platformapi/tao_vegetable/api_model.go +++ b/platformapi/tao_vegetable/api_model.go @@ -62,3 +62,19 @@ func CallBackResultSign(err error) *CallBackResult { ErrMsg: err.Error(), } } + +// CallBackResultOnSaleCancel 售中取消允许开关 +func CallBackResultOnSaleCancel(err error) *CallBackResult { + if err == nil { + return &CallBackResult{ + Success: true, + ErrCode: "SUCCESS", + ErrMsg: "成功", + } + } + return &CallBackResult{ + Success: false, + ErrCode: "NOT_SUPPORT_INSALE_CANCEL", + ErrMsg: "不支持售中取消。", + } +} From c09faee5746a790a6948ac185097f2e2c10b9591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 12 Oct 2023 17:14:58 +0800 Subject: [PATCH 12/14] 1 --- platformapi/mtwmapi/comment.go | 7 +++++++ platformapi/mtwmapi/comment_test.go | 2 +- platformapi/mtwmapi/mtwmapi_test.go | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/platformapi/mtwmapi/comment.go b/platformapi/mtwmapi/comment.go index 14b877ea..08edf344 100644 --- a/platformapi/mtwmapi/comment.go +++ b/platformapi/mtwmapi/comment.go @@ -1,6 +1,7 @@ package mtwmapi import ( + "git.rosy.net.cn/jx-callback/globals" "math" "strings" @@ -61,6 +62,12 @@ func (a *API) CommentQuery(poiCode string, startDateStr, endDateStr string, offs params["pageoffset"] = offset params["pagesize"] = limit result, err := a.AccessAPI("comment/query", true, params) + if poiCode == "18805464" { + globals.SugarLogger.Debugf("param :==== %s", utils.Format4Output(params, false)) + globals.SugarLogger.Debugf("result :==== %s", utils.Format4Output(result, false)) + globals.SugarLogger.Debugf("err :==== %v", err) + globals.SugarLogger.Debugf("token :==== %s", a.token) + } if err != nil { return nil, err } diff --git a/platformapi/mtwmapi/comment_test.go b/platformapi/mtwmapi/comment_test.go index 993d71c1..e2bc1ddd 100644 --- a/platformapi/mtwmapi/comment_test.go +++ b/platformapi/mtwmapi/comment_test.go @@ -8,7 +8,7 @@ import ( ) func TestCommentQuery(t *testing.T) { - result, err := api.CommentQuery("18026738", "20230711", "20230717", 0, 0, CommentReplyStatusNotReplied) + result, err := api.CommentQuery("18805464", "20231009", "20231011", 0, 0, CommentReplyStatusNotReplied) if err != nil { t.Fatal(err) } diff --git a/platformapi/mtwmapi/mtwmapi_test.go b/platformapi/mtwmapi/mtwmapi_test.go index 235cfc76..c0821dfd 100644 --- a/platformapi/mtwmapi/mtwmapi_test.go +++ b/platformapi/mtwmapi/mtwmapi_test.go @@ -23,10 +23,10 @@ func init() { //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_rfAD6OxSVxkTeCO1XmNCZg") //token_n4TwqCntWWuvQwAawzxC0w //api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_r36FEse6_ywebQI65FNNWA") //token_n4TwqCntWWuvQwAawzxC0w cookieStr := ` acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1; From c8ca946a9bdf44537fb79e63bb5e7d8c4628189a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 12 Oct 2023 17:35:49 +0800 Subject: [PATCH 13/14] 1 --- platformapi/mtwmapi/comment.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/platformapi/mtwmapi/comment.go b/platformapi/mtwmapi/comment.go index 08edf344..d534a57f 100644 --- a/platformapi/mtwmapi/comment.go +++ b/platformapi/mtwmapi/comment.go @@ -1,7 +1,6 @@ package mtwmapi import ( - "git.rosy.net.cn/jx-callback/globals" "math" "strings" @@ -39,6 +38,7 @@ type OrderComment struct { // 根据门店id批量查询评价信息(新版) // http://developer.waimai.meituan.com/home/docDetail/191 func (a *API) CommentQuery(poiCode string, startDateStr, endDateStr string, offset, limit int, replyStatus int) (commentList []*OrderComment, err error) { + nowApi := a // 使用该变量缓存当前API的token,由于使用地址,导致其他变量修改了当前变量的token数据较大时出现异常 params := map[string]interface{}{ KeyAppPoiCode: poiCode, "start_time": startDateStr, @@ -61,13 +61,7 @@ func (a *API) CommentQuery(poiCode string, startDateStr, endDateStr string, offs } params["pageoffset"] = offset params["pagesize"] = limit - result, err := a.AccessAPI("comment/query", true, params) - if poiCode == "18805464" { - globals.SugarLogger.Debugf("param :==== %s", utils.Format4Output(params, false)) - globals.SugarLogger.Debugf("result :==== %s", utils.Format4Output(result, false)) - globals.SugarLogger.Debugf("err :==== %v", err) - globals.SugarLogger.Debugf("token :==== %s", a.token) - } + result, err := nowApi.AccessAPI("comment/query", true, params) if err != nil { return nil, err } From e8d21ef54fc3fe8071edda7badacd52719bf1c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 12 Oct 2023 17:50:34 +0800 Subject: [PATCH 14/14] 1 --- platformapi/mtwmapi/comment.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/platformapi/mtwmapi/comment.go b/platformapi/mtwmapi/comment.go index d534a57f..f6c4539b 100644 --- a/platformapi/mtwmapi/comment.go +++ b/platformapi/mtwmapi/comment.go @@ -38,7 +38,6 @@ type OrderComment struct { // 根据门店id批量查询评价信息(新版) // http://developer.waimai.meituan.com/home/docDetail/191 func (a *API) CommentQuery(poiCode string, startDateStr, endDateStr string, offset, limit int, replyStatus int) (commentList []*OrderComment, err error) { - nowApi := a // 使用该变量缓存当前API的token,由于使用地址,导致其他变量修改了当前变量的token数据较大时出现异常 params := map[string]interface{}{ KeyAppPoiCode: poiCode, "start_time": startDateStr, @@ -61,14 +60,14 @@ func (a *API) CommentQuery(poiCode string, startDateStr, endDateStr string, offs } params["pageoffset"] = offset params["pagesize"] = limit - result, err := nowApi.AccessAPI("comment/query", true, params) + result, err := a.AccessAPI("comment/query", true, params) if err != nil { - return nil, err + break } var batchCommentList []*OrderComment err = utils.Map2StructByJson(result, &batchCommentList, false) if err != nil { - return nil, err + break } for _, comment := range batchCommentList { if comment.CommentLables != "" {