Browse Source

Merge branch 'develop' of 192.168.3.17:zhanghongbo/qfw into develop

wangchuanjin 9 năm trước cách đây
mục cha
commit
a4da9ef624

+ 2 - 1
common/src/qfw/util/encrypt_test.go

@@ -22,9 +22,10 @@ func Test_sim(t *testing.T) {
 	//s2 := "GyUlIhEDDjcfWCAyIl4xBkgsERYiLAwZLCg9VkkbLj4zMRYDPRs5ATVZOxccPAkzFxw7CCpEFj41QlRAQFdFXlRMQVZcHRIbBgsWBxYcFQwEBwoa"
 
 	//s3 := "RFYoal5bCFdXWQoQB0JuWwlXAQFZCUVfFj4JMFtT"
-	s4 := "oJULtwzXo6EFV1Ah-XeyRBimXGM8,uid,123456,swordfishaction"
+	s4 := "oJULtwzXo6EFV1Ah-XeyRBimXGM8,uid,123456,wxpushlist"
 	se := SimpleEncrypt{Key: "topnet"}
 	log.Println("=====", se.EncodeString(s4))
+	log.Println("=====", se.EncodeString(",1349385977,ASD"))
 	log.Println("---", se.DecodeString("GyUlIhEDDjcfWCAyIl4xBkgsERYiLAwZLCg9VkkBHQtcX1FBR1hJWldCREMHFhUBBwccBxYA"))
 	now := time.Now()
 	tom := time.Date(now.Year(), now.Month(), now.Day(), 18, 0, 0, 0, time.Local)

+ 4 - 4
core/src/luckdraw.json

@@ -8,7 +8,7 @@
 	},{
 		"min":50,
 		"max":80,
-		"proportion":37.21
+		"proportion":16.71
 	},{
 		"min":95,
 		"max":120,
@@ -16,7 +16,7 @@
 	},{
 		"min":140,
 		"max":175,
-		"proportion":20
+		"proportion":50
 	},{
 		"min":190,
 		"max":220,
@@ -24,7 +24,7 @@
 	},{
 		"min":235,
 		"max":270,
-		"proportion":37.21
+		"proportion":16.71
 	},{
 		"min":280,
 		"max":310,
@@ -32,7 +32,7 @@
 	},{
 		"min":325,
 		"max":350,
-		"proportion":4
+		"proportion":15
 	}],
 	"promotioncode":"2001001501",
 	"weixin":{

+ 12 - 5
core/src/qfw/active/activemanage.go

@@ -5,6 +5,7 @@ package active
 
 import (
 	"fmt"
+	"github.com/dchest/captcha"
 	"github.com/go-xweb/xweb"
 	"gopkg.in/mgo.v2/bson"
 	"math/rand"
@@ -88,9 +89,15 @@ func (a *Activemanage) Luckdraw(activecode, id string) error {
 
 //
 func (a *Activemanage) Getluckdraw() error {
+	fmt.Println("checkcode:", a.GetString("checkCodeId"))
 	flog := "F"
 	//提示语
 	msg := ""
+	if a.GetSession("CheckCodeId") == nil || !captcha.VerifyString(a.GetSession("CheckCodeId").(string), a.GetString("checkCodeId")) {
+		flog := "M"
+		msg = "验证码错误!请重新输入验证码!"
+		return a.Write(`{"flog":"` + flog + `","msg":"` + msg + `"}`)
+	}
 	id := ""
 	today := time.Now()
 	openid := a.GetSession("s_m_openid").(string)
@@ -211,22 +218,22 @@ func getLuckDraw() int {
 		} else if amount > 275 && amount < 310 {
 			count := Count("winningrecord", "{'s_prize':'《牛奶可乐经济学》'}")
 			if count > 6 {
-				amount = 240
+				amount = 245
 			}
 		} else if amount > 95 && amount < 130 {
 			count := Count("winningrecord", "{'s_prize':'限量版U盘'}")
 			if count > 100 {
-				amount = 260
+				amount = 255
 			}
 		} else if amount > 185 && amount < 220 {
 			count := Count("winningrecord", "{'s_prize':'五元现金红包'}")
 			if count > 200 {
-				amount = 60
+				amount = 65
 			}
 		} else if amount > 320 && amount < 355 {
 			count := Count("winningrecord", "{'s_prize':'一元现金红包'}")
-			if count > 1500 {
-				amount = 80
+			if count > 2500 {
+				amount = 75
 			}
 		}
 		return amount

+ 5 - 1
core/src/timetask.json

@@ -1 +1,5 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-27 12:14:08"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-27 12:14:08"}},"marketisstart":true,"marketrate":300}
+<<<<<<< HEAD
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-28 09:39:35"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-28 09:39:35"}},"marketisstart":true,"marketrate":300}
+=======
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-26 17:33:46"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-26 17:33:46"}},"marketisstart":true,"marketrate":300}
+>>>>>>> 4ae19393438c02869446c485a2d9a0593fab86f7

