|
@@ -36,6 +36,7 @@ func NewPublishInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Publi
|
|
// 发布信息
|
|
// 发布信息
|
|
func (l *PublishInfoLogic) PublishInfo(in *consumer.PublishInfoReq) (*consumer.PublishInfoResp, error) {
|
|
func (l *PublishInfoLogic) PublishInfo(in *consumer.PublishInfoReq) (*consumer.PublishInfoResp, error) {
|
|
// todo: add your logic here and delete this line
|
|
// todo: add your logic here and delete this line
|
|
|
|
+ log.Println("信息发布in数据:", in)
|
|
res := consumer.PublishInfoResp{}
|
|
res := consumer.PublishInfoResp{}
|
|
var id int64
|
|
var id int64
|
|
//信息类型1:招标信息 2:采购信息 3:供应信息
|
|
//信息类型1:招标信息 2:采购信息 3:供应信息
|
|
@@ -61,24 +62,25 @@ func (l *PublishInfoLogic) PublishInfo(in *consumer.PublishInfoReq) (*consumer.P
|
|
log.Println(in.MsgType, "-------------------")
|
|
log.Println(in.MsgType, "-------------------")
|
|
switch in.MsgType {
|
|
switch in.MsgType {
|
|
case 1, 2:
|
|
case 1, 2:
|
|
- publishData["related_id"] = mc.IntAll(in.RelatedId) //关联公告id
|
|
|
|
- publishData["project_code"] = in.Code //项目编号
|
|
|
|
- publishData["industry"] = strings.Join(in.Industry, ",") //项目行业,多个逗号分隔
|
|
|
|
- publishData["buyer"] = in.Buyer //采购单位
|
|
|
|
- publishData["budget"] = in.Budget // 预算单位元
|
|
|
|
- publishData["winner"] = in.Winner //中标单位
|
|
|
|
- publishData["amount"] = in.Amount //中标金额
|
|
|
|
|
|
+ publishData["related_id"] = mc.IntAll(se.SE.DecodeString(in.RelatedId)) //关联公告id
|
|
|
|
+ publishData["project_code"] = in.Code //项目编号
|
|
|
|
+ publishData["industry"] = strings.Join(in.Industry, ",") //项目行业,多个逗号分隔
|
|
|
|
+ publishData["buyer"] = in.Buyer //采购单位
|
|
|
|
+ publishData["budget"] = in.Budget // 预算单位元
|
|
|
|
+ publishData["winner"] = in.Winner //中标单位
|
|
|
|
+ publishData["amount"] = in.Amount //中标金额
|
|
|
|
|
|
id = model.Mysql.Insert("information", publishData)
|
|
id = model.Mysql.Insert("information", publishData)
|
|
case 3:
|
|
case 3:
|
|
- publishData["validity_time"] = in.Deadline //信息有效期
|
|
|
|
|
|
+ if in.Deadline != "" {
|
|
|
|
+ publishData["validity_time"] = in.Deadline //信息有效期
|
|
|
|
+ }
|
|
id = model.Mysql.Insert("supply_info", publishData)
|
|
id = model.Mysql.Insert("supply_info", publishData)
|
|
default:
|
|
default:
|
|
res.ErrCode = -1
|
|
res.ErrCode = -1
|
|
res.ErrMsg = "数据类型有误"
|
|
res.ErrMsg = "数据类型有误"
|
|
return &res, nil
|
|
return &res, nil
|
|
}
|
|
}
|
|
- log.Println("id:", id)
|
|
|
|
if id < 1 {
|
|
if id < 1 {
|
|
res.ErrCode = -1
|
|
res.ErrCode = -1
|
|
res.ErrMsg = fmt.Sprintf("数据类型 %d 创建信息失败", in.MsgType)
|
|
res.ErrMsg = fmt.Sprintf("数据类型 %d 创建信息失败", in.MsgType)
|
|
@@ -100,8 +102,9 @@ func (l *PublishInfoLogic) PublishInfo(in *consumer.PublishInfoReq) (*consumer.P
|
|
}
|
|
}
|
|
nsq, err := util.NewNsqInfo(model.NsqConfig.Ip, model.NsqConfig.Topic, mc.InterfaceToStr(id), "1", mc.InterfaceToStr(in.MsgType), false, appendInfo)
|
|
nsq, err := util.NewNsqInfo(model.NsqConfig.Ip, model.NsqConfig.Topic, mc.InterfaceToStr(id), "1", mc.InterfaceToStr(in.MsgType), false, appendInfo)
|
|
if err != nil || nsq.NsqPushInfo() != nil {
|
|
if err != nil || nsq.NsqPushInfo() != nil {
|
|
|
|
+ log.Println("信息发布失败nsq++++++++++++", model.NsqConfig, appendInfo)
|
|
res.ErrCode = -1
|
|
res.ErrCode = -1
|
|
- res.ErrMsg = fmt.Sprintf("添加nsq失败;%s", err.Error())
|
|
|
|
|
|
+ res.ErrMsg = fmt.Sprintf("信息发布失败")
|
|
}
|
|
}
|
|
entNameKye := fmt.Sprintf("userEntName_%s_%d_%s", in.UserId, id, in.MsgType)
|
|
entNameKye := fmt.Sprintf("userEntName_%s_%d_%s", in.UserId, id, in.MsgType)
|
|
redis.Put("other", entNameKye, in.EntName, 3*24*60*60)
|
|
redis.Put("other", entNameKye, in.EntName, 3*24*60*60)
|