Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
L
library
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
stbz
library
Commits
522ac7d8
提交
522ac7d8
authored
6月 29, 2025
作者:
张立波
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
7da7d138
834ab293
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
50 行增加
和
0 行删除
+50
-0
hcw_callback.go
upstream/hcw/hcw_callback.go
+50
-0
没有找到文件。
upstream/hcw/hcw_callback.go
0 → 100644
浏览文件 @
522ac7d8
package
hcw
import
(
"encoding/json"
"github.com/gogf/gf/net/ghttp"
)
//notify_id string 唯一请求ID(用于幂等校验)示例:20240320140000_123456
//app_id string 平台分配的应用ID
//type string 业务类型标识,见下表
//data object 业务数据对象
//signature string 请求签名(验证方法见第四章)
type
OrderNotifyRes
struct
{
NotifyId
string
`json:"notify_id"`
AppId
string
`json:"app_id"`
Type
string
`json:"type"`
Data
OrderNotifyData
`json:"data"`
Signature
string
`json:"signature"`
}
// order_shipped 订单发货 { "order_no":"P123"}
// refund_result 发起售后成功 { "order_no":100.00}
// product_status 产品状态变更(1上架2下架) { "product_no":"SKU123"}
type
OrderNotifyData
struct
{
OrderNo
string
`json:"order_no"`
ProductNo
string
`json:"product_no"`
RefundNo
string
`json:"refund_no"`
Type
string
`json:"type"`
Source
string
`json:"source"`
}
// 回调
func
(
s
*
HcwClient
)
CallBack
(
r
*
ghttp
.
Request
)
(
res
*
OrderNotifyRes
,
err
error
)
{
body
,
err
:=
CheckSign
(
r
)
if
nil
!=
err
{
return
}
if
body
==
""
{
return
}
err
=
json
.
Unmarshal
([]
byte
(
body
),
&
res
)
return
}
func
CheckSign
(
r
*
ghttp
.
Request
)
(
body
string
,
err
error
)
{
body
=
r
.
GetBodyString
()
return
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论