浏览代码

修改推送程序,中标推送没有延长时间

renzheng 9 年之前
父节点
当前提交
83b29e6715

+ 2 - 3
core/src/qfw/mobile/wxmenu.go

@@ -343,7 +343,6 @@ func (m *Mobile) WxpushView(stype string) error {
 	util.Try(func() {
 		//对用户进行推送
 		var repl []byte
-		log.Println("=====", stype)
 		clent, errs := rpc.DialHTTP("tcp", coreconfig.SysConfig.PushRpc)
 		defer clent.Close()
 		mapPush := map[string]string{}
@@ -357,14 +356,14 @@ func (m *Mobile) WxpushView(stype string) error {
 			b = true
 			var mp map[string]interface{}
 			json.Unmarshal(repl, &mp)
-			log.Println("==mp==", mp)
-			m.T["mp"] = mp
+			m.T["data"] = mp
 		}
 	}, func(e interface{}) {
 		log.Println("给用户推送出错", e)
 	})
 	if b {
 		//m.T["signature"] = GetSignature(m.Url())
+		m.T["view"] = 1
 		m.T["shareid"] = cutil.FindMyShareId("topjy", m.Session().Get("s_m_openid").(string))
 		return m.Render("/swordfish/wxpush.html", &m.T)
 	} else {

+ 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-22 17:51:29"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-02-22 17:51:29"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-02-24 18:07:19"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-02-24 18:07:19"}},"marketisstart":true,"marketrate":300}

+ 10 - 3
core/src/web/templates/swordfish/wxpush.html

@@ -8,6 +8,7 @@
 <script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js"></script>
 <script>
 initShare({{.T.signature}},{{.T.shareid}});
