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

消息增加选品库类型

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