提交 da03a699 authored 作者: 张立波's avatar 张立波

wpc

上级 ca029862
package wpc
import (
"context"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
)
type msgWpc struct {
}
var Msg = msgWpc{}
// MsgGetReq 应用级请求参数
type MsgGetReq struct {
AreaId string `json:"areaId,omitempty"` //地区ID
Timestamp string `json:"timestamp,omitempty"` //时间戳(秒级)
ChannelId string `json:"vopChannelId"` //开放平台appKey
UserNumber string `json:"userNumber"` //代购编号
Page int `json:"page"` //当前页码,从1开始
PageSize int `json:"pageSize"` //每页条数,最多20条数据
TypeList []int `json:"typeList,omitempty"` //消息类型:0-价格变动
ConsumerType int `json:"consumerType,omitempty"` //消费类型:0-自动消费(默认),1-主动消费(调用消费接口,推荐)
H5ChannelId string `json:"h5ChannelId,omitempty"` //h5渠道id, h5接入模式必传(由唯代购分配)
}
// MsgDataVo 消息内容 消息类型=0该字段才有值
type MsgDataVo struct {
GoodId string `json:"goodId,omitempty"` //商品id
GoodFullId string `json:"goodFullId,omitempty"` //商品全id
OldPrice string `json:"oldPrice,omitempty"` //原价格
NewPrice string `json:"newPrice,omitempty"` //新价格
SizeId int64 `json:"sizeId,omitempty"` //尺码id
VipShopPrice string `json:"vipshopPrice,omitempty"` //唯品价
MarketPrice string `json:"marketPrice,omitempty"` //市场价
}
// MsgGetItem 变更消息条目
type MsgGetItem struct {
MsgId string `json:"msgId"` //消息id
Type int `json:"type"` //消息类型: 0-价格变动, 5-多渠道h5-取消订单退款通知, 6-多渠道h5-售后单退款通知
CreateTime string `json:"createTime"` //消息创建时间
Data MsgDataVo `json:"data"` //消息内容,消息类型=0该字段才有值
JsonData string `json:"jsonData"` //消息内容 json格式: 5多渠道h5-取消订单退款通知 格式: {"orderSn":"25042444747438"};6多渠道h5-售后单退款通知 格式: {"afterSalesSn":"20250421059662618411","orderSn":"25041506528067"}
}
type MsgGetRes struct {
ReturnCode string `json:"returnCode"`
ReturnMessage string `json:"returnMessage"`
Success []MsgGetItem `json:"success"`
}
// Get 拉取变更消息
func (*msgWpc) Get(ctx context.Context, req MsgGetReq) (res *MsgGetRes, err error) {
method := "getChangeMsg"
req.ChannelId = server.AppKey
req.UserNumber = server.UserNumber
result, err := post(ctx, method, g.Map{
"request": req,
})
_ = gjson.NewWithOptions(result, gjson.Options{
StrNumber: true,
}).Scan(&res)
return
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论