修改回调

This commit is contained in:
邹宗楠
2022-04-02 09:32:50 +08:00
parent 29d28691cd
commit 60feebf242
4 changed files with 34 additions and 52 deletions

View File

@@ -12,6 +12,28 @@ type FnController struct {
web.Controller
}
// 门店回掉
func (c *FnController) FnStore() {
if c.Ctx.Input.Method() == http.MethodPost {
fmt.Println("开始回调门店回掉==========================")
msg, callbackResponse := api.FnAPI.GetChainstoreStatusNotify(c.Ctx.Request)
fmt.Println("开始回调门店回掉==========================msg", msg)
fmt.Println("开始回调门店回掉==========================callbackResponse", callbackResponse)
if callbackResponse.Code == -1 {
c.Data["code"] = callbackResponse
c.ServeJSON()
return
}
callbackResponse = fn.OnStoreStatus(msg)
c.Data["code"] = callbackResponse
c.ServeJSON()
} else {
c.Abort("404")
}
}
// 订单状态
func (c *FnController) FnOrder() {
if c.Ctx.Input.Method() == http.MethodPost {
@@ -20,14 +42,14 @@ func (c *FnController) FnOrder() {
fmt.Println("开始回调订单状态==========================msg", msg)
fmt.Println("开始回调订单状态==========================callbackResponse", callbackResponse)
if callbackResponse.Code == -1 {
c.Data["json"] = callbackResponse
c.Data["code"] = callbackResponse
c.ServeJSON()
return
}
// 订单回调
callbackResponse = fn.OnWaybillMsg(msg)
c.Data["json"] = callbackResponse
c.Data["code"] = callbackResponse
c.ServeJSON()
} else {
c.Abort("404")
@@ -48,56 +70,10 @@ func (c *FnController) FnAbnormal() {
}
callbackResponse = fn.OnWaybillExceptFn(msg.Param)
c.Data["json"] = callbackResponse
c.Data["code"] = callbackResponse
c.ServeJSON()
} else {
c.Abort("404")
}
}
// 门店回掉
func (c *FnController) FnStore() {
if c.Ctx.Input.Method() == http.MethodPost {
fmt.Println("开始回调门店回掉==========================")
msg, callbackResponse := api.FnAPI.GetChainstoreStatusNotify(c.Ctx.Request)
fmt.Println("开始回调门店回掉==========================msg", msg)
fmt.Println("开始回调门店回掉==========================callbackResponse", callbackResponse)
if callbackResponse.Code == -1 {
c.Data["json"] = callbackResponse
c.ServeJSON()
return
}
callbackResponse = fn.OnStoreStatus(msg)
c.Data["json"] = callbackResponse
c.ServeJSON()
} else {
c.Abort("404")
}
}
//
//switch msg["callback_business_type"] {
//case fnpsapi.ChainstoreStatus: // 门店状态变更回调
//callbackResponse = fn.OnStoreStatus(msg)
//break
//case fnpsapi.AbnormalStatus: // 异常报备回调
//data := &fnpsapi.AbnormalReportNotify{}
//if err := utils.Map2StructByJson(msg, data, true); err != nil {
//callbackResponse = &fnpsapi.CallbackResponse{Code: -1}
//break
//}
//callbackResponse = fn.OnWaybillExceptFn(data)
//break
//case fnpsapi.CookingFinishStatus: // 商户出餐回调
//break
//case fnpsapi.ChainstoreServiceStatus: // 门店采购服务变更回调
//break
//case fnpsapi.NoServiceStatus: // 城市屏蔽区域调整回调通知
//break
//case fnpsapi.OrderStatus: // 订单状态回调
//callbackResponse = fn.OnWaybillMsg(msg)
//break
//default:
//break
//}