This commit is contained in:
richboo111
2024-01-10 15:21:26 +08:00
parent d463ff640c
commit d4227f69e2

View File

@@ -2,7 +2,6 @@ package sfps
import ( import (
"bufio" "bufio"
"encoding/json"
"errors" "errors"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
@@ -471,10 +470,10 @@ func pushCallbackToGy(urlIndex string, msg interface{}) {
request *http.Request request *http.Request
param = make(map[string]interface{}) param = make(map[string]interface{})
) )
//param = changeToRaw(urlIndex, msg) param = changeToRaw(urlIndex, msg)
//globals.SugarLogger.Debugf("sfsfsf pushCallbackToGy param=%s", utils.Format4Output(param, false)) //globals.SugarLogger.Debugf("sfsfsf pushCallbackToGy param=%s", utils.Format4Output(param, false))
b, _ := json.Marshal(msg) //b, _ := json.Marshal(msg)
//sign := api.SfPsAPI.SignParam(b) //sign := api.SfPsAPI.SignParam(b)
switch urlIndex { switch urlIndex {
@@ -483,22 +482,24 @@ func pushCallbackToGy(urlIndex string, msg interface{}) {
default: default:
//fullUrl := utils.GenerateGetURL("http://callback-jxgy.jxc4.com/SFPS/SfOrder", "", map[string]interface{}{"sign": sign}) //fullUrl := utils.GenerateGetURL("http://callback-jxgy.jxc4.com/SFPS/SfOrder", "", map[string]interface{}{"sign": sign})
//request, err = http.NewRequest(http.MethodPost, fullUrl, strings.NewReader(string(b))) //request, err = http.NewRequest(http.MethodPost, fullUrl, strings.NewReader(string(b)))
request, err = http.NewRequest(http.MethodPost, "http://callback-jxgy.jxc4.com/SFPS/SfOrder", strings.NewReader(string(b))) request, err = http.NewRequest(http.MethodPost, "http://callback-jxgy.jxc4.com/SFPS/SfOrder", strings.NewReader(utils.Map2URLValues(param).Encode()))
} }
//检测request数据 //检测request数据
data, err := ioutil.ReadAll(request.Body) //data, err := ioutil.ReadAll(request.Body)
temp := make(map[string]interface{}) //temp := make(map[string]interface{})
if err = json.Unmarshal(data, &temp); err == nil { //if err = json.Unmarshal(data, &temp); err == nil {
globals.SugarLogger.Debugf("pushCallbackToGy test reqData temp=%s,err=%v", utils.Format4Output(temp, false), err) // globals.SugarLogger.Debugf("pushCallbackToGy test reqData temp=%s,err=%v", utils.Format4Output(temp, false), err)
} //}
//
if err != nil { if err != nil {
globals.SugarLogger.Debugf("pushCallbackToGy test reqData err=%v", err)
return return
} }
request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
client.Do(request) resp, err := client.Do(request)
resopp, _ := ioutil.ReadAll(resp.Body)
globals.SugarLogger.Debugf("============ %s %v", string(resopp), err)
} }
func tiktokStatusPush(order *model.Waybill, orderStatus int64, lng, lat, vendorOrgCode string) { func tiktokStatusPush(order *model.Waybill, orderStatus int64, lng, lat, vendorOrgCode string) {