diff --git a/platformapi/tiktok_shop/tiktok_api/api_test.go b/platformapi/tiktok_shop/tiktok_api/api_test.go index 1d5da670..9707019e 100644 --- a/platformapi/tiktok_shop/tiktok_api/api_test.go +++ b/platformapi/tiktok_shop/tiktok_api/api_test.go @@ -22,7 +22,7 @@ func TestApi(t *testing.T) { } func TestQueryOrderDetail(t *testing.T) { - data, err := a.GetTiktokOrderDetail("4994436461423172838") + data, err := a.GetTiktokOrderDetail("4996263656479857894") globals.SugarLogger.Debugf("=====%s", utils.Format4Output(data, false)) globals.SugarLogger.Debugf("=====%s", err) } @@ -103,11 +103,11 @@ func TestOrderStatusAndPsInfo(t *testing.T) { a := NewExpress("7153997323561879075", "3517d3ea-b96b-4379-a7a4-2d9389e8ffeb", "") a.CreateToken() param := make(map[string]interface{}, 0) - param["third_carrier_order_id"] = "4995851215059621284" + param["third_carrier_order_id"] = "4996521792598113690" param["logistics_context"] = "呼叫骑手" param["opcode"] = "CALL_RIDER" - param["courier_name"] = "徐业圩" - param["courier_phone"] = "19817862055" + param["courier_name"] = "" + param["courier_phone"] = "" a.OrderStatusAndPsInfo(param) } diff --git a/platformapi/tiktok_shop/tiktok_api/order.go b/platformapi/tiktok_shop/tiktok_api/order.go index da4581f6..b6097dd0 100644 --- a/platformapi/tiktok_shop/tiktok_api/order.go +++ b/platformapi/tiktok_shop/tiktok_api/order.go @@ -318,26 +318,25 @@ func (a *API) ConfirmReceivedReturnGoods(afsOrderId int64, agree bool) { // CancelSendGoodsSuccess 商家在未发货仅退款途中发送取消发货状态 func (a *API) CancelSendGoodsSuccess() {} -// LogisticsAdd 订单发货接口 +// OrderDelivering 订单发货 // 暂时只支持整单出库,即接口调用时入参只能传父订单号。 // Tips:部分发货状态下的父订单,调此接口发货,会报错:该订单当前为“部分发货”状态,无法调用此接口 // orderId主订单id,companyCode 物流公司code,isRefundReject 是否拒绝退款申请(true表示拒绝退款,并继续发货),addressId发货地址id -func (a *API) LogisticsAdd(orderId string, companyCode string, isRefundReject bool, addressId int64) error { +func (a *API) OrderDelivering(param *order_logisticsAdd_request.OrderLogisticsAddParam) error { request := order_logisticsAdd_request.New() - request.Param = &order_logisticsAdd_request.OrderLogisticsAddParam{ - OrderId: orderId, - CompanyCode: companyCode, - IsRefundReject: isRefundReject, - AddressId: addressId, - } - data, err := request.Execute(a.accessTokenObj) - globals.SugarLogger.Debugf("订单发货接口=========%s", request.GetUrlPath()) - globals.SugarLogger.Debugf("订单发货接口:=%s", utils.Format4Output(data, false)) + request.Param = param + + result, err := request.Execute(a.accessTokenObj) + globals.SugarLogger.Debugf("OrderDelivering=========%s", request.GetUrlPath()) + globals.SugarLogger.Debugf("OrderDelivering=========%s", utils.Format4Output(result, false)) if err != nil { return err } - if data.Code != RequestSuccessCode { - return errors.New(data.SubMsg) + if result.Code == RequestSuccessRepeatedShipment { + return nil + } + if result.Code != RequestSuccessCode { + return errors.New(result.SubMsg) } return nil } @@ -616,26 +615,6 @@ func (a *API) GetCallbackOrderId(msgId string, data interface{}) (string, *Callb } } -// OrderDelivering 订单发货 -func (a *API) OrderDelivering(param *order_logisticsAdd_request.OrderLogisticsAddParam) error { - request := order_logisticsAdd_request.New() - request.Param = param - - result, err := request.Execute(a.accessTokenObj) - globals.SugarLogger.Debugf("OrderDelivering=========%s", request.GetUrlPath()) - globals.SugarLogger.Debugf("OrderDelivering=========%s", utils.Format4Output(result, false)) - if err != nil { - return err - } - if result.Code == RequestSuccessRepeatedShipment { - return nil - } - if result.Code != RequestSuccessCode { - return errors.New(result.SubMsg) - } - return nil -} - // LogisticsAddSinglePack 支持多个订单发同一个物流包裹 func (a *API) LogisticsAddSinglePack() { request := order_logisticsAddSinglePack_request.New() diff --git a/platformapi/tiktok_shop/tiktok_api/store_test.go b/platformapi/tiktok_shop/tiktok_api/store_test.go index d700da18..e60781f4 100644 --- a/platformapi/tiktok_shop/tiktok_api/store_test.go +++ b/platformapi/tiktok_shop/tiktok_api/store_test.go @@ -18,6 +18,7 @@ import ( "git.rosy.net.cn/jx-callback/globals" "strings" "testing" + "time" ) func TestCreateStore(t *testing.T) { @@ -277,10 +278,14 @@ func TestStoreUpdateFence(t *testing.T) { func TestGetWarehouseByStore(t *testing.T) { accesstoken := `{"access_token":"d590b649-0dd9-4988-a5e2-bf7e06e2f105","expires_in":1667808519,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"f57c6a55-af5f-45ca-8ade-b2282be86341","authority_id":""}` a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", accesstoken) - resp, _ := a.GetWarehouseByStore(65402632) - fmt.Println(resp[65402632][0].OutFenceIds) - //fmt.Println(resp[0][62490423].OutFenceIds[0]) - //fmt.Println(err) + resp, err := a.GetWarehouseByStore(62490423) + fmt.Println(resp) + fmt.Println(err) +} + +func TestUtilsTime2Date(t *testing.T) { + fmt.Println(utils.Time2Date(time.Now()).Add(24 * time.Hour)) + fmt.Println(time.Now().Day()) } func TestSetStorePackageFee(t *testing.T) {