Эх сурвалжийг харах

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

zhangjinkun@topnet.net.cn 9 жил өмнө
parent
commit
20d7f7be4e

+ 1 - 1
core/src/luckdraw.json

@@ -1,6 +1,6 @@
 {
 	"startDate":1452750000,
-	"endDate":1454256000,
+	"endDate":1455552000,
 	"getAmount":[{
 		"min":0,
 		"max":40,

+ 48 - 10
core/src/qfw/active/activemanage.go

@@ -13,6 +13,7 @@ import (
 	mob "qfw/mobile"
 	. "qfw/util"
 	. "qfw/util/mongodb"
+	"qfw/util/redis"
 	qrpc "qfw/util/rpc"
 	"strconv"
 	"time"
@@ -22,6 +23,23 @@ type Activemanage struct {
 	*xweb.Action
 	luckdraw    xweb.Mapper `xweb:"/activity/(\\w+)/([^.]*)"`
 	getluckdraw xweb.Mapper `xweb:"/activity/luckdraw"`
+	addredis    xweb.Mapper `xweb:"/activity/addredis"`
+}
+
+//分享成功后建立redis判断值
+func (a *Activemanage) Addredis() error {
+	//
+	openid := a.Session().Get("openid").(string)
+	n := time.Now()
+	tmp := n.Unix()
+	n2 := n.AddDate(0, 0, 1)
+	yxq := time.Date(n2.Year(), n2.Month(), n2.Day(), 23, 59, 59, 0, time.Local).Unix() - tmp
+	yxqs := fmt.Sprintf("%d", yxq)
+	yxqt, _ := strconv.Atoi(yxqs)
+	key := fmt.Sprintf("cj_%s_%s", openid, n2.Format("2006_01_02"))
+	redis.Put("other", key, "cj", yxqt)
+
+	return nil
 }
 
 //进入抽奖页面
@@ -44,10 +62,13 @@ func (a *Activemanage) Luckdraw(activecode, id string) error {
 		a.T["signature"] = mob.GetSignature(a.Url())
 		u := FindOne("winningrecord", "{'s_openid':'"+openid+"'}")
 		if *u != nil {
-			//a.T = *u
-			a.T["flog"] = "A"
-			a.T["msg"] = "小主莫贪心,每人只有一次抽奖机会呦!<br/><br/>  小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)"
-			return a.Render("/active/luckdraw.html", &a.T)
+			if ret := redis.Get("other", "cj_"+openid+"_"+time.Now().Format("2006_01_02")); ret == nil {
+				//a.T = *u
+				fmt.Println("ret:::::::::", ret, "33333333333", time.Now().Format("2006_01_02"))
+				a.T["flog"] = "A"
+				a.T["msg"] = "小主莫贪心,每人每天只有一次抽奖机会呦!分享后明天再来吧!<br/><br/>  小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)"
+				return a.Render("/active/luckdraw.html", &a.T)
+			}
 		}
 		a.SetSession("username", username)
 		a.SetSession("userid", userid)
@@ -74,9 +95,14 @@ func (a *Activemanage) Getluckdraw() error {
 	} else {
 		u := FindOne("winningrecord", "{'s_openid':'"+openid+"'}")
 		if *u != nil {
-			flog = "A"
-			msg = "  小主莫贪心,每人只有一次抽奖机会呦!<br/><br/>  小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)"
-			return a.Write(`{"flog":"` + flog + `","msg":"` + msg + `"}`)
+			if ret := redis.Get("other", "cj_"+openid+"_"+time.Now().Format("2006_01_02")); ret == nil {
+				//a.T = *u
+				fmt.Println("ret22:::::::::", ret)
+				a.T["flog"] = "A"
+				a.T["msg"] = "小主莫贪心,每人每天只有一次抽奖机会呦!分享后明天再来吧!<br/><br/>  小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)"
+				return a.Write(`{"flog":"` + flog + `","msg":"` + msg + `"}`)
+			}
+			redis.Del("other", "cj_"+openid+"_"+time.Now().Format("2006_01_02"))
 		}
 	}
 	data := make(map[string]interface{})
@@ -95,8 +121,14 @@ func (a *Activemanage) Getluckdraw() error {
 	if len(id) > 0 {
 		flog = "T"
 	}
-	if i > 185 && i < 220 {
-		amount := 500 //红包金额以“元”为单位,微信红包以“分”为单位
+	if (i > 185 && i < 220) || (i > 320 && i < 355) {
+		var amount int //红包金额以“元”为单位,微信红包以“分”为单位
+		if i > 185 && i < 220 {
+			amount = 500 //红包金额以“元”为单位,微信红包以“分”为单位
+
+		} else if i > 320 && i < 355 {
+			amount = 100 //红包金额以“元”为单位,微信红包以“分”为单位
+		}
 		bm := qrpc.BonusMsg{Mchbillno: fmt.Sprint(today.Unix()),
 			Sendname:    LuckDraw.Weixin["sendname"].(string),
 			Reopenid:    openid,
@@ -124,7 +156,7 @@ func (a *Activemanage) Getluckdraw() error {
 	}
 	if i > 185 && i < 220 {
 		msg = "  小主是真真的好运气,五元现金红包落入您囊中!<br/><br/>  小主翻个牌子,动动小手分享活动,么么哒……(分享点击页面右上方···分享到朋友圈)"
-	} else if (i > 275 && i < 310) || (i > 95 && i < 130) {
+	} else if (i > 275 && i < 310) || (i > 95 && i < 130) || (i > 140 && i < 175) || (i > 320 && i < 355) {
 		//时间判断,提醒不同
 		now := time.Now()
 		//不在工作时间
@@ -188,12 +220,18 @@ func getPrize(i int) string {
 		} else if 91 <= i && i < 136 {
 			prize = "限量版U盘"
 
+		} else if 140 <= i && i < 175 {
+			prize = "《牛奶可乐经济学》"
+
 		} else if 181 <= i && i < 226 {
 			prize = "五元现金红包"
 
 		} else if 271 <= i && i < 316 {
 			prize = "《牛奶可乐经济学》"
 
+		} else if 320 <= i && i < 355 {
+			prize = "《牛奶可乐经济学》"
+
 		} else {
 			prize = "谢谢参与"
 		}

+ 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-01-25 16:16:21"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-25 16:16:21"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-25 14:51:32"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-25 14:51:32"}},"marketisstart":true,"marketrate":300}

BIN
core/src/web/staticres/images/activeimages/lotteryBg.jpg


+ 3 - 1
core/src/web/staticres/js/entportrait.js

@@ -92,7 +92,7 @@ function initRelation(){
 					$(".entrelation").css("height","auto");
 				}else if(r.flag == true && (r == null || typeof(r) == "undefined" || typeof(r.relation.links) == "undefined" || r.relation.links.length == 0 || typeof(r.relation.nodes) == "undefined" || r.relation.nodes.length <= 1)){
 					relationNoData();
-				}else{
+				}else if(r.flag == true){
 					$("#entrelation-limit,#entrelation-nologin").addClass("hide");
 					loadJS("/js/d3.v3.min.js",function(){
 						loadJS("/js/geometry.js",function(){
@@ -102,6 +102,8 @@ function initRelation(){
 							});
 						});
 					});
+				}else{
+					relationNoData();
 				}
 			},
 			error: function(){

+ 3 - 3
core/src/web/staticres/js/qfw.js

@@ -166,10 +166,10 @@ dateFormat.i18n = {
 };
 
 // For convenience...
-Date.prototype.Format = function (mask, utc) {
+Date.prototype.FormatEnhance = function (mask, utc) {
 	return dateFormat(this, mask, utc);
 };
-/*Date.prototype.Format = function (fmt) { //author: meizz 
+Date.prototype.Format = function (fmt) { //author: meizz 
     var o = {
         "M+": this.getMonth() + 1, //月份 
         "d+": this.getDate(), //日 
@@ -183,7 +183,7 @@ Date.prototype.Format = function (mask, utc) {
     for (var k in o)
     if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
     return fmt;
-}*/
+}
 //浏览器窗口大小变化重新加载
 window.onresize=webSiteInit;
 serializeObject = function(form) {

BIN
core/src/web/staticres/wxswordfish/images/share-cj.png


+ 18 - 0
core/src/web/staticres/wxswordfish/share.js

@@ -15,6 +15,15 @@ function initShare(signature,shareid){
 			    imgUrl: 'http://www.qimingxing.info/wxswordfish/images/share-icon.png', // 分享图标
 			    success: function () { 
 			       //alert('分享成功');
+							$.ajax({    
+						        type:'post',        
+						        url:'/activity/addredis',    
+						        cache:false,    
+						        dataType:'json', 
+						        success:function(data){
+			      					 //alert('分享成功后第二天可以抽一次奖!');
+						        }    
+						        }); 
 			    },
 			    cancel: function () { 
 			       //alert('分享失败,或用户取消了');
@@ -30,6 +39,15 @@ function initShare(signature,shareid){
 			    dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
 			    success: function () { 
 			        //alert('分享成功');
+							$.ajax({    
+						        type:'post',        
+						        url:'/activity/addredis',    
+						        cache:false,    
+						        dataType:'json', 
+						        success:function(data){
+			      					 //alert('分享成功后第二天可以抽一次奖!');
+						        }    
+						        }); 
 			    },
 			    cancel: function () { 
 					//alert('分享失败,或用户取消了');

+ 8 - 9
core/src/web/templates/swordfish/wxshare.html

@@ -11,16 +11,15 @@
 <script>
 	initShare({{.T.signature}},{{.T.shareid}});
 </script>
+<style>
+.lotteryBg{ width:100%; height:100%; margin:0 auto; background:url(/images/activeimages/lotteryBg.jpg) no-repeat center center; position:relative; overflow:hidden;background-size: 375px 603px;}
+#run{ width:178px; height:178px; position:absolute; left:50%; top:50%;  margin-left:-90px; margin-top:-8px; z-index:1; transform:rotate(0deg); -ms-transform:rotate(0deg); }
+</style>
 </head>
-<body style="margin:0px;">
-<div style="width: 100%;height: 603px; margin: 0 auto;background: url(/wxswordfish/images/share-cj.png) no-repeat top center;overflow: hidden;background-size: 375px 603px">
+<body style="margin:0px; background-color:#C5F7FE;">
+<div class="lotteryBg" style="width: 100%;height: 603px; margin: 0 auto;background: url(/wxswordfish/images/share-cj.png) no-repeat center center; position:relative; overflow: hidden;background-size: 375px 603px">
+
+    	<img id="run" src="/front/weixinshare/{{.T.shareid}}" />
 </div>
-<table align=center width=100%>
-	<tr>
-		<td width=80><img src="/front/weixinshare/{{.T.shareid}}" style="width:80px; height:80px;" /></td>
-		<td style="word-break:break-all;word-wrap:break-word;line-height:22px;max-width:210px;">
- 长按图片识别二维码<br/>回复“抽奖”,有机会抽取iPad mini</td>
-	</tr>
-</table>
 </body>
 </html>

+ 7 - 2
core/src/web/templates/swordfish/wxtoolbar.html

@@ -86,8 +86,13 @@ $(function(){
 		$("#feedback-textarea").focus().parent().removeClass("red-border");
 	});
 	$("[id='goToShare']").click(function(){
-		$(".share-dialog").show();
-		$("html,body").addClass("overflow-hidden");
+		if(typeof(shareid) == "undefined" || shareid == ""){
+			window.location.href = "/swordfish/share/-1";
+		}else{
+			window.location.href = "/swordfish/share/"+shareid;
+		}
+		//$(".share-dialog").show();
+		//$("html,body").addClass("overflow-hidden");
 	});
 	$("#share-dialog-back").click(function(){
 		$(".share-dialog").hide();

+ 2 - 2
core/src/web/templates/yellowpage/enterpriseinfo.html

@@ -326,13 +326,13 @@
 					{{range $k,$v := .T.res.alterInfo}}
 						<li>
 							<div>
-								<div><script>document.write(new Date({{$v.AltDate}}).Format("yyyy-MM-dd hh:mm:ss"));</script></div>
+								<div><script>document.write(new Date({{$v.AltDate}}).FormatEnhance("yyyy-mm-dd HH:MM:ss"));</script></div>
 								<div>{{$v.AltItemName}}</div>
 								<div>变更前:{{$v.AltBe}}<br>变更后:{{$v.AltAf}}</div>
 								<a></a>
 							</div>
 							<div>
-								<div><script>document.write(new Date({{$v.AltDate}}).Format("yyyy-MM-dd hh:mm:ss"));</script></div>
+								<div><script>document.write(new Date({{$v.AltDate}}).FormatEnhance("yyyy-mm-dd HH:MM:ss"));</script></div>
 								<div>{{$v.AltItemName}}</div>
 								<div>变更前:{{$v.AltBe}}<br>变更后:{{$v.AltAf}}</div>
 								<a></a>