蜂鸟回到
This commit is contained in:
@@ -3,48 +3,120 @@ package controllers
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/fnpsapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/delivery/fn"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"github.com/astaxie/beego/server/web"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type FnController struct {
|
||||
web.Controller
|
||||
}
|
||||
|
||||
func (c *FnController) Msg() {
|
||||
//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 {
|
||||
// 订单状态
|
||||
func (c *FnController) FnOrderStatus() {
|
||||
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
|
||||
}
|
||||
|
||||
// 订单回调
|
||||
if msg["callback_business_type"] != nil {
|
||||
callbackResponse = fn.OnWaybillMsg(msg)
|
||||
}
|
||||
|
||||
c.Data["json"] = callbackResponse
|
||||
c.ServeJSON()
|
||||
return
|
||||
} else {
|
||||
c.Abort("404")
|
||||
}
|
||||
|
||||
switch msg["callback_business_type"] {
|
||||
case fnpsapi.ChainstoreStatus: // 门店状态变更回调
|
||||
callbackResponse = fn.OnStoreStatus(msg)
|
||||
break
|
||||
case fnpsapi.AbnormalStatus: // 异常报备回调
|
||||
case fnpsapi.CookingFinishStatus: // 商户出餐回调
|
||||
break
|
||||
case fnpsapi.ChainstoreServiceStatus: // 门店采购服务变更回调
|
||||
break
|
||||
case fnpsapi.NoServiceStatus: // 城市屏蔽区域调整回调通知
|
||||
break
|
||||
case fnpsapi.OrderStatus: // 订单状态回调
|
||||
fn.OnWaybillMsg(msg)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
c.Data["json"] = callbackResponse
|
||||
c.ServeJSON()
|
||||
//} else {
|
||||
c.Abort("404")
|
||||
//}
|
||||
}
|
||||
|
||||
// 异常回调
|
||||
func (c *FnController) FnAbnormal() {
|
||||
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
|
||||
}
|
||||
|
||||
// 订单回调
|
||||
if msg["callback_business_type"] != nil {
|
||||
data := &fnpsapi.AbnormalReportNotify{}
|
||||
if err := utils.Map2StructByJson(msg, data, true); err != nil {
|
||||
callbackResponse = &fnpsapi.CallbackResponse{Code: -1}
|
||||
c.Data["json"] = callbackResponse
|
||||
c.ServeJSON()
|
||||
return
|
||||
}
|
||||
callbackResponse = fn.OnWaybillExceptFn(data)
|
||||
}
|
||||
|
||||
c.Data["json"] = callbackResponse
|
||||
c.ServeJSON()
|
||||
} else {
|
||||
c.Abort("404")
|
||||
}
|
||||
}
|
||||
|
||||
// 门店回掉
|
||||
func (c *FnController) FnStoreStatus() {
|
||||
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
|
||||
}
|
||||
|
||||
if msg["callback_business_type"] != nil {
|
||||
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
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user