Explorar o código

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

wangchuanjin %!s(int64=9) %!d(string=hai) anos
pai
achega
80a36a893a

+ 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=BIN
core/src/web/staticres/images/activeimages/lotteryBg.jpg


BIN=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('分享失败,或用户取消了');

+ 1 - 1
core/src/web/templates/swordfish/wxrssset.html

@@ -69,7 +69,7 @@
 		<li class="parent-node">
 			<img src="/wxswordfish/images/feerule.png">
 			收费规则
-			<span style="right:0"><img src="/wxswordfish/images/right.png" style="width: 10px;height: 17px;float: right;"></span>
+			<span style="right:0" class="rule"><img src="/wxswordfish/images/right.png" style="width: 10px;height: 17px;float: right;"></span>
 		</li>
 	</ul>
 	<!--剑鱼服务协议-->

+ 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>