This commit is contained in:
邹宗楠
2024-10-16 09:17:05 +08:00
parent a6e6222075
commit 32cde499da
28 changed files with 271 additions and 167 deletions

View File

@@ -391,8 +391,12 @@ func OnWaybillMsg(urlIndex string, msg interface{}) (resp *sfps2.CallbackRespons
order, goodsOrder := GetWaybillByStatus(urlIndex, msg)
//判断是否是果园
if goodsOrder == nil && beego.BConfig.RunMode != "jxgy" {
pushCallbackToGy(urlIndex, msg)
if goodsOrder == nil && beego.BConfig.RunMode == model.ServerTypeVegetable {
pushCallbackToGy(urlIndex, msg, model.ServerTypeFruits)
return sfps2.SuccessResponse
}
if goodsOrder == nil && beego.BConfig.RunMode == model.ServerTypeFruits {
pushCallbackToGy(urlIndex, msg, model.ServerTypePet)
return sfps2.SuccessResponse
}
//多次取消回调只取第一次
@@ -470,7 +474,7 @@ func OnWaybillMsg(urlIndex string, msg interface{}) (resp *sfps2.CallbackRespons
}
//转发到果园
func pushCallbackToGy(urlIndex string, msg interface{}) {
func pushCallbackToGy(urlIndex string, msg interface{}, serverType string) {
var (
err error
client = &http.Client{}
@@ -478,14 +482,24 @@ func pushCallbackToGy(urlIndex string, msg interface{}) {
)
b, _ := json.Marshal(msg)
switch urlIndex {
case sfps2.UrlIndexRiderException:
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)))
request, err = http.NewRequest(http.MethodPost, "http://callback-jxgy.jxc4.com/SFPS/SfOrder", strings.NewReader(string(b)))
if serverType == model.ServerTypeFruits {
switch urlIndex {
case sfps2.UrlIndexRiderException:
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)))
request, err = http.NewRequest(http.MethodPost, "http://callback-jxgy.jxc4.com/SFPS/SfOrder", strings.NewReader(string(b)))
}
} else if serverType == model.ServerTypePet {
switch urlIndex {
case sfps2.UrlIndexRiderException:
request, err = http.NewRequest(http.MethodPost, "http://callback-jxpet.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)))
request, err = http.NewRequest(http.MethodPost, "http://callback-jxpet.jxc4.com/SFPS/SfOrder", strings.NewReader(string(b)))
}
}
if err != nil {