This commit is contained in:
richboo111
2023-05-23 09:36:17 +08:00
parent d72d5dc75d
commit 0d41d6e46b
9 changed files with 466 additions and 21 deletions

View File

@@ -0,0 +1,49 @@
package controllers
import (
"net/http"
"git.rosy.net.cn/jx-callback/business/partner/delivery/sfps"
"git.rosy.net.cn/jx-callback/globals/api"
"github.com/astaxie/beego/server/web"
)
type SFPSController struct {
web.Controller
}
func (c *SFPSController) SfOrder() {
if c.Ctx.Input.Method() == http.MethodPost {
msg, callbackResponse := api.SfPsAPI.GetRiderStatusCallback(c.Ctx.Request)
if callbackResponse.ErrorCode == -1 {
c.Data["error_code"] = -1
c.ServeJSON()
return
}
// 订单回调
callbackResponse = sfps.OnWaybillMsg(msg)
c.Data["error_code"] = callbackResponse
c.ServeJSON()
} else {
c.Abort("404")
}
}
// SfAbnormal 异常回调
func (c *FnController) SfAbnormal() {
if c.Ctx.Input.Method() == http.MethodPost {
msg, callbackResponse := api.SfPsAPI.GetRiderExceptionCallback(c.Ctx.Request)
if callbackResponse.ErrorCode == -1 {
c.Data["error_code"] = -1
c.ServeJSON()
return
}
callbackResponse = sfps.OnWaybillExceptSF(msg)
c.Data["error_code"] = callbackResponse
c.ServeJSON()
} else {
c.Abort("404")
}
}