Ver Fonte

fix:bug修改

duxin há 3 anos atrás
pai
commit
d89c72e0ee

+ 24 - 4
rpc/common/internal/logic/sensitivemethodlogic.go

@@ -4,9 +4,11 @@ import (
 	md "app.yhyue.com/moapp/jyInfo/rpc/model"
 	model "app.yhyue.com/moapp/jyInfo/rpc/model/es"
 	"app.yhyue.com/moapp/jyInfo/rpc/util"
+	mc "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/redis"
 	"context"
 	"fmt"
+	"log"
 	"strings"
 	"time"
 
@@ -37,10 +39,25 @@ func (l *SensitiveMethodLogic) SensitiveMethod(in *common.SensitiveRequest) (*co
 		//isSensitive 是否有敏感词  isPublishInfo招标信息是否需要自动发布 isPublishSup 供应信息是否需要自动发布
 		isSensitive, isPublishInfo, isPublishSup bool
 	)
-	fmt.Println("接收到敏感词回调----------------------", in)
 	upData := make(map[string]interface{})
 	query := make(map[string]interface{})
-	if in.Title != nil || in.Detail != nil || in.Attachments != "" || in.AttachTxt != "" {
+	attachments := mc.StringToMap(in.Attachments)
+	sensitiveAttach := make(map[string]interface{})
+
+	for k, v := range attachments {
+		vs := mc.StructToMapMore(v)
+		var msg []string
+		if mc.InterfaceToStr(vs["status"]) != "200" {
+			msg = append(msg, "附件校验敏感词失败")
+		} else if s, ok := vs["sensitive"]; ok && s != nil && len(s.([]string)) > 0 {
+			sensitives, _ := vs["sensitive"].([]string)
+			msg = sensitives
+		} else {
+			continue
+		}
+		sensitiveAttach[k] = msg
+	}
+	if in.Title != nil || in.Detail != nil || sensitiveAttach != nil {
 		isSensitive = true
 	}
 	if !isSensitive && !md.Sensitive.Information {
@@ -57,12 +74,13 @@ func (l *SensitiveMethodLogic) SensitiveMethod(in *common.SensitiveRequest) (*co
 	if in.Detail != nil {
 		upData["sensitive_detail"] = strings.Join(in.Detail, ",")
 	}
-	if in.Attachments != "" {
-		upData["sensitive_attach"] = in.Attachments
+	if sensitiveAttach != nil {
+		upData["sensitive_attach"] = mc.MapToJson(sensitiveAttach)
 	}
 	if in.AttachTxt != "" {
 		upData["discern_attach"] = in.AttachTxt
 	}
+	log.Println("敏感词回调参数in:", in)
 	query["id"] = in.Id
 	upData["status"] = 2
 	switch in.MsgType {
@@ -87,6 +105,7 @@ func (l *SensitiveMethodLogic) SensitiveMethod(in *common.SensitiveRequest) (*co
 			}
 
 			if !md.Mysql.Update("information", query, upData) {
+				log.Println("调用信息发布成功,更新信息失败", query, upData)
 				resp.ErrCode = 1
 				resp.ErrMsg = "调用nsq发布信息成功,更新信息失败"
 			}
@@ -121,6 +140,7 @@ func (l *SensitiveMethodLogic) SensitiveMethod(in *common.SensitiveRequest) (*co
 			}
 
 			if !md.Mysql.Update("supply_info", query, upData) {
+				log.Println("调用信息发布成功,更新信息失败", query, upData)
 				resp.ErrCode = 1
 				resp.ErrMsg = "调用信息发布成功,更新信息失败"
 			}

+ 13 - 10
rpc/consumer/internal/logic/publishinfologic.go

@@ -36,6 +36,7 @@ func NewPublishInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Publi
 // 发布信息
 func (l *PublishInfoLogic) PublishInfo(in *consumer.PublishInfoReq) (*consumer.PublishInfoResp, error) {
 	// todo: add your logic here and delete this line
+	log.Println("信息发布in数据:", in)
 	res := consumer.PublishInfoResp{}
 	var id int64
 	//信息类型1:招标信息 2:采购信息 3:供应信息
@@ -61,24 +62,25 @@ func (l *PublishInfoLogic) PublishInfo(in *consumer.PublishInfoReq) (*consumer.P
 	log.Println(in.MsgType, "-------------------")
 	switch in.MsgType {
 	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)
 	case 3:
-		publishData["validity_time"] = in.Deadline //信息有效期
+		if in.Deadline != "" {
+			publishData["validity_time"] = in.Deadline //信息有效期
+		}
 		id = model.Mysql.Insert("supply_info", publishData)
 	default:
 		res.ErrCode = -1
 		res.ErrMsg = "数据类型有误"
 		return &res, nil
 	}
-	log.Println("id:", id)
 	if id < 1 {
 		res.ErrCode = -1
 		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)
 	if err != nil || nsq.NsqPushInfo() != nil {
+		log.Println("信息发布失败nsq++++++++++++", model.NsqConfig, appendInfo)
 		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)
 	redis.Put("other", entNameKye, in.EntName, 3*24*60*60)

+ 1 - 1
rpc/manager/internal/logic/infoexaminelogic.go

@@ -103,7 +103,7 @@ func (l *InfoExamineLogic) InfoExamine(in *manager.InfoExamineReq) (*manager.Inf
 			} else {
 				//nsq发布信息
 				appInfo := common.StructToMapMore(info)
-				nsq, err := util.NewNsqInfo(md.NsqConfig.Ip, md.NsqConfig.Topic, in.MsgId, "2", common.InterfaceToStr(info.Type), false, appInfo)
+				nsq, err := util.NewNsqInfo(md.NsqConfig.Ip, md.NsqConfig.Topic, msgId, "2", common.InterfaceToStr(info.Type), false, appInfo)
 				if err != nil || nsq.NsqPushInfo() != nil {
 					resp.ErrCode = -1
 					resp.ErrMsg = "人工审核通过,调用nsq失败"

+ 2 - 3
rpc/manager/internal/logic/institutionsfreezelogic.go

@@ -2,7 +2,6 @@ package logic
 
 import (
 	"app.yhyue.com/moapp/jyInfo/rpc/model"
-	"app.yhyue.com/moapp/jyInfo/rpc/util"
 	mc "app.yhyue.com/moapp/jybase/common"
 	"context"
 
@@ -31,8 +30,8 @@ func (l *InstitutionsFreezeLogic) InstitutionsFreeze(in *manager.InstitutionsFre
 	// todo: add your logic here and delete this line
 	var resp manager.InfoResp
 
-	model.Mysql.SelectBySql(`UPDATE information SET status = -1 ,review_desc = "机构已冻结" WHERE status IN (0,1,2) and province =1 and is_del = 1 and app_id = ` + util.StrFormat(in.AppId) + ` and ent_id = ` + mc.InterfaceToStr(in.EntId))
-	model.Mysql.SelectBySql(`UPDATE supply_info SET status = -1 ,review_desc = "机构已冻结" WHERE status IN (0,1,2) and province =1 and is_del = 1  and app_id = ` + util.StrFormat(in.AppId) + ` and ent_id = ` + mc.InterfaceToStr(in.EntId))
+	model.Mysql.SelectBySql(`UPDATE information SET status = -1 ,review_desc = "机构已冻结" WHERE status IN (0,1,2) and province =1 and is_del = 1 and app_id = ` + in.AppId + ` and ent_id = ` + mc.InterfaceToStr(in.EntId))
+	model.Mysql.SelectBySql(`UPDATE supply_info SET status = -1 ,review_desc = "机构已冻结" WHERE status IN (0,1,2) and province =1 and is_del = 1  and app_id = ` + in.AppId + ` and ent_id = ` + mc.InterfaceToStr(in.EntId))
 
 	return &resp, nil
 }