美团配送推送抖店配送信息

This commit is contained in:
邹宗楠
2022-11-25 10:16:56 +08:00
parent 20a71bdb2c
commit 3538b5a809
4 changed files with 56 additions and 160 deletions

View File

@@ -27,7 +27,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)
gyResult, err := HttpToGuoYuan(gyMsg, "order")
if err != nil {
return tiktokShop.Err2CallbackResponse(err, "")
}
@@ -46,14 +46,23 @@ func OnOrderMsg(msgId string, msg interface{}) (response *tiktokShop.CallbackRes
return response
}
func HttpToGuoYuan(param map[string]interface{}) (*http.Response, error) {
func HttpToGuoYuan(param map[string]interface{}, requestType string) (*http.Response, error) {
paramData, err := json.Marshal(param)
if err != nil {
return nil, err
}
body := strings.NewReader(string(paramData))
httpReq, err := http.NewRequest(http.MethodPost, "http://callback-jxgy.jxc4.com/tiktok/callbackTiktokOrderMsg", body)
url := ""
switch requestType {
case "order": // 订单相关
url = "http://callback-jxgy.jxc4.com/tiktok/callbackTiktokOrderMsg"
case "token": // 授权相关
case "wayBill": // 授权相关
}
httpReq, err := http.NewRequest(http.MethodPost, url, body)
if err != nil {
return nil, err
}