This commit is contained in:
邹宗楠
2023-02-15 14:09:51 +08:00
parent 076139e600
commit eab817817f
6 changed files with 105 additions and 36 deletions

View File

@@ -15,6 +15,15 @@ import (
"time"
)
// 同一账号下,菜市消息推送到果园
const (
CaiShiPushGyTagOrder = "order" // 订单
CaiShiPushGyTagToken = "token" // 授权
CaiShiPushGyTagDeliveryRegister = "delivery" // 配送注册查询
CaiShiPushGyTagDeliveryDetail = "deliveryDetail" // 配送详情
CaiShiPushGyTagWayBill = "waybill" // 配送
)
// OnOrderMsg 抖音
func OnOrderMsg(msgId string, msg interface{}) (response *tiktokShop.CallbackResponse) {
globals.SugarLogger.Debugf("guoyuan %s,%s", msgId, utils.Format4Output(msg, false))
@@ -33,7 +42,7 @@ func OnOrderMsg(msgId string, msg interface{}) (response *tiktokShop.CallbackRes
// 当前订单所属门店不属于菜市时,将消息推送到果园
gyMsg := map[string]interface{}{"tag": msgId, "msg_id": utils.Int64ToStr(time.Now().Unix()) + msgId, "data": msg}
// 通知到果园
gyResult, err := HttpToGuoYuan(gyMsg, "order")
gyResult, err := HttpToGuoYuan(gyMsg, CaiShiPushGyTagOrder)
if err != nil {
return tiktokShop.Err2CallbackResponse(err, "")
}
@@ -50,7 +59,6 @@ func OnOrderMsg(msgId string, msg interface{}) (response *tiktokShop.CallbackRes
}, jxutils.ComposeUniversalOrderID(orderId, model.VendorIDDD))
} else {
globals.SugarLogger.Debugf("============2")
}
return response
}
@@ -74,11 +82,15 @@ func HttpToGuoYuan(param map[string]interface{}, requestType string) (*http.Resp
url := ""
switch requestType {
case "order": // 订单相关
case CaiShiPushGyTagOrder: // 订单相关
url = "http://callback-jxgy.jxc4.com/tiktok/callbackTiktokOrderMsg"
case "token": // 授权相关
case CaiShiPushGyTagToken: // 授权相关
url = "http://callback-jxgy.jxc4.com/tiktokShop/jxcsToGyTiktokToken"
case "wayBill": // 运单消息
case CaiShiPushGyTagDeliveryRegister: // 配送查询注册
url = "http://callback-jxgy.jxc4.com/logistics/logisticsRegister"
case CaiShiPushGyTagDeliveryDetail: // 配送查询详情
url = "http://callback-jxgy.jxc4.com/logistics/logisticsQuery"
case CaiShiPushGyTagWayBill: // 运单消息
}
httpReq, err := http.NewRequest(http.MethodPost, url, body)