+ 104 - 36
core/src/web/templates/active/luckdraw.html

@@ -21,7 +21,7 @@
 .lotteryMain{ width:100%;}
 .lotteryBg{ width:100%; height:608px; margin:0 auto; background:url(/images/activeimages/lotteryBg.png) no-repeat top center; position:relative; overflow:hidden;background-size: 375px 508px;}
 #run{ width:145px; height:145px; position:absolute; left:50%; top:50%;  margin-left:-73px; margin-top:-53px; z-index:1; transform:rotate(0deg); -ms-transform:rotate(0deg); }
-#btn_run{ width:80px; height:80px; background:url(/images/activeimages/btn_start.png) no-repeat; border:none; outline:none; position:absolute; left:50%; top:50%; margin-left:-40px; margin-top:-22px; z-index:2;cursor:pointer;background-position:0px 0px;background-size: 100% 100%;}
+#btn_run_one{ width:80px; height:80px; background:url(/images/activeimages/btn_start.png) no-repeat; border:none; outline:none; position:absolute; left:50%; top:50%; margin-left:-40px; margin-top:-22px; z-index:2;cursor:pointer;background-position:0px 0px;background-size: 100% 100%;}
 .col-xs-12 p{
 	margin:0px 0px 5px;
 }
@@ -33,6 +33,52 @@
    data-target="#myModal">
    开始
 </button>
+<button class="btn btn-primary btn-lg mycode  hidden" data-toggle="modal" 
+   data-target="#mycode">
+   开始
+</button>
+
+
+<!-- 模态框(Modal) -->
+<div class="modal fade" id="mycode" tabindex="-1" role="dialog" 
+   aria-labelledby="myModalLabel" aria-hidden="true" style="padding-top: 25%;">
+   <div class="modal-dialog">
+      <div class="modal-content">
+	
+         <div class="modal-header">
+            <button type="button" class="close" 
+               data-dismiss="modal" aria-hidden="true" style="width: 40px;height: 30px;">
+                  &times;
+            </button>
+            <h4 class="modal-title" id="myModalLabel">
+               企明星新年大抽奖
+            </h4>
+         </div>
+         <div class="modal-body">
+           	 <div class="form-group" style="margin-top:20px;">
+				<label class="col-md-3 control-label"><span style="color:#D03102;margin-right:5px;">*</span>请输入抽奖验证码:</label>
+				<div class="input-group col-md-6 checkCodeId">
+					<input type="text" name="checkCodeId" class="form-control inputxt" maxlength="4" id="chedkcode" style="height:52px;">
+					<span class="input-group-addon " id="phone-checkCodeId">
+						<img id="phone_captcha" src="/tool/captcha" onClick="reLoadCaptcha('phone_captcha');">
+						<a onClick="reLoadCaptcha('phone_captcha');" class="text-primary">刷新</a>
+					</span>
+				</div>
+			  </div>
+				<div style="margin-top:20px;" class="form-group">
+				<div class="col-sm-2"></div>
+				<div class="col-sm-4 ">
+				<input type="button" class="btn btn-primary" id="btn_run"  value="开始抽奖">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+				</div>
+				<div class="col-sm-6"></div>
+				</div>
+	
+         </div>
+         <div class="modal-footer">
+         </div>
+      </div><!-- /.modal-content -->
+</div><!-- /.modal -->
+</div>
 <!-- 模态框(Modal) -->
 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" 
    aria-labelledby="myModalLabel" aria-hidden="true" style="padding-top: 25%;">
