浏览代码

处理暴露在外的信息id

wangshan 7 年之前
父节点
当前提交
7c56bf7f67

+ 10 - 3
src/jfw/front/follow.go

@@ -727,7 +727,7 @@ func (m *Follow) Set(tp, id string) error {
 			mySelf["area"] = (*data)["area"]
 			mySelf["s_projectcode"] = projectcode
 			mySelf["s_url"] = (*data)["href"]
-			mySelf["s_id"] = sid
+			//mySelf["s_id"] = sid
 			mySelf["s_eid"] = util.EncodeArticleId2ByCheck(sid)
 			mySelf["l_publishtime"] = (*data)["publishtime"]
 			////////////////////////
@@ -761,6 +761,7 @@ func (m *Follow) Set(tp, id string) error {
 			if len(res) > 0 || len(mySelf) > 0 {
 				for _, v := range res {
 					(*v)["s_eid"] = util.EncodeArticleId2ByCheck((*v)["s_id"].(string))
+					(*v)["s_id"] = ""
 				}
 				m.T["data"] = res
 			}
@@ -783,7 +784,13 @@ func (m *Follow) Set(tp, id string) error {
 				m.T["type"] = (*data)["type"]
 			}
 		}
-		m.T["relationinfo"] = (*data)["a_relationinfo"]
+		res := util.ObjArrToMapArr((*data)["a_relationinfo"].([]interface{}))
+		if len(res) > 0 {
+			for _, v := range res {
+				v["s_id"] = ""
+			}
+			m.T["relationinfo"] = res
+		}
 		m.T["a_visited"] = (*data)["a_visited"]
 		m.T["l_lastpushtime"] = (*data)["l_lastpushtime"]
 		m.T["a_lastpushids"] = (*data)["a_lastpushids"]
@@ -816,7 +823,7 @@ func (m *Follow) AllNotice() error {
 	defer util.Catch()
 	id := util.DecodeArticleId2ByCheck(m.GetString("id"))[0]
 	var relationinfo []interface{}
-	fields := `{"_id":-1,"s_title":1,"s_projectcode":1,"s_projectname":1,"s_url":1,"s_id":1,"l_publishtime":1,"a_relationinfo":1,"a_visited":1,"s_id":1}`
+	fields := `{"_id":-1,"s_title":1,"s_projectcode":1,"s_projectname":1,"s_url":1,"s_id":1,"l_publishtime":1,"a_relationinfo":1,"a_visited":1}`
 	data, ok := mongodb.FindById("follow_project", id, fields)
 	if ok && (data == nil || len(*data) == 0) { //以取消关注
 		data, ok = mongodb.FindOneByField("follow_project_back", `{"s_followid":"`+id+`"}`, fields)

+ 8 - 2
src/jfw/front/front.go

@@ -53,7 +53,7 @@ type Front struct {
 	wxsearchlist       xweb.Mapper `xweb:"/swordfish/searchlist"`         //剑鱼微信查询结果展示
 	wxsearchlistPaging xweb.Mapper `xweb:"/swordfish/searchlist/paging"`  //剑鱼微信查询结果展示--分页
 	delWxHistorySearch xweb.Mapper `xweb:"/swordfish/delWxHistorySearch"` //剑鱼微信删除历史搜索
-	visitRedirect      xweb.Mapper `xweb:"/visit/redirect"`               //剑鱼跳转访问请求,后续统计
+	//visitRedirect      xweb.Mapper `xweb:"/visit/redirect"`               //剑鱼跳转访问请求,后续统计
 	//iknow           xweb.Mapper `xweb:"/visit/iknow"`          //剑鱼跳转访问请求,后续统计
 	ajaxReq          xweb.Mapper `xweb:"/member/swordfish/ajaxReq"`
 	wxpushView       xweb.Mapper `xweb:"/wxpush/wxpushview"`        //推送结果预览
@@ -1239,7 +1239,13 @@ func (f *Front) TSGuide() error {
 		} else if reqType == "over" {
 			mongodb.Update("user", bson.M{"s_m_openid": openId}, bson.M{"$set": bson.M{"i_ts_guide": 1}}, false, false)
 		} else if reqType == "preview" {
-			result["data"] = elastic.GetByNgram(INDEX, TYPE, strings.Split(f.GetString("key"), " "), "", FINDF, `{"publishtime":-1}`, `"_id","title","publishtime","toptype","subtype","type","area","href","areaval"`, 0, 10)
+			rlt := elastic.GetByNgram(INDEX, TYPE, strings.Split(f.GetString("key"), " "), "", FINDF, `{"publishtime":-1}`, `"_id","title","publishtime","toptype","subtype","type","area","href","areaval"`, 0, 10)
+			if *rlt != nil && len(*rlt) > 0 {
+				for _, v := range *rlt {
+					v["_id"] = util.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
+				}
+			}
+			result["data"] = rlt
 		}
 		f.ServeJson(result)
 	}

+ 18 - 4
src/jfw/modules/app/src/jfw/front/follow.go

@@ -228,7 +228,13 @@ func (m *Follow) Photo(tp string) error {
 				m.T["type"] = (*data)["type"]
 			}
 		}
-		m.T["relationinfo"] = (*data)["a_relationinfo"]
+		res := util.ObjArrToMapArr((*data)["a_relationinfo"].([]interface{}))
+		if len(res) > 0 {
+			for _, v := range res {
+				v["s_id"] = ""
+			}
+			m.T["relationinfo"] = res
+		}
 		m.T["a_visited"] = (*data)["a_visited"]
 		m.T["l_lastpushtime"] = (*data)["l_lastpushtime"]
 		m.T["a_lastpushids"] = (*data)["a_lastpushids"]
@@ -262,7 +268,7 @@ func (m *Follow) Photo(tp string) error {
 			mySelf["area"] = (*data)["area"]
 			mySelf["s_projectcode"] = projectcode
 			mySelf["s_url"] = (*data)["href"]
-			mySelf["s_id"] = id
+			mySelf["s_id"] = "" //id
 			mySelf["s_eid"] = util.EncodeArticleId2ByCheck(id)
 			mySelf["l_publishtime"] = (*data)["publishtime"]
 			if (*data)["industry"] == nil && (*data)["s_subscopeclass"] != nil {
@@ -301,6 +307,7 @@ func (m *Follow) Photo(tp string) error {
 			if len(res) > 0 {
 				for _, v := range res {
 					(*v)["s_eid"] = util.EncodeArticleId2ByCheck((*v)["s_id"].(string))
+					(*v)["s_id"] = ""
 				}
 				m.T["data"] = res
 			}
@@ -601,7 +608,7 @@ func (m *Follow) Set(tp, id string) error {
 			mySelf["area"] = (*data)["area"]
 			mySelf["s_projectcode"] = projectcode
 			mySelf["s_url"] = (*data)["href"]
-			mySelf["s_id"] = sid
+			mySelf["s_id"] = "" //sid
 			mySelf["s_eid"] = util.EncodeArticleId2ByCheck(sid)
 			mySelf["l_publishtime"] = (*data)["publishtime"]
 			////////////////////////
@@ -635,6 +642,7 @@ func (m *Follow) Set(tp, id string) error {
 			if len(res) > 0 || len(mySelf) > 0 {
 				for _, v := range res {
 					(*v)["s_eid"] = util.EncodeArticleId2ByCheck((*v)["s_id"].(string))
+					(*v)["s_id"] = ""
 				}
 				m.T["data"] = res
 			}
@@ -657,7 +665,13 @@ func (m *Follow) Set(tp, id string) error {
 				m.T["type"] = (*data)["type"]
 			}
 		}
-		m.T["relationinfo"] = (*data)["a_relationinfo"]
+		res := util.ObjArrToMapArr((*data)["a_relationinfo"].([]interface{}))
+		if len(res) > 0 {
+			for _, v := range res {
+				v["s_id"] = ""
+			}
+			m.T["relationinfo"] = res
+		}
 		m.T["a_visited"] = (*data)["a_visited"]
 		m.T["l_lastpushtime"] = (*data)["l_lastpushtime"]
 		m.T["a_lastpushids"] = (*data)["a_lastpushids"]

+ 8 - 2
src/jfw/modules/app/src/jfw/front/front.go

@@ -37,7 +37,7 @@ type Front struct {
 	tSGuide            xweb.Mapper `xweb:"/jyapp/tenderSubscribe/guide"`        //引导页
 	getRecomKWs        xweb.Mapper `xweb:"/jyapp/member/getRecomKWs"`           //获取推荐关键词
 	behaviorRecord     xweb.Mapper `xweb:"/jyapp/member/behaviorRecord"`        //记录用户点击的关键词
-	visitRedirect      xweb.Mapper `xweb:"/jyapp/visit/redirect"`               //剑鱼跳转访问请求,后续统计
+	//visitRedirect      xweb.Mapper `xweb:"/jyapp/visit/redirect"`               //剑鱼跳转访问请求,后续统计
 	wxpushAjaxReq      xweb.Mapper `xweb:"/jyapp/wxpush/bid/ajaxReq"`
 	delWxHistorySearch xweb.Mapper `xweb:"/jyapp/swordfish/delWxHistorySearch"` //剑鱼微信删除历史搜索
 	delOL              xweb.Mapper `xweb:"/jyapp/swordfish/delovertimelist"`    //手动删除30天无更新数据
@@ -199,7 +199,13 @@ func (f *Front) TSGuide() error {
 		} else if reqType == "over" {
 			mongodb.Update("user", bson.M{"s_m_openid": openId}, bson.M{"$set": bson.M{"i_ts_guide": 1}}, false, false)
 		} else if reqType == "preview" {
-			result["data"] = elastic.GetByNgram(INDEX, TYPE, strings.Split(f.GetString("key"), " "), "", FINDF, `{"publishtime":-1}`, `"_id","title","publishtime","toptype","subtype","type","area","href","areaval"`, 0, 10)
+			rlt := elastic.GetByNgram(INDEX, TYPE, strings.Split(f.GetString("key"), " "), "", FINDF, `{"publishtime":-1}`, `"_id","title","publishtime","toptype","subtype","type","area","href","areaval"`, 0, 10)
+			if *rlt != nil && len(*rlt) > 0 {
+				for _, v := range *rlt {
+					v["_id"] = util.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
+				}
+			}
+			result["data"] = rlt
 		}
 		f.ServeJson(result)
 	}

+ 2 - 2
src/jfw/modules/app/src/web/staticres/jyapp/js/common.js

@@ -93,9 +93,9 @@ function redirect(zbadd,link,sid,sds){
 		link="http://"+link
 	}
 	if(sds){
-		window.location.href="/jyapp/visit/redirect?id="+sid+"&url="+escape(link)+"&keywords="+encodeURIComponent(sds);
+		window.location.href=zbadd+"/jyapp/article/content/"+sid+".html?keywords="+encodeURIComponent(sds);
 	}else{
-		window.location.href="/jyapp/visit/redirect?id="+sid+"&url="+escape(link);
+		window.location.href=zbadd+"/jyapp/article/content/"+sid+".html?";
 	}
 }
 function newredirect(zbadd,link,sid,sds){

+ 1 - 1
src/jfw/modules/app/src/web/templates/followent/set.html

@@ -238,7 +238,7 @@ function myRedirect(zbadd,link,sid){
 	if(!/^http/.test(link)){
 		link="http://"+link
 	}
-	window.location.href=zbadd+"/jyapp/visit/redirect?id="+sid+"&url="+escape(link);
+	window.location.href="/";
 }
 </script>
 </head>

+ 2 - 17
src/jfw/modules/app/src/web/templates/weixin/follow/notice.html

@@ -141,30 +141,15 @@ function isVisited(sid){
 }
 function beforeRedirect(obj,sid,link,isOld){
 	if($(obj).hasClass("visited")){
-		if(isOld){
-			myRedirect({{Msg "seo" "ZBADDRESS"}},link,sid);
-		}else{
-			newredirect({{Msg "seo" "ZBADDRESS"}},link,sid);
-		}
+		newredirect({{Msg "seo" "ZBADDRESS"}},link,sid);
 		return;
 	}
 	var id = {{.T.id}};
 	$(obj).addClass("visited");
 	$.post("/jyapp/follow/notice/visited",{id:id,sid:sid,type:2},function(r){
-		if(isOld){
-			myRedirect({{Msg "seo" "ZBADDRESS"}},link,sid);
-		}else{
-			newredirect({{Msg "seo" "ZBADDRESS"}},link,sid);
-		}
+		newredirect({{Msg "seo" "ZBADDRESS"}},link,sid);
 	});
 }
-function myRedirect(zbadd,link,sid){
-	link = link.replace(/\n/g,"");
-	if(!/^http/.test(link)){
-		link="http://"+link
-	}
-	window.location.href=zbadd+"/jyapp/visit/redirect?id="+sid+"&url="+escape(link);
-}
 </script>
 </head>
 <body class="noticepage">

+ 1 - 1
src/jfw/modules/app/src/web/templates/weixin/follow/set.html

@@ -571,7 +571,7 @@ function myRedirect(zbadd,link,sid){
 	if(!/^http/.test(link)){
 		link="http://"+link
 	}
-	window.location.href=zbadd+"/jyapp/visit/redirect?id="+sid+"&url="+escape(link);
+	window.location.href="/";
 }
 //是否关注
 function isFollow(){

+ 4 - 4
src/jfw/modules/app/src/web/templates/weixin/wxpush.html

@@ -299,11 +299,11 @@ $(function(){
 				var h=$(this).attr("s");
 				var sid=$(this).attr("sid");
 				var eid=$(this).attr("eid");
-				if(eid){
+				//if(eid){
 					newredirect(zbadd,h,eid,sds);
-				}else{
-					redirect(zbadd,h,sid,sds);
-				}
+				//}else{
+					//redirect(zbadd,h,sid,sds);
+				//}
 				return false;
 			})
 		},800);

+ 2 - 2
src/jfw/modules/entsesearch/src/web/staticres/jylab/entsesearch/js/common.js

@@ -86,9 +86,9 @@ function redirect(zbadd,link,sid,sds){
 		link="http://"+link
 	}
 	if(sds){
-		window.location.href="/visit/redirect?id="+sid+"&url="+escape(link)+"&keywords="+encodeURIComponent(sds);
+		window.location.href=zbadd+"/article/content/"+sid+".html?keywords="+encodeURIComponent(sds);
 	}else{
-		window.location.href="/visit/redirect?id="+sid+"&url="+escape(link);
+		window.location.href=zbadd+"/article/content/"+sid+".html";
 	}
 }
 function newredirect(zbadd,link,sid,sds){

+ 2 - 2
src/jfw/modules/followent/src/web/staticres/jylab/followent/js/common.js

@@ -87,9 +87,9 @@ function redirect(zbadd,link,sid,sds){
 		link="http://"+link
 	}
 	if(sds){
-		window.location.href="/visit/redirect?id="+sid+"&url="+escape(link)+"&keywords="+encodeURIComponent(sds);
+		window.location.href=zbadd+"/article/content/"+sid+".html?keywords="+encodeURIComponent(sds);
 	}else{
-		window.location.href="/visit/redirect?id="+sid+"&url="+escape(link);
+		window.location.href=zbadd+"/article/content/"+sid+".html";
 	}
 }
 function newredirect(zbadd,link,sid,sds){

+ 1 - 1
src/jfw/modules/followent/src/web/templates/weixin/set.html

@@ -216,7 +216,7 @@ function myRedirect(zbadd,link,sid){
 	if(!/^http/.test(link)){
 		link="http://"+link
 	}
-	window.location.href=zbadd+"/visit/redirect?id="+sid+"&url="+escape(link);
+	window.location.href="/";
 }
 </script>
 </head>

+ 1 - 27
src/jfw/modules/pushproject/src/config.json

@@ -1,27 +1 @@
-{
-    "cassandra": {
-        "open": true,
-        "host": [
-            "192.168.3.207"
-        ],
-        "size": 5,
-        "cachesize": 10000,
-        "timeout": 20
-    },
-    "durationMinutes": "3",
-    "elasticPoolSize": 30,
-    "elasticsearch": "http://192.168.3.18:9800",
-    "lastid": "5a3fcff240d2d9bbe855af69",
-    "maxSearch": 50000,
-    "mongodbName": "qfw",
-    "mongodbPoolSize": "20",
-    "mongodbServers": "192.168.3.18:27080",
-    "redisServers": "sso=192.168.3.18:2379,other=192.168.3.18:2379,push=192.168.3.18:2379",
-    "rpcPort": "8759",
-    "viewDomain": "http://webzjk.qmx.top",
-    "weixinRpcServer": "127.0.0.1:8083",
-    "wxcolor": "#ffba00",
-    "wxcontent": "剑鱼推送",
-    "wxgroup": "关注项目",
-    "wxtitle": "您关注的项目《%s》有新的公告信息!"
-}
+{"cassandra":{"cachesize":10000,"host":["192.168.3.207"],"open":true,"size":5,"timeout":20},"durationMinutes":"3","elasticPoolSize":30,"elasticsearch":"http://192.168.3.18:9800","lastid":"5a3fcff240d2d9bbe855af69","maxSearch":50000,"mongodbName":"qfw","mongodbPoolSize":"20","mongodbServers":"192.168.3.18:27080","redisServers":"sso=192.168.3.18:3379,other=192.168.3.18:3379,push=192.168.3.18:3379","rpcPort":"8759","viewDomain":"http://webws.qmx.top","weixinRpcServer":"127.0.0.1:8083","wxcolor":"#ffba00","wxcontent":"剑鱼推送","wxgroup":"关注项目","wxtitle":"您关注的项目《%s》有新的公告信息!"}

+ 3 - 3
src/web/staticres/js/common.js

@@ -156,9 +156,9 @@ function redirect(zbadd,link,sid,sds){
 		link="http://"+link
 	}
 	if(sds){
-		window.location.href="/visit/redirect?id="+sid+"&url="+escape(link)+"&keywords="+encodeURIComponent(sds);
+		window.location.href=zbadd+"/article/content/"+sid+".html?keywords="+encodeURIComponent(sds);
 	}else{
-		window.location.href="/visit/redirect?id="+sid+"&url="+escape(link);
+		window.location.href=zbadd+"/article/content/"+sid+".html?";
 	}
 }
 function newredirect(zbadd,link,sid,sds){
@@ -169,7 +169,7 @@ function newredirect(zbadd,link,sid,sds){
 	if(sds){
 		window.location.href=zbadd+"/article/content/"+sid+".html?keywords="+encodeURIComponent(sds);
 	}else{
-		window.location.href=zbadd+"/article/content/"+sid+".html?";
+		window.location.href=zbadd+"/article/content/"+sid+".html";
 	}
 }
 function pcredirect(link,sid){

+ 2 - 2
src/web/templates/weixin/follow/allnotice.html

@@ -47,13 +47,13 @@ function isVisited(sid){
 }
 function beforeRedirect(obj,sid,link){
 	if($(obj).hasClass("visited")){
-		redirect({{Msg "seo" "ZBADDRESS"}},link,sid);
+		//redirect({{Msg "seo" "ZBADDRESS"}},link,sid);
 		return;
 	}
 	var id = {{.T.id}};
 	$(obj).addClass("visited");
 	$.post("/follow/notice/visited",{id:id,sid:sid,type:1},function(r){
-		redirect({{Msg "seo" "ZBADDRESS"}},link,sid);
+		//redirect({{Msg "seo" "ZBADDRESS"}},link,sid);
 	});
 }
 </script>

+ 2 - 17
src/web/templates/weixin/follow/notice.html

@@ -138,30 +138,15 @@ function isVisited(sid){
 }
 function beforeRedirect(obj,sid,link,isOld){
 	if($(obj).hasClass("visited")){
-		if(isOld){
-			myRedirect({{Msg "seo" "ZBADDRESS"}},link,sid);
-		}else{
-			newredirect({{Msg "seo" "ZBADDRESS"}},link,sid);
-		}
+		newredirect({{Msg "seo" "ZBADDRESS"}},link,sid);
 		return;
 	}
 	var id = {{.T.id}};
 	$(obj).addClass("visited");
 	$.post("/follow/notice/visited",{id:id,sid:sid,type:2},function(r){
-		if(isOld){
-			myRedirect({{Msg "seo" "ZBADDRESS"}},link,sid);
-		}else{
-			newredirect({{Msg "seo" "ZBADDRESS"}},link,sid);
-		}
+		newredirect({{Msg "seo" "ZBADDRESS"}},link,sid);
 	});
 }
-function myRedirect(zbadd,link,sid){
-	link = link.replace(/\n/g,"");
-	if(!/^http/.test(link)){
-		link="http://"+link
-	}
-	window.location.href=zbadd+"/visit/redirect?id="+sid+"&url="+escape(link);
-}
 </script>
 </head>
 <body class="noticepage">

+ 1 - 1
src/web/templates/weixin/follow/set.html

@@ -551,7 +551,7 @@ function myRedirect(zbadd,link,sid){
 	if(!/^http/.test(link)){
 		link="http://"+link
 	}
-	window.location.href=zbadd+"/visit/redirect?id="+sid+"&url="+escape(link);
+	window.location.href="/";
 }
 //是否关注
 function isFollow(){

+ 4 - 4
src/web/templates/weixin/follow/shareset.html

@@ -155,11 +155,11 @@ $(function(){
 	$(".jynotice").append(listhtml);
 });
 function beforeRedirect(obj,sid,link){
-	{{ if .T.openid}}
+	//{{ if .T.openid}}
 		window.location.href="{{Msg "seo" "ZBADDRESS"}}/article/content/"+sid+".html?url="+escape(link)+"&openid="+{{.T.openid}};
-	{{else}}
-		redirect({{Msg "seo" "ZBADDRESS"}},link,sid);
-	{{end}}
+	//{{else}}
+	//	redirect({{Msg "seo" "ZBADDRESS"}},link,sid);
+	//{{end}}
 }
 </script>
 </head>

+ 8 - 8
src/web/templates/weixin/wxpush.html

@@ -103,11 +103,11 @@ $(function(){
 		var h=abt.attr("href");
 		var sid=abt.attr("sid");
 		var eid=abt.attr("eid");
-		if(eid){
+		//if(eid){
 			newredirect(zbadd,h,eid,sds);
-		}else{
-			redirect(zbadd,h,sid,sds);
-		}
+		//}else{
+			//redirect(zbadd,h,sid,sds);
+		//}
 		return false;
 	}else{
 		document.title = '推送信息';
@@ -293,11 +293,11 @@ $(function(){
 					var h=$(this).attr("s");
 					var sid=$(this).attr("sid");
 					var eid=$(this).attr("eid");
-					if(eid){
+					//if(eid){
 						newredirect(zbadd,h,eid,sds);
-					}else{
-						redirect(zbadd,h,sid,sds);
-					}
+					//}else{
+					//	redirect(zbadd,h,sid,sds);
+					//}
 					return false;
 				})
 			},800);