|
@@ -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 = "调用信息发布成功,更新信息失败"
|
|
|
}
|