Browse Source

fix:详情页敏感词修改

duxin 2 years ago
parent
commit
662b3b8ff7

+ 11 - 0
src/config.json

@@ -389,6 +389,17 @@
     "expurasingtime": true,
     "expurasingtime": true,
     "winnerMap": true
     "winnerMap": true
   },
   },
+  "detailMosaic":"免费注册即可查看",
+  "detailNeedMosaic":{
+    "buyerperson":true,
+    "buyertel":true,
+    "winnerperson":true,
+    "winnertel":true,
+    "agencyperson":true,
+    "agencytel":true,
+    "budget":true,
+    "bidamount":true
+  },
   "keywordsLimitNologin": 25,
   "keywordsLimitNologin": 25,
   "messageCenter": {
   "messageCenter": {
     "appid": "10000",
     "appid": "10000",

+ 4 - 20
src/jfw/front/shorturl.go

@@ -21,8 +21,6 @@ import (
 	. "app.yhyue.com/moapp/jybase/mongodb"
 	. "app.yhyue.com/moapp/jybase/mongodb"
 
 
 	elastic "app.yhyue.com/moapp/jybase/es"
 	elastic "app.yhyue.com/moapp/jybase/es"
-	"app.yhyue.com/moapp/jybase/fsw"
-
 	"regexp"
 	"regexp"
 	"strings"
 	"strings"
 	"time"
 	"time"
@@ -925,30 +923,16 @@ func ReplaceStringByRegex(str, rule, replace string) (string, error) {
 // 未登录用户进行数据过滤 name 配置文件
 // 未登录用户进行数据过滤 name 配置文件
 func Filter(obj map[string]interface{}) map[string]interface{} {
 func Filter(obj map[string]interface{}) map[string]interface{} {
 	detail := fmt.Sprint(obj["detail"])
 	detail := fmt.Sprint(obj["detail"])
-	mosaicText := util.ObjToString(config.Sysconfig["detailMosaicTxt"])
+	mosaicText := util.ObjToString(config.Sysconfig["detailMosaic"])
 	for k, _ := range obj {
 	for k, _ := range obj {
-		needMosaic, _ := config.Sysconfig["needMosaic"].(map[string]interface{})
-		if ok, _ := needMosaic[k].(bool); ok {
+		detailNeedMosaic, _ := config.Sysconfig["detailNeedMosaic"].(map[string]interface{})
+		if ok, _ := detailNeedMosaic[k].(bool); ok {
 			if util.ObjToString(obj[k]) != "" {
 			if util.ObjToString(obj[k]) != "" {
 				detail = strings.ReplaceAll(detail, util.ObjToString(obj[k]), mosaicText)
 				detail = strings.ReplaceAll(detail, util.ObjToString(obj[k]), mosaicText)
-				//敏感词过滤
 			}
 			}
-			if k == "winnerMap" {
-				winnerMap, _ := obj[k].(map[string]interface{})
-				mosaicMap := map[string]interface{}{}
-				for i := 0; i < len(winnerMap); i++ {
-					mosaicMap[mosaicText] = mosaicText
-				}
-				obj["winnerMap"] = mosaicMap
-			} else {
-				obj[k] = mosaicText
-			}
-
+			obj[k] = mosaicText
 		}
 		}
 	}
 	}
-	//数字打码
-	detail = RegDetail(detail)
-	detail = fsw.Repl(detail)
 	obj["detail"] = detail
 	obj["detail"] = detail
 	return obj
 	return obj
 }
 }

+ 4 - 78
src/jfw/modules/app/src/app/front/shorturl.go

@@ -13,8 +13,6 @@ import (
 
 
 	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/encrypt"
-	"app.yhyue.com/moapp/jybase/fsw"
-
 	//"math/rand"
 	//"math/rand"
 	. "jy/src/jfw/modules/app/src/app/jyutil"
 	. "jy/src/jfw/modules/app/src/app/jyutil"
 	"log"
 	"log"
@@ -281,91 +279,19 @@ func (s *Short) Article(stype, id string) error {
 	return s.Redirect("/jyapp/free/mob/err")
 	return s.Redirect("/jyapp/free/mob/err")
 }
 }
 
 
-func NoLoginArticle(stype, sid string) map[string]interface{} {
-	obj := make(map[string]interface{})
-	catchKey := fmt.Sprintf("jypcdetail_nologin_app_%s_%s", stype, sid)
-	//if res := redis.Get("other", catchKey); res != nil && res != "" {
-	//	if data := util.ObjToMap(res); data != nil {
-	//		obj = *data
-	//		return obj
-	//	}
-	//}
-	obj = wxvisitD(sid, "", false)
-	if len(obj) > 0 {
-		if obj["entidlist"] != nil { //大会员中标企业跳转至画像
-			entIdArr, winnerMap := []string{}, map[string]interface{}{}
-			eidList, _ := obj["entidlist"].([]interface{})
-			swinnerArr := strings.Split(util.ObjToString(obj["s_winner"]), ",")
-			//先查询entlist 如果长度和s_winner不一致 根据企业名称查询id
-			if len(eidList) != len(swinnerArr) {
-				for _, v := range swinnerArr {
-					winnerMap[v] = ""
-					//临时更改为企业名称查询企业id
-					rData := elastic.Get("qyxy", "qyxy", fmt.Sprintf(`{"query":{"bool":{"should":[{"term":{"company_name":"%s"}},{"term":{"hname":"%s"}}],"minimum_should_match":1}},"_source":["name","_id","capital","company_phone"],"size":1}`, v, v))
-					if rData != nil && len(*rData) == 1 {
-						if entId := util.ObjToString((*rData)[0]["_id"]); entId != "" {
-							entIdArr = append(entIdArr, encrypt.EncodeArticleId2ByCheck(util.ObjToString((*rData)[0]["_id"])))
-							winnerMap[v] = encrypt.EncodeArticleId2ByCheck(util.ObjToString((*rData)[0]["_id"]))
-						}
-					}
-				}
-			} else {
-				for k, v := range eidList {
-					vstr := util.ObjToString(v)
-					if vstr == "-" {
-						continue
-					}
-					winnerMap[swinnerArr[k]] = encrypt.EncodeArticleId2ByCheck(vstr)
-				}
-			}
-			obj["entId"] = entIdArr
-			obj["winnerMap"] = winnerMap
-		}
-		//判断是否公开联系人信息
-		if util.Int64All(obj["buyerhint"]) == 2 {
-			obj["buyerperson"] = ""
-			obj["buyertel"] = ""
-		}
-		if obj["l_publishtime"] != nil {
-			obj["publishtimeShorDate"] = time.Unix(util.Int64All(obj["l_publishtime"]), 0).Format(date.Date_Short_Layout)
-		}
-		obj["winnerTitle"] = obj["winner"]
-		obj["buyerTitle"] = obj["buyer"]
-		obj["projectnameTitle"] = obj["projectname"]
-		obj["projectcodeTitle"] = obj["projectcode"]
-		obj = Filter(obj)
-		redis.Put("other", catchKey, obj, 60*60*2)
-	}
-	return obj
-}
-
 // 未登录用户进行数据过滤
 // 未登录用户进行数据过滤
 func Filter(obj map[string]interface{}) map[string]interface{} {
 func Filter(obj map[string]interface{}) map[string]interface{} {
 	detail := fmt.Sprint(obj["detail"])
 	detail := fmt.Sprint(obj["detail"])
-	mosaicText := util.ObjToString(config.Sysconfig["detailMosaicTxt"])
+	mosaicText := util.ObjToString(config.Sysconfig["detailMosaic"])
 	for k, _ := range obj {
 	for k, _ := range obj {
-		needMosaic, _ := config.Sysconfig["needMosaic"].(map[string]interface{})
-		if ok, _ := needMosaic[k].(bool); ok {
+		detailNeedMosaic, _ := config.Sysconfig["detailNeedMosaic"].(map[string]interface{})
+		if ok, _ := detailNeedMosaic[k].(bool); ok {
 			if util.ObjToString(obj[k]) != "" {
 			if util.ObjToString(obj[k]) != "" {
 				detail = strings.ReplaceAll(detail, util.ObjToString(obj[k]), mosaicText)
 				detail = strings.ReplaceAll(detail, util.ObjToString(obj[k]), mosaicText)
-				//敏感词过滤
 			}
 			}
-			if k == "winnerMap" {
-				winnerMap, _ := obj[k].(map[string]interface{})
-				mosaicMap := map[string]interface{}{}
-				for i := 0; i < len(winnerMap); i++ {
-					mosaicMap[mosaicText] = mosaicText
-				}
-				obj["winnerMap"] = mosaicMap
-			} else {
-				obj[k] = mosaicText
-			}
-
+			obj[k] = mosaicText
 		}
 		}
 	}
 	}
-	//数字打码
-	detail = RegDetail(detail)
-	detail = fsw.Repl(detail)
 	obj["detail"] = detail
 	obj["detail"] = detail
 	return obj
 	return obj
 }
 }

+ 11 - 0
src/jfw/modules/app/src/config.json

@@ -216,6 +216,17 @@
     "expurasingtime":true,
     "expurasingtime":true,
     "winnerMap":true
     "winnerMap":true
   },
   },
+  "detailMosaic":"免费注册即可查看",
+  "detailNeedMosaic":{
+    "buyerperson":true,
+    "buyertel":true,
+    "winnerperson":true,
+    "winnertel":true,
+    "agencyperson":true,
+    "agencytel":true,
+    "budget":true,
+    "bidamount":true
+  },
   "keepShowRedSpot": true,
   "keepShowRedSpot": true,
   "detail_element": [
   "detail_element": [
     "table",
     "table",