wangshan 4 months ago
parent
commit
5209bbb8e6
1 changed files with 30 additions and 30 deletions
  1. 30 30
      src/jfw/modules/publicapply/src/filter/cookie.go

+ 30 - 30
src/jfw/modules/publicapply/src/filter/cookie.go

@@ -1,42 +1,42 @@
 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"
+	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"
 )
 
 // CookieInfo 信息
 type CookieInfo struct {
-    App *xweb.App
+	App *xweb.App
 }
 
 // Do 继承过滤器方法
 func (ci *CookieInfo) Do(w http.ResponseWriter, req *http.Request) bool {
-    session := ci.App.SessionManager.Session(req, w)
-    getSession := session.GetMultiple()
-    if crr := req.Referer(); getSession["userId"] != nil && crr != "" {
-        if strings.Contains(crr, "cooperate") {
-            match := strings.Split(crr, "cooperate/")
-            if len(match) > 1 {
-                jy.SetCookieValue(w, jy.ChannelCookieName, match[1], 172800) //两天
-            }
-        }
-    }
-    //体验-绑定-标识
-    host := req.Host
-    if !strings.HasPrefix(host, ".") {
-        host = "." + host
-    }
-    phone, _ := getSession["phone"].(string)
-    log.Println(phone, "--host:", host)
-    if phone != "" {
-        jy.SetCookie(w, req, jy.ExperienceSign, "clear", host, -1)
-    } else if qu.Int64All(getSession["experience_binding"]) == 1 {
-        jy.SetCookie(w, req, jy.ExperienceSign, "experiencing", host, 24*60*60)
-    }
-    return true
+	session := ci.App.SessionManager.Session(req, w)
+	getSession := session.GetMultiple()
+	if crr := req.Referer(); getSession["userId"] != nil && crr != "" {
+		if strings.Contains(crr, "cooperate") {
+			match := strings.Split(crr, "cooperate/")
+			if len(match) > 1 {
+				jy.SetCookieValue(w, jy.ChannelCookieName, match[1], 172800) //两天
+			}
+		}
+	}
+	//体验-绑定-标识
+	host := req.Host
+	if !strings.HasPrefix(host, ".") {
+		host = "." + host
+	}
+	phone, _ := getSession["phone"].(string)
+	log.Println(phone, "--host:", host)
+	if phone != "" {
+		jy.SetCookie(w, req, jy.ExperienceSign, "clear", host, -1)
+	} else if qu.Int64All(getSession["experience_binding"]) == 1 {
+		jy.SetCookie(w, req, jy.ExperienceSign, "experiencing", host, 24*60*60)
+	}
+	return true
 }