Răsfoiți Sursa

wip:cookie 标识

wangshan 4 luni în urmă
părinte
comite
6d751f5764

+ 5 - 6
src/jfw/filter/phonefilter.go

@@ -1,7 +1,6 @@
 package filter
 
 import (
-	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 	"fmt"
 	"jy/src/jfw/config"
 	"jy/src/jfw/jyutil"
@@ -55,13 +54,13 @@ func (l *phoneFilter) Do() bool {
 	var (
 		phone, _   = l.GetSession["phone"].(string)
 		expBinding bool
-		host       = l.R.Host
+		//host       = l.R.Host
 	)
-	if !strings.HasPrefix(host, ".") {
-		host = "." + host
-	}
+	//if !strings.HasPrefix(host, ".") {
+	//	host = "." + host
+	//}
 	if phone == "" && qu.Int64All(l.GetSession["experience_binding"]) == 1 {
-		jy.SetCookie(l.W, l.R, jy.ExperienceSign, "experiencing", host, 8*60*60)
+		//jy.SetCookie(l.W, l.R, jy.ExperienceSign, "experiencing", host, 8*60*60)
 		expBinding = true
 	}
 	// 请求过滤

+ 5 - 6
src/jfw/modules/app/src/app/filter/phonefilter.go

@@ -5,7 +5,6 @@ import (
 	. "app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"app.yhyue.com/moapp/jybase/redis"
-	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 	"fmt"
 	. "jy/src/jfw/modules/app/src/app/config"
 	utils "jy/src/jfw/modules/app/src/app/jyutil"
@@ -50,13 +49,13 @@ func (l *phoneFilter) Do() bool {
 	var (
 		phone, _   = l.GetSession["phone"].(string)
 		expBinding bool
-		host       = l.R.Host
+		//host       = l.R.Host
 	)
-	if !strings.HasPrefix(host, ".") {
-		host = "." + host
-	}
+	//if !strings.HasPrefix(host, ".") {
+	//	host = "." + host
+	//}
 	if phone == "" && qu.Int64All(l.GetSession["experience_binding"]) == 1 {
-		jy.SetCookie(l.W, l.R, jy.ExperienceSign, "experiencing", host, 8*60*60)
+		//jy.SetCookie(l.W, l.R, jy.ExperienceSign, "experiencing", host, 8*60*60)
 		expBinding = true
 	}
 	// 请求过滤

+ 9 - 11
src/jfw/modules/publicapply/src/filter/cookie.go

@@ -1,10 +1,8 @@
 package filter
 
 import (
-	qu "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
-	"log"
 	"net/http"
 	"strings"
 )
@@ -27,14 +25,14 @@ func (ci *CookieInfo) Do(w http.ResponseWriter, req *http.Request) bool {
 		}
 	}
 	//体验-绑定-标识
-	host := req.Host
-	if !strings.HasPrefix(host, ".") {
-		host = "." + host
-	}
-	phone, _ := getSession["phone"].(string)
-	log.Println(phone, "--host:", host)
-	if phone == "" && qu.Int64All(getSession["experience_binding"]) == 1 {
-		jy.SetCookie(w, req, jy.ExperienceSign, "experiencing", host, 8*60*60)
-	}
+	//host := req.Host
+	//if !strings.HasPrefix(host, ".") {
+	//	host = "." + host
+	//}
+	//phone, _ := getSession["phone"].(string)
+	//log.Println(phone, "--host:", host)
+	//if phone == "" && qu.Int64All(getSession["experience_binding"]) == 1 {
+	//	jy.SetCookie(w, req, jy.ExperienceSign, "experiencing", host, 8*60*60)
+	//}
 	return true
 }

+ 7 - 1
src/jfw/modules/subscribepay/src/filter/mergefilter.go

@@ -1,6 +1,7 @@
 package filter
 
 import (
+	qu "app.yhyue.com/moapp/jybase/common"
 	"fmt"
 	"jy/src/jfw/modules/subscribepay/src/config"
 	"jy/src/jfw/modules/subscribepay/src/util"
@@ -13,7 +14,7 @@ import (
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 )
 
-//用户合并删除用户检测
+// 用户合并删除用户检测
 type mergeFilter struct {
 	W          http.ResponseWriter
 	R          *http.Request
@@ -27,6 +28,11 @@ func (l *mergeFilter) Do() bool {
 	if uid == "" {
 		return true
 	}
+	phone, _ := l.GetSession["phone"].(string)
+	//体验用户
+	if phone == "" && qu.Int64All(l.GetSession["experience_binding"]) == 1 {
+		jy.SetCookie(l.W, l.R, jy.ExperienceSign, "experiencing", fmt.Sprintf(".%s", l.R.Host), 7*60*60)
+	}
 	if flushSession, _ := l.GetSession["flushSession"].(bool); flushSession {
 		jy.CreateUserMerge(util.MQFW, util.Mysql, l.Session, config.Middleground).FlushSession(uid)
 		l.Session.Del("flushSession")

+ 5 - 1
src/jfw/modules/subscribepay/src/service/userAccountInfo.go

@@ -803,7 +803,11 @@ func (this *UserAccount) PhoneBind() {
 				host = "." + host
 			}
 			this.Session().Del("experience_binding")
-			jy.SetCookie(this.ResponseWriter, this.Request, "EXPERIENCE", "over", host, 8*60*60) //结束
+			jy.SetCookie(this.ResponseWriter, this.Request, jy.ExperienceSign, "experiencing", host, -1) //过期
+			jy.SetCookie(this.ResponseWriter, this.Request, "EXPERIENCE", "over", host, 8*60*60)         //结束
+			val, _ := this.Request.Cookie(jy.ExperienceSign)
+			log.Println("----Value--------", val.Value, "------Path------", val.Path, "-----Domain-------", val.Domain, "--------Name----", val.Name)
+
 		}
 	}
 	this.ServeJson(NewResult(rData, errMsg))