This commit is contained in:
邹宗楠
2023-11-10 10:58:04 +08:00
parent df5e39d8b2
commit 7ed1aa66e9
5 changed files with 30 additions and 21 deletions

View File

@@ -8,10 +8,10 @@ import (
)
// 京西速食(蔬菜)
//var token1 = `{"access_token":"4bbc6923-8456-4a60-9cc9-9b07bea20810","expires_in":1699490747,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"b5f5094f-1c47-44ee-8149-88cdd3906230","authority_id":""}`
var token1 = `{"access_token":"624d864c-7750-4248-aecf-ac3f75b9b58e","expires_in":1700092125,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"70f8ffd2-7fe7-44f2-983f-d9db650b9fdb","authority_id":""}`
// 美好菜市
var token1 = `{"access_token":"9a315a03-c737-4a82-ae52-c9a6ce827007","expires_in":1699490747,"scope":"SCOPE","shop_id":68032645,"shop_name":"美好菜市","refresh_token":"8334c006-5301-4d25-911b-4d8cc7b70ebb","authority_id":""}`
//var token1 = `{"access_token":"9a315a03-c737-4a82-ae52-c9a6ce827007","expires_in":1699490747,"scope":"SCOPE","shop_id":68032645,"shop_name":"美好菜市","refresh_token":"8334c006-5301-4d25-911b-4d8cc7b70ebb","authority_id":""}`
// 京西到家(商超)
//var token2 = `{"access_token":"7e3853fa-24d4-4649-938b-46947da04c92","expires_in":1698887957,"scope":"SCOPE","shop_id":68023619,"shop_name":"京西到家","refresh_token":"1dd634e9-9f9e-459b-a770-341fb64e4f88","authority_id":""}`

View File

@@ -20,7 +20,7 @@ func TestApi(t *testing.T) {
}
func TestQueryOrderDetail(t *testing.T) {
data, err := a.GetTiktokOrderDetail("6917547162766021688")
data, err := a.GetTiktokOrderDetail("6923516654669862544")
globals.SugarLogger.Debugf("=====%s", utils.Format4Output(data, false))
globals.SugarLogger.Debugf("=====%s", err)
}
@@ -81,16 +81,23 @@ func TestApplyMarketAfterSale(t *testing.T) {
func TestOrderStatusAndPsInfo(t *testing.T) {
//appKey := `7152420904331429407` // 暂时定死
//appSecret := `cc7ba367-2394-4cbb-81c6-26f0e929d1c6` //暂时定死
token := `{"access_token":"4a543151-f8fd-43d5-9c34-d19fe11fc51c","expires_in":1694069036,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"5a2aaca1-42f7-4b83-9358-8ed5d1d4bcd6","authority_id":""}`
a2 := NewExpress("7152420904331429407", "cc7ba367-2394-4cbb-81c6-26f0e929d1c6", token)
a2.CreateToken()
param := make(map[string]interface{}, 0)
param["third_carrier_order_id"] = "6921428072500696298"
param["logistics_context"] = "JIEDAN"
param["opcode"] = "DELIVERED"
param["courier_name"] = "刘磊"
param["courier_phone"] = "18981810340"
a2.OrderStatusAndPsInfoNew(param)
//token := `{"access_token":"4a543151-f8fd-43d5-9c34-d19fe11fc51c","expires_in":1694069036,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"5a2aaca1-42f7-4b83-9358-8ed5d1d4bcd6","authority_id":""}`
//a2 := NewExpress("7152420904331429407", "cc7ba367-2394-4cbb-81c6-26f0e929d1c6", token)
//a2.CreateToken()
riderInfo := &utils.RiderInfo{
OrderId: "6923516654669862544",
ThirdCarrierOrderId: "6923516654669862544",
CourierName: "刘磊",
CourierPhone: "18981810340",
LogisticsProviderCode: utils.MyselfPsCode,
LogisticsStatus: 0,
LogisticsContext: "商家自配送,已送达",
Latitude: "103.94463969732",
Longitude: "30.620374717106",
OpCode: TiktokLogisticsDELIVERED,
}
a.OrderStatusAndPsInfoNew(utils.Struct2MapByJson(riderInfo))
}
//

View File

@@ -169,7 +169,9 @@ func (a *APIExpress) OrderStatusAndPsInfoOld(param map[string]interface{}) error
// OrderStatusAndPsInfoNew 三方配送同步骑手位置信息(新版本的运力回传)
// 抖音物流信息和抖音小时达完全区分开(这边的appKey和APPSecret完全不同于小时达)
func (a *APIExpress) OrderStatusAndPsInfoNew(param map[string]interface{}) error {
// 新版本舍弃了物流链接平台的 appKey
//func (a *APIExpress) OrderStatusAndPsInfoNew(param map[string]interface{}) error {
func (a *API) OrderStatusAndPsInfoNew(param map[string]interface{}) error {
// 组合参数
request := instantShopping_notifyDeliveryStatus_request.New()
request.Param = &instantShopping_notifyDeliveryStatus_request.InstantShoppingNotifyDeliveryStatusParam{
@@ -232,11 +234,11 @@ func (a *APIExpress) OrderStatusAndPsInfoNew(param map[string]interface{}) error
request.Param.CancelCode = utils.Int64ToPointer(200) // 其他原因
request.Param.CancelReason = utils.String2Pointer("骑手未能到店,更换骑手") // 其他原因
}
if a.accessTokenObj == nil || a.accessTokenObj.CreateTokenData.AccessToken == "" {
a.CreateToken()
} else if a.expiresIn < time.Now().Unix() {
a.RefreshToken()
}
//if a.accessTokenObj == nil || a.accessTokenObj.CreateTokenData.AccessToken == "" {
// a.CreateToken()
//} else if a.expiresIn < time.Now().Unix() {
// a.RefreshToken()
//}
result, err := request.Execute(a.accessTokenObj)
if err != nil {

View File

@@ -8,7 +8,7 @@ import (
)
func TestBillDetail(t *testing.T) {
orderDetail, err := a.GetTiktokOrderDetail("6922140885578684202")
orderDetail, err := a.GetTiktokOrderDetail("6923379475577116595")
if err != nil {
fmt.Println(err)
}

View File

@@ -21,7 +21,7 @@ func TestCancelWaybill(t *testing.T) {
}
func TestGetShipmentInfo(t *testing.T) {
data, err := a.GetShipmentInfo(6923304804114109976, 0, ShipmentTypeInvoice)
data, err := a.GetShipmentInfo(6923516654669862544, 0, ShipmentTypeInvoice)
globals.SugarLogger.Debugf("======data := %s", utils.Format4Output(data, false))
globals.SugarLogger.Debugf("======data := %s", utils.Format4Output(err, false))
}