This commit is contained in:
邹宗楠
2022-03-31 09:09:50 +08:00
parent 54d4ad2fb0
commit 9b0a2d08b6
3 changed files with 21 additions and 40 deletions

View File

@@ -145,26 +145,26 @@ func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.S
}
// 蜂鸟门店状态改变
func OnStoreStatus(msg map[string]interface{}) (retVal *fnpsapi.CallbackResponse) {
func OnStoreStatus(msg *fnpsapi.ChainstoreStatusNotify) (retVal *fnpsapi.CallbackResponse) {
return curDeliveryHandler.OnStoreStatus(msg)
}
// 修改本地门店审核状态
func (c *DeliveryHandler) OnStoreStatus(msg map[string]interface{}) (retVal *fnpsapi.CallbackResponse) {
func (c *DeliveryHandler) OnStoreStatus(msg *fnpsapi.ChainstoreStatusNotify) (retVal *fnpsapi.CallbackResponse) {
var status int = 0
if storeStatus, ok := msg["status"]; ok && storeStatus != 0 {
status = int(utils.ForceInterface2Int64(storeStatus))
if msg.Param.Status != "" {
status = int(utils.ForceInterface2Int64(msg.Param.Status))
} else {
status = int(utils.ForceInterface2Int64(msg["modify_status"]))
status = int(utils.ForceInterface2Int64(msg.Param.ModifyStatus))
}
err := partner.CurStoreManager.OnCourierStoreStatusChanged(
jxcontext.AdminCtx,
utils.Interface2String(msg["out_shop_code"]),
utils.Interface2String(msg.Param.OutShopCode),
model.VendorIDFengNiao,
getAuditStatus(status),
utils.Interface2String(msg["remark"]),
utils.Interface2String(msg.Param.Remark),
)
retVal = fnpsapi.Err2CallbackResponse(err, "mtps OnStoreStatus")
retVal = fnpsapi.Err2CallbackResponse(err, "fn ps OnStoreStatus")
return retVal
}

View File

@@ -187,16 +187,16 @@ func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInf
}
// 订单状态
func OnWaybillMsg(msg map[string]interface{}) (resp *fnpsapi.CallbackResponse) {
func OnWaybillMsg(msg *fnpsapi.OrderStatusNottify) (resp *fnpsapi.CallbackResponse) {
order := &model.Waybill{
VendorWaybillID: utils.Interface2String(msg["open_order_code"]),
VendorWaybillID2: utils.Interface2String(msg["partner_order_code"]),
VendorWaybillID: utils.Interface2String(msg.Param.PartnerOrderCode),
VendorWaybillID2: utils.Interface2String(msg.Param.OrderId),
WaybillVendorID: model.VendorIDFengNiao,
CourierName: utils.Interface2String(msg["carrier_driver_name"]),
CourierMobile: utils.Interface2String(msg["carrier_driver_phone"]),
VendorStatus: utils.Interface2String(msg["order_status"]),
StatusTime: utils.Timestamp2Time(utils.MustInterface2Int64(msg["push_time"])),
Remark: utils.Interface2String(msg["description"]),
CourierName: utils.Interface2String(msg.Param.CarrierDriverName),
CourierMobile: utils.Interface2String(msg.Param.CarrierDriverPhone),
VendorStatus: utils.Interface2String(msg.Param.OrderStatus),
StatusTime: utils.Timestamp2Time(utils.MustInterface2Int64(msg.Param.PushTime)),
Remark: utils.Interface2String(msg.Param.Description),
}
order.VendorOrderID, order.OrderVendorID = jxutils.SplitUniversalOrderID(order.VendorWaybillID2)
orderStatus, err := strconv.Atoi(order.VendorStatus)

View File

@@ -2,8 +2,6 @@ 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"
@@ -18,7 +16,7 @@ type FnController struct {
func (c *FnController) FnOrderStatus() {
if c.Ctx.Input.Method() == http.MethodPost {
fmt.Println("开始回调订单状态==========================")
msg, callbackResponse := api.FnAPI.GetChainstoreStatusNotify(c.Ctx.Request)
msg, callbackResponse := api.FnAPI.GetChainOrderStatusNotify(c.Ctx.Request)
fmt.Println("开始回调订单状态==========================msg", msg)
fmt.Println("开始回调订单状态==========================callbackResponse", callbackResponse)
if callbackResponse.Code != 1 {
@@ -28,10 +26,7 @@ func (c *FnController) FnOrderStatus() {
}
// 订单回调
if msg["callback_business_type"] != nil {
callbackResponse = fn.OnWaybillMsg(msg)
}
callbackResponse = fn.OnWaybillMsg(msg)
c.Data["json"] = callbackResponse
c.ServeJSON()
} else {
@@ -43,7 +38,7 @@ func (c *FnController) FnOrderStatus() {
func (c *FnController) FnAbnormal() {
if c.Ctx.Input.Method() == http.MethodPost {
fmt.Println("开始回调异常回调==========================")
msg, callbackResponse := api.FnAPI.GetChainstoreStatusNotify(c.Ctx.Request)
msg, callbackResponse := api.FnAPI.GetChainAbnormaltatusNotify(c.Ctx.Request)
fmt.Println("开始回调异常回调==========================msg", msg)
fmt.Println("开始回调异常回调==========================callbackResponse", callbackResponse)
if callbackResponse.Code != 1 {
@@ -52,18 +47,7 @@ func (c *FnController) FnAbnormal() {
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)
}
callbackResponse = fn.OnWaybillExceptFn(msg.Param)
c.Data["json"] = callbackResponse
c.ServeJSON()
} else {
@@ -84,10 +68,7 @@ func (c *FnController) FnStoreStatus() {
return
}
if msg["callback_business_type"] != nil {
callbackResponse = fn.OnStoreStatus(msg)
}
callbackResponse = fn.OnStoreStatus(msg)
c.Data["json"] = callbackResponse
c.ServeJSON()
} else {