+var b_view = "{{.T.view}}";
 $(function(){
 	var hm = document.createElement("script");
 	hm.src = "//hm.baidu.com/hm.js?ed198b177e527bb53684db20bb390e77";
@@ -18,9 +19,15 @@ $(function(){
 	var a_visitedindex = {{.T.data.a_visitedindex}};
 	var s_type = {{.T.data.s_type}};
 	var a_publishtime = {{.T.data.a_publishtime}};
-	$("body").prepend({{.T.data.s_content}});
+	var s_content={{.T.data.s_content}}
+	var mark="为你推送以下信息:"
+	if(!s_content){
+		s_content="<div></div>"
+		mark=",在最新5天的数据中,没有匹配到相应的信息,请更换关键字或继续使用观察。<a style='text-decoration:underline' href='javascript:history.go(-1)'>返回</a>"
+	}
+	$("body").prepend(s_content);
 	if(typeof(s_words) != "undefined" && s_words.length > 0){
-		$("body>div:first").html('根据你设置的'+(s_type=="tender"?"招标公告":s_type=="bid"?"中标公告":"")+'关键词(<font class="keyword">'+s_words.join(" ; ").replace(/\+/gm," ")+'</font>)为你推送以下信息:');
+		$("body>div:first").html('根据你设置的'+(s_type=="tender"?"招标公告":s_type=="bid"?"中标公告":"")+'关键词(<font class="keyword">'+s_words.join(" ; ").replace(/\+/gm," ")+'</font>)'+mark);
 	}else{
 		$("body>div:first").remove();
 	}
@@ -117,7 +124,7 @@ function redirect(link){
 
 }
 function setVisitedIndex(obj){
-	if(obj.hasClass("visited")){
+	if(obj.hasClass("visited")||b_view){
 		return;
 	}
 	obj.addClass("visited");

+ 1 - 1
credit/src/config.json

@@ -96,5 +96,5 @@
     "saveLogDuration": 1,
     "checkGiveDuration": 30,
     "swordfish_tipBeforeDays": "3,1",
-    "swordfish_subHour": 18
+    "swordfish_subHour": 10
 }

+ 4 - 4
credit/src/main.go

@@ -235,12 +235,12 @@ func TimerSwordFishFromUser() {
 									//提示
 									for _, v := range swordfish_tipBeforeDays {
 										if v == sub64 {
-											creditrpc.SendMsgWebAndWx(swordfish_dueTitle, fmt.Sprintf(swordfish_due, v), util.BsonIdToSId(tmp["_id"]), tmp["s_m_openid"].(string))
+											creditrpc.SendMsgWebAndWx(swordfish_dueTitle+"["+creditrpc.Message["txt_"+code]+"]", fmt.Sprintf(swordfish_due, v), util.BsonIdToSId(tmp["_id"]), tmp["s_m_openid"].(string))
 										}
 									}
 								}
 							}, func(e interface{}) {
-								log.Println("提前提示发送ERROR:", e)
+								log.Println("提前提示或扣积分ERROR:", e, tmp)
 							})
 							tmp = make(map[string]interface{})
 						}
@@ -283,13 +283,13 @@ func doSubCreditByUser(userId, umid, typeName, code string, next *time.Time, use
 			}
 			if creditlog.Save(creditDoc) {
 				//发送微信通知扣积分成功
-				creditrpc.SendMsgWebAndWx(swordfish_payTitle, fmt.Sprintf(swordfish_pay, -codeNum, restNum, util.FormatDate(&newDate, util.Date_Full_Layout)), userId, umid)
+				creditrpc.SendMsgWebAndWx(swordfish_payTitle+"["+creditrpc.Message["txt_"+code]+"]", fmt.Sprintf(swordfish_pay, -codeNum, restNum, util.FormatDate(&newDate, util.Date_Full_Layout)), userId, umid)
 			}
 		} else { //暂停操作
 			//更新操作
 			if mongodb.Update("user", `{"_id":"`+userId+`"}`, `{"$set":{"o_msgset.`+typeName+`.i_status":0}}`, false, false) {
 				//暂停通知,因积分不够
-				creditrpc.SendMsgWebAndWx(swordfish_closeTitle, swordfish_close, userId, umid)
+				creditrpc.SendMsgWebAndWx(swordfish_closeTitle+"["+creditrpc.Message["txt_"+code]+"]", swordfish_close, userId, umid)
 			}
 		}
 	}, func(e interface{}) {

+ 1 - 1
credit/src/qfw/creditlog/creditlog.go

@@ -41,7 +41,7 @@ func Save(doc map[string]interface{}) bool {
 		Failed("保存到日志记录失败," + string(v))
 	} else {
 		//更新积分 i_credit到人
-		if doc["s_code"].(string) == "A1" {
+		if doc["s_code"].(string) == "A1" || doc["s_code"].(string) == "A2" {
 			b = mongodb.Update("user", `{"_id":"`+doc["s_uid"].(string)+`"}`, &map[string]interface{}{
 				"$inc": map[string]int{
 					"i_credit": doc["i_score"].(int),

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

@@ -103,6 +103,7 @@ func (p *Pjob) EachInfoForView(mopenid string) map[string]interface{} {
 		}
 	}
 	mcontent := map[string]interface{}{}
+	mcontent["s_type"] = p.Stype
 	bmatch := false
 	for kk, vv := range *(userMap) {
 		k := *kk
@@ -124,22 +125,20 @@ func (p *Pjob) EachInfoForView(mopenid string) map[string]interface{} {
 		}
 		if len(publishTimes) > 0 {
 			bmatch = true
-			mcontent["pushtimes"] = publishTimes
-			mcontent["content"] = str
-			mcontent["keys"] = k.Interest
+			mcontent["a_publishtime"] = publishTimes
+			mcontent["s_content"] = str
+			mcontent["s_words"] = k.Interest
 		}
 	}
 	mcontent["bmatch"] = bmatch
 	if !bmatch {
-		mcontent["type"] = p.StypeName
 		for _, one := range *p.Cache {
 			for _, onep := range *one {
-				mcontent["keys"] = onep.Interest
+				mcontent["s_words"] = onep.Interest
 				break
 			}
 			break
 		}
-		mcontent["keys"] = p.StypeName
 	}
 
 	return mcontent

+ 4 - 3
push/src/qfw/push/rpcpush/rpcpush.go

@@ -17,7 +17,8 @@ type PushInfo struct {
 var PushInfoScopeDays int
 
 //RPC调用结果预览
-func (p *PushInfo) ResultView(data *qrpc.PushData, Reply *[]byte) {
+func (p *PushInfo) ResultView(data *qrpc.PushData, Reply *[]byte) error {
+	log.Println("rpc_data", data)
 	util.Try(func() {
 		for k, v := range data.PushType {
 			pj := dopush.Pjob{
@@ -26,11 +27,11 @@ func (p *PushInfo) ResultView(data *qrpc.PushData, Reply *[]byte) {
 				StypeName:   v,
 			}
 			mp := pj.EachInfoForView(data.Mopenid)
-			log.Println("mp:", mp)
+			log.Println("mp:", len((mp)))
 			*Reply, _ = json.Marshal(mp)
 		}
-
 	}, func(e interface{}) {})
+	return nil
 }
 
 //RPC调用推送信息