提交 3d9e78d0 authored 作者: gukai's avatar gukai

消息增加选品库类型

上级 79ef27e3
......@@ -23,25 +23,36 @@ const (
NotifyTopic = "notifyMessage"
//消息类型
ProductExpire = 101
ProductModify = 102
ProductPrice = 103
ProductRepost = 104
OrderSendgoods = 201
OrderComfirmReceiveGoods = 202
OrderSuccess = 203
OrderCancel = 204
RefundApply = 300
RefundAgree = 301
RefundRefuse = 302
RefundSuccess = 303
ImportTags = 401
//商品消息
ProductExpire = 101 //商品下架
ProductModify = 102 //商品修改
ProductPrice = 103 //价格变更
ProductRepost = 104 //商品商家
//订单消息
OrderSendgoods = 201 //订单发货
OrderComfirmReceiveGoods = 202 //确认收货
OrderSuccess = 203 //交易成功
OrderCancel = 204 //订单取消
RefundApply = 300 //申请售后
RefundAgree = 301 //商家同意售后
RefundRefuse = 302 //商家拒绝售后
RefundSuccess = 303 //售后成功
//标签消息
TagsImport = 401 //导入标签
//选品消息
GoodsStorageAdd = 501 //添加选品库
GoodsStorageRemove = 502 //移除选品库
ErrMsgParamEmpty = "该类型消息对应字段不能为空"
ErrMsgAppIDEmpty = "该类型消息appid字段不能为空"
ErrMsgTpye = "错误的消息类型"
)
//推送下游对应字段
var (
SendMsgType = g.MapIntStr{
ProductExpire: "goods.undercarriage",
......@@ -54,6 +65,10 @@ var (
OrderSuccess: "order.success",
OrderCancel: "order.cancel",
GoodsStorageAdd: "goods.storage.add",
GoodsStorageRemove: "goods.storage.remove",
TagsImport: "tags.import",
RefundAgree: "afterSale.agree",
RefundRefuse: "afterSale.refuse",
RefundSuccess: "afterSale.success",
......@@ -113,8 +128,22 @@ func (p *NsqProducer) msgValidator(notifyMessage *NotifyMessage) (err error) {
err = errors.New(ErrMsgAppIDEmpty)
return
}
default:
case 5:
var msgData *GoodsMsgData
if err = gconv.Struct(notifyMessage.Data, &msgData); err != nil {
return
}
if len(msgData.GoodsIDs) == 0 {
err = errors.New(ErrMsgParamEmpty)
return
}
if notifyMessage.AppID == 0 {
err = errors.New(ErrMsgAppIDEmpty)
return
}
default:
err = errors.New(ErrMsgTpye)
}
return
}
......
......@@ -51,3 +51,4 @@ type RefundMsgData struct {
type TagsMsgData struct {
Tags string `json:"tags"`
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论