@@ -59,7 +105,7 @@
 <section class="lotteryMain">
 	<div class="lotteryBg">
     	<img id="run" src="/images/activeimages/start.png" />
-        <input id="btn_run" type="button" value="" />
+        <input id="btn_run_one" type="button" value="" />
     </div>
 </section> 
 <div class="col-xs-12" style="color:#fff; margin-top:-135px;font-weight:600;">
@@ -73,54 +119,76 @@
 </div> 
 <script>
 
+
+function reLoadCaptcha(){
+	document.getElementById('phone_captcha').src='/tool/captcha?rnd='+Math.random()
+}
 $(function(){ 
+	$("#btn_run_one").click(function(){
+		$(".mycode").click();
+	    });
     var flog = {{.T.flog}};
 	if (flog == "A"){
 		$(".modal-body").html("{{.T.msg}}")
 		$(".modstart").click();
-		$("#btn_run").attr('disabled',true).css("cursor","pointer").css("background","url(/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
+		$("#btn_run_one").attr('disabled',true).css("cursor","pointer").css("background","url(/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
 	}else if (flog == "B"){
 		$(".modal-body").html("{{.T.msg}}")
 		$(".modstart").click();
-		$("#btn_run").attr('disabled',true).css("cursor","pointer").css("background","url(/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
+		$("#btn_run_one").attr('disabled',true).css("cursor","pointer").css("background","url(/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
 	}
-     $("#btn_run").click(function(){
-		$("#btn_run").attr('disabled',true).css("cursor","default"); 
+
+    $("#btn_run").click(function(){
         lottery(); 
     });
 	
+	
 }); 
 function lottery(){ 
-    $.ajax({ 
-        type: 'post', 
-        url: '/activity/luckdraw', 
-        dataType: 'json', 
-        cache: false, 
-        error: function(){return false;}, 
-        success:function(obj){
-			if (obj.flog == "T"){
-				$("#run").rotate({ 
-					duration:5000, //转动时间 
-					angle: 0, //默认角度
-					animateTo:360*3+obj.rotate, //转动角度 
-					easing: $.easing.easeOutSine, 
-					callback: function(){ 
-						//alert(obj.results); 
-						$("#btn_run").attr('disabled',true).css("cursor","pointer").css("background","url(/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%"); 
-							$(".modal-body").html(obj.msg)
-							$(".modstart").click();
-							$("#btn_run").attr('disabled',true).css("cursor","pointer").css("background","url(/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
-					} 
-				});
-			}else if (obj.flog=="A"){
-				$(".modal-body").html(obj.msg)
-				$(".modstart").click();
-			}else if (obj.flog=="F"){
-				$(".modal-body").html("  小主来晚了,抽奖活动已过期!如果有疑问请联系企明星!")
-				$(".modstart").click();
-			}
-        } 
-    }); 
+	var chedkcode = $("#chedkcode").val();
+	if(chedkcode&&chedkcode.length==4){
+	    $.ajax({ 
+	        type: 'post', 
+	        url: '/activity/luckdraw', 
+			data:{"checkCodeId":chedkcode},
+	        dataType: 'json', 
+	        cache: false, 
+	        error: function(){return false;}, 
+	        success:function(obj){
+				if (obj.flog=="M"){
+					//$("#mycode").modal("show");
+					reLoadCaptcha();
+					return
+				}else if (obj.flog == "T"){
+					$("#mycode").modal("hide");
+					$("#run").rotate({ 
+						duration:5000, //转动时间 
+						angle: 0, //默认角度
+						animateTo:360*3+obj.rotate, //转动角度 
+						easing: $.easing.easeOutSine, 
+						callback: function(){ 
+							//alert(obj.results); 
+								$(".modal-body").html(obj.msg)
+								$(".modstart").click();
+								$("#btn_run_one").attr('disabled',true).css("cursor","pointer").css("background","url(/images/activeimages/btn_end.png) no-repeat").css("background-size","100% 100%");
+						} 
+					});
+				}else if (obj.flog=="A"){
+					$("#mycode").modal("hide");
+					$(".modal-body").html(obj.msg)
+					$(".modstart").click();
+				}else if (obj.flog=="F"){
+					$("#mycode").modal("hide");
+					$(".modal-body").html("  小主来晚了,抽奖活动已过期!如果有疑问请联系企明星!")
+					$(".modstart").click();
+				}
+				
+	        } 
+	    }); 
+	}else{
+		reLoadCaptcha();
+	}
+	
 };
 </script>  
 </body>

+ 1 - 1
core/src/web/templates/common/hotdemand.html

@@ -11,7 +11,7 @@
 						<ul style="    padding: 15px 0 20 10px;">
 							<li class="a-com-title" style="height:26px;"><div><a href="{{$v.s_link}}">{{$v.s_remark}}</a></div></li>
 							<li style="height:26px;color:#FF5A5F;font-size:14px;font-weight:600;overflow: hidden;" class="a-com-type">{{$v.o_extend.type}}</li>
-							<li style="height:26px;">{{if eq $v.o_extend.status "1"}}<img src="/images/u252.png">{{else}}<img src="/images/u288.png">{{end}}</li>
+							<li style="height:26px;"><img src="/images/u288.png"></li>
 							<li class="a-com-name" style="height:26px;"><div>{{$v.o_extend.entName}}</div></li>
 						</ul>
 					</li>

+ 19 - 16
push/src/qfw/push/rpcpush/rpcpush.go

@@ -5,6 +5,7 @@ import (
 	"log"
 	"qfw/push/bid"
 	"qfw/push/dopush"
+	"qfw/util"
 	qrpc "qfw/util/rpc"
 	"time"
 )
@@ -15,22 +16,24 @@ type PushInfo struct {
 var PushInfoScopeDays int
 
 func (p *PushInfo) PushMsg(data *qrpc.PushData, Reply *int) error {
-	log.Println("dddddddd", data)
-	for k, v := range data.PushType {
-		//昨天到今天的数据
-		pj := dopush.Pjob{
-			MaxPushSize: bid.MaxPushSize,
-			Stype:       k,
-			StypeName:   v,
+	log.Println("rpc_data", data)
+	util.Try(func() {
+		for k, v := range data.PushType {
+			//昨天到今天的数据
+			pj := dopush.Pjob{
+				MaxPushSize: bid.MaxPushSize,
+				Stype:       k,
+				StypeName:   v,
+			}
+			now := time.Now()
+			tom := time.Date(now.Year(), now.Month(), now.Day()-PushInfoScopeDays, 0, 0, 0, 0, time.Local)
+			b := pj.DoPush(data.Mopenid, fmt.Sprintf("%d days", PushInfoScopeDays), 2, tom.Unix())
+			if b {
+				*Reply = 1
+			} else {
+				*Reply = 0
+			}
 		}
-		now := time.Now()
-		tom := time.Date(now.Year(), now.Month(), now.Day()-PushInfoScopeDays, 0, 0, 0, 0, time.Local)
-		b := pj.DoPush(data.Mopenid, fmt.Sprintf("%d days", PushInfoScopeDays), 2, tom.Unix())
-		if b {
-			*Reply = 1
-		} else {
-			*Reply = 0
-		}
-	}
+	}, func(e interface{}) {})
 	return nil
 }

+ 4 - 0
spider2/src/client/ecps/ln/parse.go

@@ -114,6 +114,10 @@ func addJob(tmplist []interface{}) {
 				cm["query"] = tmp["Inv"]
 			}
 			if cm["query"] != nil && cm["query"] != "" && len(cm["query"].(string)) > 5 {
+				//防止死循环
+				if cm["query"] == infoMap["CerNo"] || cm["query"] == infoMap["EntName"] {
+					continue
+				}
 				cms := *new(com.CmdMsg)
 				cms.Nodetype = com.NODE_TYPE_ECPS
 				cms.Param = cm

+ 2 - 10
spider2/src/client/ecps/ln/spider.go

@@ -85,26 +85,18 @@ func downList() {
 			}
 			ent := *mongodb.FindOne("entintime", `{"$and":[{"intime":{"$gt":`+fmt.Sprint(time.Now().Unix()-int64(rate)*24*60*60)+`}},{"$or":[{"RegNo":"`+fmt.Sprint(tmp["query"])+`"},{"EntName":"`+fmt.Sprint(tmp["query"])+`"}]}]}`)
 			if ent != nil {
-<<<<<<< HEAD
 				log.Println(ent["EntName"], ent["RegNo"], ",根据配置频率跳过")
 				putLogs(":"+fmt.Sprint(ent["EntName"])+","+fmt.Sprint(ent["RegNo"])+",根据配置频率跳过", 1)
-=======
-				log.Println(fmt.Sprint(ent["EntName"]) + ",根据配置频率跳过")
-				putLogs(":"+fmt.Sprint(ent["EntName"])+",根据配置频率跳过", 1)
->>>>>>> release
+
 				Lists.Remove(e)
 				continue
 			}
 			b, info := downloadContent(tmp)
 			Lists.Remove(e)
 			if b {
-<<<<<<< HEAD
 				log.Println("成功下载:", info["EntName"], info["RegNo"])
 				putLogs("成功下载:"+fmt.Sprint(info["EntName"])+","+fmt.Sprint(info["RegNo"]), 1)
-=======
-				log.Println("成功下载:", info["EntName"])
-				putLogs("成功下载:"+fmt.Sprint(info["EntName"]), 1)
->>>>>>> release
+
 			} else {
 				log.Println("下载失败:", tmp)
 				putLogs("下载失败:"+fmt.Sprint(tmp), 1)

+ 14 - 7
spider2/src/server/rpc.go

@@ -23,7 +23,6 @@ const (
 	RUNNING         = iota
 	PASS
 	STOP
-	OFFLINE //掉线
 )
 
 //一个节点
@@ -33,6 +32,7 @@ type Node struct {
 	Descript       string
 	Dtype          string     //节点分类
 	Status         int        //状态
+	IsOnline       bool       //是否在线
 	Logs           *list.List //日志
 	Command        *list.List //命令
 	LastAccesstime int64      //最后访问时间
@@ -59,7 +59,7 @@ func (ss *SpiderServer) Join(p com.JoinMsg, r *com.SimpleReturnMsg) error {
 	Mirror[p.Code] = &Node{Name: p.Name,
 		Code: p.Code, Descript: p.Descript,
 		Dtype: p.Dtype, LastAccesstime: lasttime,
-		Status: RUNNING, Logs: logs, Command: cmd}
+		Status: RUNNING, IsOnline: true, Logs: logs, Command: cmd}
 	lock.Unlock()
 	return nil
 }
@@ -153,13 +153,20 @@ func initRpc(port string) {
 func Gc() {
 	timestamp := time.Now().Unix()
 	lock.Lock()
-	for k, v := range Mirror {
+	for _, v := range Mirror {
 		log.Println(v.Name, "Status:", v.Status)
 		remain := timestamp - v.LastAccesstime
-		if remain > 10 { //5分钟掉线删除
-			delete(Mirror, k)
-		} else if remain > ACTIVECHECKTIME {
-			v.Status = OFFLINE
+		/*
+			if remain > 30 { //30秒钟掉线删除
+				delete(Mirror, k)
+			} else if remain > ACTIVECHECKTIME {
+				v.Status = OFFLINE
+			}
+		*/
+		if remain > ACTIVECHECKTIME {
+			v.IsOnline = false
+		} else {
+			v.IsOnline = true
 		}
 	}
 	lock.Unlock()