From a738dc4359f626f9c627af95bef285bd34204ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 29 Jul 2020 16:27:33 +0800 Subject: [PATCH] msgtype --- platformapi/jcqapi/jcqapi.go | 11 ++++++----- platformapi/jdshopapi/callback.go | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/platformapi/jcqapi/jcqapi.go b/platformapi/jcqapi/jcqapi.go index abba284a..9eb3510e 100644 --- a/platformapi/jcqapi/jcqapi.go +++ b/platformapi/jcqapi/jcqapi.go @@ -30,18 +30,18 @@ const ( TopicOrderFinish = "open_message_order_order_finish" //订单完成 TopicOrderCancel = "open_message_order_order_cancel" //订单取消 - Size = 1 //默认一次取10条 + Size = 10 //默认一次取10条 ) var ( TopicList = []string{ - // "open_message_pop_order_remk_chg", //POP订单备注变更 + "open_message_pop_order_remk_chg", //POP订单备注变更 // "open_message_pop_order_out", //POP订单出库 - "open_message_pop_order_create", //POP订单创建 + // "open_message_pop_order_create", //POP订单创建 // "open_message_pop_order_change", //POP订单变更消息 - // "open_message_order_order_pay", //订单付款 + "open_message_order_order_pay", //订单付款 // "open_message_order_order_finish", //订单完成 - // "open_message_order_order_cancel", //订单取消 + "open_message_order_order_cancel", //订单取消 } ) @@ -137,6 +137,7 @@ func (a *API) ConsumeInfo(topic, consumerGroupId string, size int) (consumeInfoR "topic": topic, "consumerGroupId": consumerGroupId, "size": size, + "ack": "true", //默认消费之后就确认 }) if err == nil { utils.Map2StructByJson(result["result"].(map[string]interface{})["messages"], &consumeInfoResult, false) diff --git a/platformapi/jdshopapi/callback.go b/platformapi/jdshopapi/callback.go index 366918a8..9a8a85a7 100644 --- a/platformapi/jdshopapi/callback.go +++ b/platformapi/jdshopapi/callback.go @@ -24,6 +24,7 @@ type CallBackResult struct { OrderID string `json:"orderId"` OrderSource string `json:"orderSource"` FreightPrice string `json:"freightPrice"` + MsgType string `json:"msgType"` ConsigneeInfo *CallBackConsigneeInfo `json:"consigneeInfo"` ItemInfoList []*CallBackItemInfoList `json:"itemInfoList"` } @@ -70,5 +71,6 @@ func (a *API) GetCallbackMsg(request *http.Request) (call *CallBackResult, err e if err = json.Unmarshal([]byte(mapData["orderInfo"].(string)), &call); err != nil { return nil, err } + call.MsgType = mapData["msgType"].(string) return call, err }