mtps回调优化

This commit is contained in:
gazebo
2019-10-11 09:42:28 +08:00
parent 4ea0fc4f93
commit 7946ab6207
2 changed files with 13 additions and 14 deletions

View File

@@ -12,6 +12,10 @@ import (
"git.rosy.net.cn/jx-callback/globals/api" "git.rosy.net.cn/jx-callback/globals/api"
) )
const (
fakeContactEmail = "fakeemail@163.com"
)
var ( var (
auditStatusMap = map[int]int{ auditStatusMap = map[int]int{
mtpsapi.ShopStatusAuditCreated: model.StoreAuditStatusCreated, mtpsapi.ShopStatusAuditCreated: model.StoreAuditStatusCreated,
@@ -53,6 +57,7 @@ func (c *DeliveryHandler) CreateStore(ctx *jxcontext.Context, storeDetail *dao.S
SecondCategory: mtpsapi.ShopCategoryFruitFruit, SecondCategory: mtpsapi.ShopCategoryFruitFruit,
ContactName: storeDetail.PayeeName, ContactName: storeDetail.PayeeName,
ContactPhone: storeDetail.Tel1, ContactPhone: storeDetail.Tel1,
ContactEmail: fakeContactEmail,
ShopAddress: storeDetail.Address, ShopAddress: storeDetail.Address,
ShopLng: storeDetail.Lng, ShopLng: storeDetail.Lng,
ShopLat: storeDetail.Lat, ShopLat: storeDetail.Lat,
@@ -105,7 +110,7 @@ func (c *DeliveryHandler) IsErrStoreExist(err error) bool {
func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error) { func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error) {
if globals.EnableStoreWrite { if globals.EnableStoreWrite {
err = api.MtpsAPI.PagePoiUpdate(storeDetail.VendorStoreID, storeDetail.PayeeName, storeDetail.Tel1, "fakeemail@163.com") err = api.MtpsAPI.PagePoiUpdate(storeDetail.VendorStoreID, storeDetail.PayeeName, storeDetail.Tel1, fakeContactEmail)
} }
return err return err
} }

View File

@@ -3,7 +3,6 @@ package controllers
import ( import (
"net/http" "net/http"
"git.rosy.net.cn/baseapi/platformapi/mtpsapi"
"git.rosy.net.cn/jx-callback/business/partner/delivery/mtps" "git.rosy.net.cn/jx-callback/business/partner/delivery/mtps"
"git.rosy.net.cn/jx-callback/globals/api" "git.rosy.net.cn/jx-callback/globals/api"
"github.com/astaxie/beego" "github.com/astaxie/beego"
@@ -16,19 +15,14 @@ type MtpsController struct {
func (c *MtpsController) Status() { func (c *MtpsController) Status() {
if c.Ctx.Input.Method() == http.MethodPost { if c.Ctx.Input.Method() == http.MethodPost {
var callbackResponse *mtpsapi.CallbackResponse
if c.GetString("exception_id") != "" { // 美团配送的回调设置好象有问题,配送异常也会发到这里来,作一下兼容处理 if c.GetString("exception_id") != "" { // 美团配送的回调设置好象有问题,配送异常也会发到这里来,作一下兼容处理
var obj *mtpsapi.CallbackOrderExceptionMsg c.Except()
obj, callbackResponse = api.MtpsAPI.GetOrderExceptionCallbackMsg(c.Ctx.Request) return
if callbackResponse == nil { }
callbackResponse = mtps.OnWaybillExcept(obj)
} obj, callbackResponse := api.MtpsAPI.GetOrderCallbackMsg(c.Ctx.Request)
} else { if callbackResponse == nil {
var obj *mtpsapi.CallbackOrderMsg callbackResponse = mtps.OnWaybillMsg(obj)
obj, callbackResponse = api.MtpsAPI.GetOrderCallbackMsg(c.Ctx.Request)
if callbackResponse == nil {
callbackResponse = mtps.OnWaybillMsg(obj)
}
} }
c.Data["json"] = callbackResponse c.Data["json"] = callbackResponse
c.ServeJSON() c.ServeJSON()