wangshan 9 years ago
parent
commit
05b2a2994e

+ 1 - 1
core/src/luckdraw.json

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

+ 50 - 11
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,12 +23,30 @@ 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
 }
 
 //进入抽奖页面
 func (a *Activemanage) Luckdraw(activecode, id string) error {
-	//userInfo := a.GetSession("userInfo").(*map[string]interface{})
+
 	openid := id //(*userInfo)["s_m_openid"].(string)
+	//userInfo := a.GetSession("userInfo").(*map[string]interface{})
 	a.T["shareid"] = coreutil.FindMyShareId(activecode, openid)
 	//
 	if activecode == "topcj" {
@@ -44,10 +63,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 +96,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 +122,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 +157,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 +221,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-22 17:02:43"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-22 17:02:43"}},"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


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