Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
L
library
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
stbz
library
Commits
de594746
提交
de594746
authored
3月 10, 2022
作者:
gukai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
推送消息增加请求日志
上级
39bef359
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
40 行增加
和
7 行删除
+40
-7
message.go
notify/message.go
+17
-0
model.go
notify/model.go
+23
-7
没有找到文件。
notify/message.go
浏览文件 @
de594746
...
...
@@ -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
notify/model.go
浏览文件 @
de594746
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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论