This commit is contained in:
邹宗楠
2025-01-06 17:44:39 +08:00
parent 99f91b24d3
commit 991e456db2
2 changed files with 38 additions and 41 deletions

View File

@@ -4,8 +4,6 @@ import (
"encoding/json" "encoding/json"
"git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/globals"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"strings" "strings"
@@ -24,26 +22,26 @@ func (c *EbaiController) Msg() {
if c.Ctx.Input.Method() == http.MethodPost { if c.Ctx.Input.Method() == http.MethodPost {
obj, callbackResponse := api.EbaiAPI.GetCallbackMsg(c.Ctx.Request) obj, callbackResponse := api.EbaiAPI.GetCallbackMsg(c.Ctx.Request)
if callbackResponse == nil { if callbackResponse == nil {
vendorStoreId, _ := utils.TryInterface2Int64(obj.Body["platform_shop_id"]) //vendorStoreId, _ := utils.TryInterface2Int64(obj.Body["platform_shop_id"])
if vendorStoreId != 0 { //if vendorStoreId != 0 {
storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), utils.Int64ToStr(vendorStoreId), model.VendorIDEBAI, "") // storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), utils.Int64ToStr(vendorStoreId), model.VendorIDEBAI, "")
if storeDetail == nil { // if storeDetail == nil {
globals.SugarLogger.Debugf("-----饿百订单非菜市消息推送-%s", utils.Format4Output(obj, false)) // globals.SugarLogger.Debugf("-----饿百订单非菜市消息推送-%s", utils.Format4Output(obj, false))
switch web.BConfig.RunMode { // switch web.BConfig.RunMode {
case model.ServerTypeVegetable: // case model.ServerTypeVegetable:
callbackResponse = c.EBaiMsgPush2FruitsOrPet(model.ServerTypeFruits, utils.Struct2Map(obj, "", false)) // callbackResponse = c.EBaiMsgPush2FruitsOrPet(model.ServerTypeFruits, utils.Struct2Map(obj, "", false))
case model.ServerTypeFruits: // case model.ServerTypeFruits:
callbackResponse = c.EBaiMsgPush2FruitsOrPet(model.ServerTypePet, utils.Struct2Map(obj, "", false)) // callbackResponse = c.EBaiMsgPush2FruitsOrPet(model.ServerTypePet, utils.Struct2Map(obj, "", false))
case model.ServerTypePet: // case model.ServerTypePet:
//ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "47B1E94E8D2411EFB666525400E86DC0", "饿了么菜市推果园,果园退超市未找到门店", fmt.Sprintf("饿了么菜市推果园cmd:%s,storeId:%s", obj.Cmd, vendorStoreId)) // //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) // 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 // return
} // }
c.Data["json"] = callbackResponse // c.Data["json"] = callbackResponse
c.ServeJSON() // c.ServeJSON()
return // return
} // }
} //}
callbackResponse = ebai.OnCallbackMsg(obj) callbackResponse = ebai.OnCallbackMsg(obj)
} }
if callbackResponse == nil { if callbackResponse == nil {

View File

@@ -4,7 +4,6 @@ import (
"encoding/json" "encoding/json"
"git.rosy.net.cn/baseapi/platformapi/mtwmapi" "git.rosy.net.cn/baseapi/platformapi/mtwmapi"
"git.rosy.net.cn/jx-callback/business/model" "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/business/partner/purchase/mtwm"
"git.rosy.net.cn/jx-callback/globals/api" "git.rosy.net.cn/jx-callback/globals/api"
"github.com/astaxie/beego/server/web" "github.com/astaxie/beego/server/web"
@@ -31,24 +30,24 @@ func (c *MtwmController) onCallbackMsg(msgType string) {
json.Unmarshal([]byte(msg.FormData.Get("pick_up_data")), &finishedPickup) json.Unmarshal([]byte(msg.FormData.Get("pick_up_data")), &finishedPickup)
vendorStoreId = finishedPickup.AppPoiCode vendorStoreId = finishedPickup.AppPoiCode
} }
if vendorStoreId != "" { //if vendorStoreId != "" {
storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreId, model.VendorIDMTWM, "") // storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreId, model.VendorIDMTWM, "")
if storeDetail == nil { // if storeDetail == nil {
switch web.BConfig.RunMode { // switch web.BConfig.RunMode {
case model.ServerTypeVegetable, "dev": // case model.ServerTypeVegetable, "dev":
callbackResponse = pushMTWMOrder2GY(msg.FormData, msgType, model.ServerTypeFruits) // callbackResponse = pushMTWMOrder2GY(msg.FormData, msgType, model.ServerTypeFruits)
case model.ServerTypeFruits: // case model.ServerTypeFruits:
callbackResponse = pushMTWMOrder2GY(msg.FormData, msgType, model.ServerTypePet) // callbackResponse = pushMTWMOrder2GY(msg.FormData, msgType, model.ServerTypePet)
case model.ServerTypePet: // case model.ServerTypePet:
//ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "47B1E94E8D2411EFB666525400E86DC0", "美团菜市推果园,果园退超市未找到门店", fmt.Sprintf("美团菜市推果园cmd:%s,storeId:%s", msgType, vendorStoreId)) // //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), "") // callbackResponse = mtwmapi.Err2CallbackResponse(nil, "") // mtwmapi.Err2CallbackResponse(fmt.Errorf("美团菜市推果园,果园退超市未找到门店cmd:%s,storeId:%s", msgType, vendorStoreId), "")
return // return
} // }
c.Data["json"] = callbackResponse // c.Data["json"] = callbackResponse
c.ServeJSON() // c.ServeJSON()
return // return
} // }
} //}
callbackResponse = mtwm.OnCallbackMsg(msg, msgType) callbackResponse = mtwm.OnCallbackMsg(msg, msgType)
if callbackResponse == nil { if callbackResponse == nil {