This commit is contained in:
richboo111
2024-01-10 16:27:39 +08:00
parent bf27e49297
commit 6092ee22f9

View File

@@ -1,7 +1,6 @@
package sfps
import (
"bufio"
"encoding/json"
"errors"
"fmt"
@@ -380,9 +379,7 @@ func OnWaybillMsg(urlIndex string, msg interface{}) (resp *sfps2.CallbackRespons
order, goodsOrder := GetWaybillByStatus(urlIndex, msg)
//判断是否是果园
globals.SugarLogger.Debugf("sfsfsf goodsOrder=%s runMode=%s", utils.Format4Output(goodsOrder, false), beego.BConfig.RunMode)
if goodsOrder == nil && beego.BConfig.RunMode != "jxgy" {
globals.SugarLogger.Debugf("sfsfsf 我在这里")
pushCallbackToGy(urlIndex, msg)
return sfps2.SuccessResponse
}
@@ -401,10 +398,8 @@ func OnWaybillMsg(urlIndex string, msg interface{}) (resp *sfps2.CallbackRespons
sfOrder, err := api.SfPsAPI.GetOrderStatus(order.VendorWaybillID)
if err != nil {
globals.SugarLogger.Debugf("SFPS OnWaybillMsg GetOrderStatus err=%v", err)
return sfps2.Err2CallbackResponse(err)
}
globals.SugarLogger.Debugf("SFPS OnWaybillMsg sfOrder=%s", utils.Format4Output(sfOrder, false))
if order.CourierMobile == "" {
order.CourierName = sfOrder.RiderName
}
@@ -414,7 +409,6 @@ func OnWaybillMsg(urlIndex string, msg interface{}) (resp *sfps2.CallbackRespons
sfTotalPrice := utils.Float64TwoInt(sfOrder.TotalPrice)
sfActualPrice := utils.Float64TwoInt64(sfOrder.RealPayMoney)
globals.SugarLogger.Debugf("SFPS OnWaybillMsg,sfTotalPrice=%d,sfActualPrice=%d", sfTotalPrice, sfActualPrice)
store, _ := dao.GetStoreDetail(dao.GetDB(), goodsOrder.JxStoreID, goodsOrder.VendorID, goodsOrder.VendorOrgCode)
sfTotalPrice += store.FreightMarkup
@@ -469,17 +463,13 @@ func pushCallbackToGy(urlIndex string, msg interface{}) {
err error
client = &http.Client{}
request *http.Request
param = make(map[string]interface{})
)
//param = changeToRaw(urlIndex, msg)
//globals.SugarLogger.Debugf("sfsfsf pushCallbackToGy param=%s", utils.Format4Output(param, false))
globals.SugarLogger.Debugf("pushCallbackToGy msg=%s", utils.Format4Output(msg, false))
b, _ := json.Marshal(msg)
//sign := api.SfPsAPI.SignParam(b)
switch urlIndex {
case sfps2.UrlIndexRiderException:
request, err = http.NewRequest(http.MethodPost, "http://callback-jxgy.jxc4.com/SFPS/SfAbnormal", bufio.NewReader(strings.NewReader(utils.Map2URLValues(param).Encode())))
request, err = http.NewRequest(http.MethodPost, "http://callback-jxgy.jxc4.com/SFPS/SfAbnormal", strings.NewReader(string(b)))
default:
//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)))
@@ -487,10 +477,9 @@ func pushCallbackToGy(urlIndex string, msg interface{}) {
}
if err != nil {
globals.SugarLogger.Debugf("pushCallbackToGy test reqData err=%v", err)
globals.SugarLogger.Debugf("pushCallbackToGy req err=%v", err)
return
}
//request.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
request.Header.Set("Content-Type", "application/json; charset=UTF-8")
resp, err := client.Do(request)
resopp, _ := ioutil.ReadAll(resp.Body)