This commit is contained in:
邹宗楠
2024-12-13 17:07:18 +08:00
parent f7e5831707
commit fae62cf5b6
2 changed files with 36 additions and 48 deletions

View File

@@ -1,13 +1,8 @@
package controllers
import (
"fmt"
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/globals"
"net/http"
"strings"
@@ -15,7 +10,6 @@ import (
"git.rosy.net.cn/jx-callback/business/partner/purchase/ebai"
"git.rosy.net.cn/jx-callback/globals/api"
"github.com/astaxie/beego/server/web"
beego "github.com/astaxie/beego/server/web"
)
type EbaiController struct {
@@ -28,23 +22,23 @@ func (c *EbaiController) Msg() {
if callbackResponse == nil {
vendorStoreId := obj.Body["platform_shop_id"].(string)
if vendorStoreId != "" {
storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreId, model.VendorIDEBAI, "")
if storeDetail == nil {
globals.SugarLogger.Debugf("-----饿百订单非菜市消息推送-%s", utils.Format4Output(obj, false))
switch beego.BConfig.RunMode {
case model.ServerTypeVegetable:
callbackResponse = c.EBaiMsgPush2FruitsOrPet(model.ServerTypeFruits, utils.Struct2Map(obj, "", false))
case model.ServerTypeFruits:
callbackResponse = c.EBaiMsgPush2FruitsOrPet(model.ServerTypePet, utils.Struct2Map(obj, "", false))
case model.ServerTypePet:
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "47B1E94E8D2411EFB666525400E86DC0", "饿了么菜市推果园,果园退超市未找到门店", fmt.Sprintf("cmd:%s,storeId:%s", obj.Cmd, vendorStoreId))
callbackResponse = api.EbaiAPI.Err2CallbackResponse(ebaiapi.GetCmd(c.Ctx.Request), nil, nil) // api.EbaiAPI.Err2CallbackResponse(ebaiapi.GetCmd(c.Ctx.Request), fmt.Errorf("饿了么菜市推果园,果园退超市未找到门店cmd:%s,storeId:%s", obj.Cmd, vendorStoreId), nil)
return
}
c.Data["json"] = callbackResponse
c.ServeJSON()
return
}
//storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreId, model.VendorIDEBAI, "")
//if storeDetail == nil {
// globals.SugarLogger.Debugf("-----饿百订单非菜市消息推送-%s", utils.Format4Output(obj, false))
// switch beego.BConfig.RunMode {
// case model.ServerTypeVegetable:
// callbackResponse = c.EBaiMsgPush2FruitsOrPet(model.ServerTypeFruits, utils.Struct2Map(obj, "", false))
// case model.ServerTypeFruits:
// callbackResponse = c.EBaiMsgPush2FruitsOrPet(model.ServerTypePet, utils.Struct2Map(obj, "", false))
// case model.ServerTypePet:
// ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "47B1E94E8D2411EFB666525400E86DC0", "饿了么菜市推果园,果园退超市未找到门店", fmt.Sprintf("cmd:%s,storeId:%s", obj.Cmd, vendorStoreId))
// callbackResponse = api.EbaiAPI.Err2CallbackResponse(ebaiapi.GetCmd(c.Ctx.Request), nil, nil) // api.EbaiAPI.Err2CallbackResponse(ebaiapi.GetCmd(c.Ctx.Request), fmt.Errorf("饿了么菜市推果园,果园退超市未找到门店cmd:%s,storeId:%s", obj.Cmd, vendorStoreId), nil)
// return
// }
// c.Data["json"] = callbackResponse
// c.ServeJSON()
// return
//}
}
callbackResponse = ebai.OnCallbackMsg(obj)
}

View File

@@ -2,15 +2,9 @@ package controllers
import (
"encoding/json"
"fmt"
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/globals/api"
"github.com/astaxie/beego/server/web"
"net/http"
@@ -35,25 +29,25 @@ func (c *MtwmController) onCallbackMsg(msgType string) {
json.Unmarshal([]byte(msg.FormData.Get("pick_up_data")), &finishedPickup)
vendorStoreId = finishedPickup.AppPoiCode
}
if vendorStoreId != "" {
storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreId, model.VendorIDMTWM, "")
if storeDetail == nil {
globals.SugarLogger.Debugf("-----美团订单非菜市消息推送-%s", utils.Format4Output(msg, false))
switch web.BConfig.RunMode {
case model.ServerTypeVegetable:
callbackResponse = pushMTWMOrder2GY(msg.FormData, msgType, model.ServerTypeFruits)
case model.ServerTypeFruits:
callbackResponse = pushMTWMOrder2GY(msg.FormData, msgType, model.ServerTypePet)
case model.ServerTypePet:
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "47B1E94E8D2411EFB666525400E86DC0", "饿了么菜市推果园,果园退超市未找到门店", fmt.Sprintf("cmd:%s,storeId:%s", msgType, vendorStoreId))
callbackResponse = mtwmapi.Err2CallbackResponse(nil, "") // mtwmapi.Err2CallbackResponse(fmt.Errorf("美团菜市推果园,果园退超市未找到门店cmd:%s,storeId:%s", msgType, vendorStoreId), "")
return
}
c.Data["json"] = callbackResponse
c.ServeJSON()
return
}
}
//if vendorStoreId != "" {
// storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreId, model.VendorIDMTWM, "")
// if storeDetail == nil {
// globals.SugarLogger.Debugf("-----美团订单非菜市消息推送-%s", utils.Format4Output(msg, false))
// switch web.BConfig.RunMode {
// case model.ServerTypeVegetable:
// callbackResponse = pushMTWMOrder2GY(msg.FormData, msgType, model.ServerTypeFruits)
// case model.ServerTypeFruits:
// callbackResponse = pushMTWMOrder2GY(msg.FormData, msgType, model.ServerTypePet)
// case model.ServerTypePet:
// ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "47B1E94E8D2411EFB666525400E86DC0", "饿了么菜市推果园,果园退超市未找到门店", fmt.Sprintf("cmd:%s,storeId:%s", msgType, vendorStoreId))
// callbackResponse = mtwmapi.Err2CallbackResponse(nil, "") // mtwmapi.Err2CallbackResponse(fmt.Errorf("美团菜市推果园,果园退超市未找到门店cmd:%s,storeId:%s", msgType, vendorStoreId), "")
// return
// }
// c.Data["json"] = callbackResponse
// c.ServeJSON()
// return
// }
//}
callbackResponse = mtwm.OnCallbackMsg(msg, msgType)
if callbackResponse == nil {