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"
)
const (
fakeContactEmail = "fakeemail@163.com"
)
var (
auditStatusMap = map[int]int{
mtpsapi.ShopStatusAuditCreated: model.StoreAuditStatusCreated,
@@ -53,6 +57,7 @@ func (c *DeliveryHandler) CreateStore(ctx *jxcontext.Context, storeDetail *dao.S
SecondCategory: mtpsapi.ShopCategoryFruitFruit,
ContactName: storeDetail.PayeeName,
ContactPhone: storeDetail.Tel1,
ContactEmail: fakeContactEmail,
ShopAddress: storeDetail.Address,
ShopLng: storeDetail.Lng,
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) {
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
}

View File

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