瀏覽代碼

分享缺陷修改

zhanghongbo 9 年之前
父節點
當前提交
7c6a7cadac
共有 1 個文件被更改,包括 13 次插入11 次删除
  1. 13 11
      core/src/qfw/active/activemanage.go

+ 13 - 11
core/src/qfw/active/activemanage.go

@@ -30,15 +30,15 @@ type Activemanage struct {
 //分享成功后建立redis判断值
 func (a *Activemanage) Addredis() error {
 	//
-	openid := a.Session().Get("openid").(string)
+	openid := a.Session().Get("s_m_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)
+	//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)
+	redis.Put("other", key, "cj", int(yxq))
 
 	return nil
 }
@@ -59,6 +59,11 @@ func (a *Activemanage) Luckdraw(activecode, id string) error {
 			a.T["msg"] = "您的微信号无效!!"
 			return a.Render("/active/luckdraw.html", &a.T)
 		}
+		a.SetSession("userName", username)
+		a.SetSession("userId", userid)
+		a.SetSession("s_m_openid", openid)
+		a.SetSession("s_actcode", activecode)
+
 		a.T["signature"] = mob.GetSignature(a.Url())
 		u := FindOne("winningrecord", "{'s_openid':'"+openid+"'}")
 		if *u != nil {
@@ -75,10 +80,7 @@ func (a *Activemanage) Luckdraw(activecode, id string) error {
 				return a.Render("/active/luckdraw.html", &a.T)
 			}
 		}
-		a.SetSession("username", username)
-		a.SetSession("userid", userid)
-		a.SetSession("openid", openid)
-		a.SetSession("s_actcode", activecode)
+
 		return a.Render("/active/luckdraw.html", &a.T)
 	} else {
 		return nil
@@ -92,7 +94,7 @@ func (a *Activemanage) Getluckdraw() error {
 	msg := ""
 	id := ""
 	today := time.Now()
-	openid := a.GetSession("openid").(string)
+	openid := a.GetSession("s_m_openid").(string)
 	s_actcode := a.GetSession("s_actcode").(string)
 	if openid == "" {
 		msg = "  小主你太长时间没点击开始抽奖了,重新进来吧!"
@@ -146,8 +148,8 @@ func (a *Activemanage) Getluckdraw() error {
 		}
 		if coreutil.PayBonus(&bm) {
 			redpackage := make(bson.M)
-			redpackage["s_userid"] = a.GetSession("userid")
-			redpackage["s_username"] = a.GetSession("username")
+			redpackage["s_userid"] = a.GetSession("userId").(string)
+			redpackage["s_username"] = a.GetSession("userName").(string)
 			redpackage["s_openid"] = openid
 			redpackage["i_amount"] = amount
 			redpackage["s_billno"] = bm.Mchbillno