浏览代码

剑鱼修改

renzheng 9 年之前
父节点
当前提交
f9789dea16

+ 14 - 0
core/src/qfw/swordfish/swordfishmanage.go

@@ -142,8 +142,22 @@ func getSwordFish(lasttime int64, sid string, res []map[string]interface{}, coun
 	}
 	return getSwordFish(thistime, sid, res, count)
 }
+
+//查看原文跳转
 func (s *SwordFish) VisitRedirect() {
+	sid := s.GetString("id")
 	surl := s.GetString("url")
+	if len(sid) > 5 {
+		obj := *mongodb.FindById("bidding", sid, `{"publishtime":1,"_id":0,"detail":1,"title":1}`)
+		if obj != nil && len(obj) == 3 {
+			obj["url"] = surl
+			pt := obj["publishtime"]
+			obj["publishtime"] = util.FormatDateWithObj(&pt, util.Date_Full_Layout)
+			s.T["obj"] = obj
+			s.Render("/swordfish/wxinfocontent.html", &s.T)
+			return
+		}
+	}
 	if surl != "" {
 		s.Redirect(surl)
 	}

+ 1 - 1
core/src/seo.json

@@ -1,4 +1,4 @@
-{   "cdn":"//cdn.qmx.top:9000",
+{   "cdn":"",
     "qfw": {
         "enterprise": {
             "description": "提供企业信息查询,企业产品服务查询,企业关系网展示",

+ 1 - 1
core/src/timetask.json

@@ -1 +1 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-02-26 14:36:30"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-02-26 14:36:30"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-03-02 18:08:35"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-03-02 18:08:35"}},"marketisstart":true,"marketrate":300}

+ 26 - 0
core/src/web/staticres/wxswordfish/jquery.resize.js

@@ -0,0 +1,26 @@
+jQuery.event.special.resizeblock = {
+	setup: function(data, namespaces) {
+		var elem = this;
+		var handler = jQuery.proxy(jQuery.event.special.resizeblock.handler, elem);
+		jQuery(elem).data('handler', elem);
+		var ifr = $('<iframe style="position: absolute; top:0; left:0; width:100%; height:100%; border:0; margin:0; padding:0; z-index: -100;" />');
+		jQuery(elem).append(ifr);
+		jQuery(elem).data('resize_frame', ifr);
+		var wnd = $(ifr).get(0).contentWindow;
+		jQuery(wnd).on  ('resize', handler);
+	},
+	teardown: function(namespaces) {
+		var elem = this;
+		var handler = jQuery(elem).data('handler');
+		var ifr = jQuery(elem).data('resize_frame');
+		var wnd = $(ifr).get(0).contentWindow;
+		jQuery(wnd).off ('resize', handler);
+		jQuery(elem).remove(ifr);
+		jQuery(elem).data('resize_frame', null);
+		jQuery(elem).data('handler', null);
+	},
+	handler: function(event) {
+		var elem = this;
+		jQuery(elem).triggerHandler('resizeblock');
+	}
+}

+ 59 - 2
core/src/web/staticres/wxswordfish/main.js

@@ -41,11 +41,13 @@ function KeyWordDialog(type,clickLi){
 	this.show = function(){
 		dialogObj.show();
 		$("html,body").addClass("overflow-hidden");
+		KeyWordDialog.SetContentHeight(dialogObj);
 		$(window).resize(function(){
 		  	KeyWordDialog.SetContentHeight(dialogObj);
 		});
 	};
 	this.hide = function(){
+		FOCUS=""
 		dialogObj.hide();
 		$("html,body").removeClass("overflow-hidden");
 		$(window).unbind("resize");
@@ -66,11 +68,57 @@ KeyWordDialog.SetContentHeight = function(dialogObj){
 	var padding = parseInt(contentObj.css('padding-top'))+parseInt(contentObj.css('padding-bottom'))
 	contentObj.css("max-height",document.body.clientHeight-dialogObj.find(".dialog-head").height()-padding-40);
 }
+
+function resizeKey(obj,parentObj){
+	var dialogTop=obj.closest(".dialog-main").offset().top
+		var H=63;
+		var ofh=obj.offset().top
+		var psh=parentObj[0].scrollHeight;
+		var pst=parentObj[0].scrollTop;
+		var poh=parentObj[0].offsetHeight;
+		//計算卷去的高度
+			var seq=poh+pst-psh
+		if(seq>5||seq<0){
+			parentObj[0].scrollTop=pst-seq
+		}else{
+			return
+		}
+		if(ofh<(dialogTop+H)){
+			parentObj[0].scrollTop=pst-((dialogTop+H)-ofh)
+		}else{
+			parentObj[0].scrollTop=pst+ofh-dialogTop-H
+		}
+}
+
+function _KeyFocus(objn){
+		var obj=$(objn),parentObj=obj.closest(".dialog-content");
+		resizeKey(obj,parentObj)
+		parentObj.unbind("resizeblock").bind("resizeblock",function(){
+			//resizeKey(obj,$(this));
+			parentObj.unbind("resizeblock");
+		})
+		//90
+		
+	//调整
+	//alert(dialogTop+"="+parentObj.height()+"="+obj.offset().top+"="+parentObj[0].offsetHeight+"="+parentObj[0].scrollHeight+"="+parentObj[0].scrollTop)
+}
+//
+var FOCUS
+function setFocus(obj){
+	if(!FOCUS){
+		FOCUS=$(obj)
+		var parentObj=FOCUS.closest(".dialog-content");
+		parentObj.unbind("resizeblock").bind("resizeblock",function(){
+				resizeKey(FOCUS,$(this));
+				parentObj.unbind("resizeblock");
+		})	
+	}
+}
 KeyWordDialog.AppendNode = function(dialogObj,value){
 	var getHtml = function(index,value){
 		return '<div class="keyWordGroup">'
 					+'<lable style="white-space:nowrap;">关键词<font>'+index+'</font></lable>'
-					+'<div><input type="text" value="'+(value?value:"")+'" placeholder="示例:综合布线 电话线 网线" maxlength="100"></div>'
+					+'<div><input type="text" onfocus="setFocus(this)" value="'+(value?value:"")+'" placeholder="示例:综合布线 电话线 网线" maxlength="100"></div>'
 					+'<div>'+(index==1?'':'<img src="/wxswordfish/images/delete.png" class="delete">')+'</div>'
 				+'</div>';
 	}
@@ -81,7 +129,7 @@ KeyWordDialog.AppendNode = function(dialogObj,value){
 	var obj = $(getHtml(count+1,value));
 	dialogObj.find(".addKeyWordArea").before(obj);
 	//自动滚动到底部
-	$("#a_end")[0].scrollIntoView();
+	dialogObj.find(".a_end")[0].scrollIntoView();
 	obj.find(".delete").click(function(){
 		dialogObj.find(".addKeyWord").removeAttr("disabled");
 		$(this).parents(".keyWordGroup").remove();
@@ -524,4 +572,13 @@ $(function(){
 	if(winWidth<341){
 		$("#prexieyi").append("<br>");
 	}
+	//预览跳转
+	$(".result-view").click(function(){
+		var val=$(this).closest("li").find("ul>li:first-child>div.com-last").text().replace(/\s+/ig,"")
+		if(val){
+			window.location.href="/wxpush/bid/wxpushview/"+$(this).attr("v")
+		}else{
+			alert("请输入关键字后预览。")
+		}
+	})
 });

+ 20 - 5
core/src/web/staticres/wxswordfish/style.css

@@ -58,10 +58,10 @@ img{
 }
 /**************/
 .operation{
-	background-color: #F8F8F8;
 	margin-bottom: 20px;
 }
 .operation>.parent-node{
+	background-color: #F8F8F8;
 	width: 100%;
 	height: 54px;
 	line-height: 54px;
@@ -69,6 +69,23 @@ img{
 	position: relative;
 	font-size: 16px;
 }
+.parent-node-view{
+	width: 100%;
+	height: 50px;
+	line-height: 50px;
+	font-size: 16px;
+	text-align:center;
+}
+.result-view{
+	width:80%;
+	margin:5px auto;
+	background-color:#F5F4F4;
+	color:black;
+	font-family: tahoma, arial, 'Hiragino Sans GB', 'Microsoft YaHei', 宋体, sans-serif;
+	font-size: 14px;
+	font-size:16px;
+	border:1px solid #DBDBDB;
+}
 .operation>.parent-node>img{
 	margin-left: 10px;
 	margin-right: 10px;
@@ -114,12 +131,10 @@ img{
 	display: none;
 }
 .operation .child-node li{
-	border-top: 1px solid #ddd;
+	border-bottom: 1px solid #ddd;
 	padding: 15px 0px;
 }
-.operation .child-node li:first-child{
-	border-top-width: 0px;
-}
+
 .operation .child-node img{
 	width: 10px;
 	height: 17px;

+ 68 - 0
core/src/web/templates/swordfish/wxinfocontent.html

@@ -0,0 +1,68 @@
+<html>
+<head>
+<meta name="viewport" content="width=device-width,initial-scale=1.0">
+<title>企明星-剑鱼-信息推送</title>
+<link href="{{Msg "seo" "cdn"}}/wxswordfish/style.css" rel="stylesheet">
+<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
+<script src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js"></script>
+<script>
+initShare({{.T.signature}},{{.T.shareid}});
+$(function(){
+	var hm = document.createElement("script");
+	hm.src = "//hm.baidu.com/hm.js?ed198b177e527bb53684db20bb390e77";
+	var s = document.getElementsByTagName("script")[0]; 
+	s.parentNode.insertBefore(hm, s);
+})
+</script>
+<style type="text/css">
+body{
+	margin:0;
+	padding:0;
+	color: #333;
+	padding-bottom: 50px;
+	font-size:14px;
+	font-family: tahoma, arial, 'Hiragino Sans GB', 'Microsoft YaHei', 宋体, sans-serif;
+}
+pre {
+	white-space: pre-wrap;
+	word-wrap: break-word;
+	font-family: tahoma, arial, 'Hiragino Sans GB', 'Microsoft YaHei', 宋体, sans-serif;
+	color:#5E6060;
+}
+.content{
+	padding:5px;
+}
+.info{
+	width:100%;
+}
+.abs{
+	height:35px;
+	line-height:35px;
+	text-overflow:ellipsis;
+    white-space:nowrap;
+    overflow:hidden;
+	padding:5px;
+	background-color:#F7F8FA;
+}
+.title{
+	width:90%;
+	margin:0 auto;
+	font-size:16px;
+	text-align:center;
+	font-weight:bolder;
+	padding-top:5px;
+	padding-bottom:5px;
+	color:#474747;
+}
+</style>
+</head>
+<body>
+<div class="info">
+	<div class="title">{{.T.obj.title}}</div>
+	<div class="abs">文章原始连接:<a href="{{.T.obj.url}}">{{.T.obj.url}}</a></div>
+	<div class="content" style=""><pre>{{.T.obj.detail}}</pre></div>
+</div>
+{{include "/swordfish/wxtoolbar.html"}}
+</body>
+</html>

+ 8 - 5
core/src/web/templates/swordfish/wxpush.html

@@ -21,9 +21,11 @@ $(function(){
 	var a_publishtime = {{.T.data.a_publishtime}};
 	var s_content={{.T.data.s_content}}
 	var mark="为你推送以下信息:"
-	if(!s_content){
+	if(!s_content&&"1"==b_view){
 		s_content="<div></div>"
-		mark=",在最新5天的数据中,没有匹配到相应的信息,请更换关键字或继续使用观察。<a style='text-decoration:underline' href='javascript:history.go(-1)'>返回</a>"
+		mark=",在最新5天的数据中,没有匹配到相应的信息,请更换关键字或继续观察、使用。<a style='text-decoration:underline' href='javascript:history.go(-1)'>返回</a>"
+	}else if("1"==b_view){
+		mark="为你推送以下预览信息(<a style='text-decoration:underline' href='javascript:history.go(-1)'>返回</a>):"
 	}
 	$("body").prepend(s_content);
 	if(typeof(s_words) != "undefined" && s_words.length > 0){
@@ -104,7 +106,8 @@ $(function(){
 			abt.click(function(){
 				setVisitedIndex($(this));
 				var h=$(this).attr("s");
-				redirect(h);
+				var sid=$(this).attr("sid");
+				redirect(h,sid);
 				return false;
 			})
 		},800)
@@ -116,11 +119,11 @@ function open_window(link){
     var arg = '\u003cscript\u003elocation.replace("'+link+'")\u003c/script\u003e';
     window.open('javascript:window.name;', arg);
 }
-function redirect(link){ 
+function redirect(link,sid){ 
 	if(!/^http/.test(link)){
 		link="http://"+link
 	}
-	window.location.href="/visit/redirect?url="+escape(link)
+	window.location.href="/visit/redirect?id="+sid+"&url="+escape(link)
 
 }
 function setVisitedIndex(obj){

+ 11 - 3
core/src/web/templates/swordfish/wxrssset.html

@@ -9,6 +9,7 @@
 <script src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
 <script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js"></script>
 <script src="{{Msg "seo" "cdn"}}/wxswordfish/main.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/jquery.resize.js"></script>
 <script>
 	var msgset= {{.T.msgset}};
 	initShare({{.T.signature}},{{.T.shareid}});
@@ -41,8 +42,11 @@
 					<div>信息范围<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/right.png"></div>
 				</li>
 			</ul>
-			<a href="/wxpush/bid/wxpushview/tender">结果预览</a>
+			<div  class="parent-node-view">
+				<button class="btn result-view" v="tender" >结果预览</button >	
+			</div>
 		</li>
+
 		<li class="parent-node" id="bid">
 			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/zhongbiao.png">
 			中标公告
@@ -58,7 +62,11 @@
 					<div>信息范围<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/right.png"></div>
 				</li>
 			</ul>
+			<div  class="parent-node-view">
+				<button class="btn result-view" v="bid" >结果预览</button >	
+			</div>
 		</li>
+		
 		<li class="parent-node">
 			<img src="{{Msg "seo" "cdn"}}/wxswordfish/images/qingbao.png">
 			企业情报
@@ -82,11 +90,11 @@
 				<div>订阅关键词<span>最多订阅10组关键词</span></div>
 				<div><span class="submit">确定</span></div>
 			</div>
-			<div class="dialog-content">
+			<div class="dialog-content" style="position:relative">
 				<div class="addKeyWordArea">
 					<lable></lable>
 					<div><button class="btn addKeyWord"><span class="icon">+</span>添加关键词</button></div>
-					<div id="a_end"></div>
+					<div class="a_end"></div>
 				</div>
 			</div>
 		</div>

+ 6 - 3
push/src/qfw/push/dopush/dopush.go

@@ -10,6 +10,7 @@ import (
 	"qfw/util"
 	"qfw/util/mongodb"
 	qrpc "qfw/util/rpc"
+	"regexp"
 	"runtime"
 	"strconv"
 	"strings"
@@ -17,9 +18,11 @@ import (
 )
 
 var se util.SimpleEncrypt
+var re *regexp.Regexp
 
 func init() {
 	se = util.SimpleEncrypt{Key: "topnet"}
+	re, _ = regexp.Compile("<[^>]+>([^<]+)<[^>]+>")
 }
 
 type Pjob struct {
@@ -119,7 +122,7 @@ func (p *Pjob) EachInfoForView(mopenid string) map[string]interface{} {
 			if !publishTitle[title] {
 				publishTitle[title] = true
 				i++
-				str += "<div class='tslist'><span class='xh'>" + fmt.Sprintf("%d", i) + ".</span><a class='bt' target='_blank' href='" + k2["href"].(string) + "'>" + title + "</a></div>"
+				str += "<div class='tslist'><span class='xh'>" + fmt.Sprintf("%d", i) + ".</span><a class='bt' target='_blank' sid='" + util.BsonIdToSId(k2["_id"]) + "'  href='" + k2["href"].(string) + "'>" + title + "</a></div>"
 				publishTimes[strconv.Itoa(i)] = k2["publishtime"]
 			}
 		}
@@ -254,10 +257,10 @@ func Send(k *push.MemberInterest, v *list.List, now time.Time, TITLEA, ShortTitl
 			publishTitle[title] = true
 			i++
 			if i == 1 {
-				firstTitle = title
+				firstTitle = re.ReplaceAllString(title, "$1")
 				lastInfoDate = k2["publishtime"].(int64)
 			}
-			str += "<div class='tslist'><span class='xh'>" + fmt.Sprintf("%d", i) + ".</span><a class='bt' target='_blank' href='" + k2["href"].(string) + "'>" + title + "</a></div>"
+			str += "<div class='tslist'><span class='xh'>" + fmt.Sprintf("%d", i) + ".</span><a class='bt' target='_blank' sid='" + util.BsonIdToSId(k2["_id"]) + "' href='" + k2["href"].(string) + "'>" + title + "</a></div>"
 			publishTimes[strconv.Itoa(i)] = k2["publishtime"]
 			if i >= MaxPushSize {
 				//限制最大信息条数

+ 3 - 3
push/src/qfw/push/wxcall_test.go

@@ -2,6 +2,7 @@ package push
 
 import (
 	"log"
+	"regexp"
 
 	qrpc "qfw/util/rpc"
 	"testing"
@@ -9,9 +10,8 @@ import (
 )
 
 func Test_date(t *testing.T) {
-	a := int64(20000)
-	b := int64(9999)
-	log.Println((a - b) / 60)
+	re, _ := regexp.Compile("<[^>]+>([^<]+)<[^>]+>")
+	log.Println(re.ReplaceAllString("[<span area='ccc'>河南</span>]你就是《原梓菲》<a>dasd脸色</a>", "$2"))
 }
 
 func TestWeixinRpc(t *testing.T) {

+ 2 - 0
weixin/src/qfw/weixin/rpc/rpc.go

@@ -48,6 +48,7 @@ func (wxrpc *WeiXinRpc) SendPushTplMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResul
 			} `json:"first"`
 			Detail struct {
 				Value string `json:"value"`
+				Color string `json:"color"`
 			} `json:"keyword1"`
 			Date struct {
 				Value string `json:"value"`
@@ -65,6 +66,7 @@ func (wxrpc *WeiXinRpc) SendPushTplMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResul
 	msg.Url = param.Url
 	msg.Data.Title.Value = param.Title
 	msg.Data.Detail.Value = param.Detail
+	msg.Data.Detail.Color = "#FB0004"
 	msg.Data.Date.Value = param.Date
 	msg.Data.Service.Value = param.Service
 	msg.Data.Remark.Value = param.Remark