提交 de594746 authored 作者: gukai's avatar gukai

推送消息增加请求日志

上级 39bef359
......@@ -21,6 +21,9 @@ const (
MsgCloudTopic = "newShopApi"
//通知消息系统topic
NotifyTopic = "notifyMessage"
//API请求日志
ApiRequestTopic = "apiRequest"
//消息类型
......@@ -203,3 +206,17 @@ func (p *NsqProducer) NotifyServer(notifyServer *NotifyServer) (err error) {
}
return
}
/*
api请求日志 20220310 gk
*/
func (p *NsqProducer) NotifyApiLog(notifyApiLog *NotifyApiLog) (err error) {
jsonBytes, _ := json.Marshal(notifyApiLog)
err = NsqProducers.Publish(ApiRequestTopic, string(jsonBytes))
if !logs.CheckErr(err, "NotifyApiLog") {
logs.Info("NotifyApiLog", "消息内容:【%v】", string(jsonBytes))
}
return
}
\ No newline at end of file
package notify
//推送到消息系统的公共消息
type NotifyServer struct {
MsgType int `json:"msg_type"`
......@@ -12,13 +10,15 @@ type NotifyServer struct {
//推送到消息系统的售后消息
type NotifyRefundData struct {
AfsServiceId interface{} `json:"afs_service_id"` //三方服务单号
AfsServiceId interface{} `json:"afs_service_id"` //三方服务单号
}
//推送到消息系统的订单消息
type NotifyOrderData struct {
ThirdChildOrderSn string `json:"third_child_order_sn"`//三方子订单号
ThirdOrderSn string `json:"third_order_sn"` //三方订单号
ThirdChildOrderSn string `json:"third_child_order_sn"` //三方子订单号
ThirdOrderSn string `json:"third_order_sn"` //三方订单号
}
//推送到消息系统的商品消息
type NotifyGoodsData struct {
ThirdGoodsInfo []ThirdGoods `json:"third_goods"` //三方商品信息
......@@ -26,7 +26,7 @@ type NotifyGoodsData struct {
type ThirdGoods struct {
ThirdId int `json:"third_id"` //三方商品id
Skus []int `json:"skus"` //三方规格id
Skus []int `json:"skus"` //三方规格id
}
//通知消息系统
......@@ -44,19 +44,35 @@ type NotifyMessage struct {
type GoodsMsgData struct {
GoodsIDs []int `json:"goods_id"`
}
//通知客户订单消息
type OrderMsgData struct {
OrderSn string `json:"orderSn"`
Sku uint `json:"sku"`
}
//通知客户售后消息
type RefundMsgData struct {
AfterSaleID uint `json:"afterSaleId"`
OrderSn string `json:"orderSn"`
Sku uint `json:"sku"`
}
//通知客户标签消息
type TagsMsgData struct {
Tags string `json:"tags"`
Tags string `json:"tags"`
}
//通知api请求日志
type NotifyApiLog struct {
ID int `json:"id"`
Type string `json:"type"` //api类型 goods/order
Method string `json:"method"` //请求方式
RequestUri string `json:"request_uri"` //请求路径
AppID int `json:"app_id"`
RequestTime int `json:"request_time"` //请求时间戳
Body string `json:"body"` //请求参数
ResponseTime int `json:"response_time"` //响应时间
ResponseBody string `json:"response_body"` //响应参数
Error string `json:"error"` //错误信息
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论