Browse Source

Merge branch 'release/v4.8.47_ws' of qmx/jy into release/v4.8.47

wangshan 2 năm trước cách đây
mục cha
commit
34fe63086e

+ 6 - 1
src/jfw/modules/app/src/app/front/tags.go

@@ -34,6 +34,7 @@ var (
 		"NJXM":   "1_1",
 	}
 	mobileUrl = regexp.MustCompile("(?i)(app|H5|h5)")
+	cookieNum = 4
 )
 
 type Tags struct {
@@ -98,6 +99,8 @@ func init() {
 	jyutil.GetAllArea()
 	//热门地区
 	jyutil.GetHotArea()
+	//cookie num
+	cookieNum = qu.If(config.Seoconfig["cookieNum"] != nil, qu.IntAll(config.Seoconfig["cookieNum"]), cookieNum).(int)
 }
 
 func (tg *Tags) IsLogin() error {
@@ -113,7 +116,9 @@ func (tg *Tags) IsLogin() error {
 func (tg *Tags) TagsIndex(first, types, name string) error {
 	defer qu.Catch()
 	if userId, _ := tg.GetSession("userId").(string); userId != "" {
-		return tg.Redirect("/jyapp/jylab/mainSearch")
+		if c := jyutil.ChangeLoginCookie(20, tg.ResponseWriter, tg.Request, fmt.Sprintf("mobile_logined_%s", userId)); c < cookieNum {
+			return tg.Redirect("/jyapp/jylab/mainSearch")
+		}
 	}
 	var (
 		platform = "PC"

+ 25 - 24
src/jfw/modules/app/src/app/jyutil/util.go

@@ -2,6 +2,7 @@ package jyutil
 
 import (
 	util "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"app.yhyue.com/moapp/jypkg/compatible"
 	"app.yhyue.com/moapp/jypkg/public"
 	"encoding/json"
@@ -251,31 +252,31 @@ func Handle(data []interface{}, host string) []AdInfo {
 	return res
 }
 
-func ChangeLoginCookie(status, timeOut int, w http.ResponseWriter, r *http.Request, name string) {
-	switch status {
-	case 1:
-		http.SetCookie(w, &http.Cookie{
-			Name:     name,
-			Value:    strconv.Itoa(status),
-			Path:     "/",
-			HttpOnly: false,
-			MaxAge:   timeOut,
-			Expires:  time.Now().Add(time.Duration(timeOut)),
-		})
-	default:
-		http.SetCookie(w, &http.Cookie{
-			Name:     name,
-			Value:    strconv.Itoa(status),
-			Path:     "/",
-			HttpOnly: false,
-			MaxAge:   timeOut,
-			Expires:  time.Now().Add(time.Duration(timeOut)),
-		})
-		log.Println("----清除 islogin cookie-----")
-	}
+func ChangeLoginCookie(timeOut int, w http.ResponseWriter, r *http.Request, name string) (c int) {
 	v, err := r.Cookie(name)
-	log.Println(status, "-------------", err)
 	if err == nil {
-		log.Println("---islogin cookie---:", v.Name, "--", v.Value, "--", v.Expires, "--", v.Domain, "--", v.Path, "--")
+		c, _ = strconv.Atoi(v.Value)
+	} else {
+		hCookie := r.Header.Get("Cookie")
+		if hCookie != "" && strings.Contains(hCookie, name) {
+			for _, hc := range strings.Split(hCookie, ";") {
+				if len(strings.Split(hc, "=")) > 1 {
+					c, _ = strconv.Atoi(strings.Split(hc, "=")[1])
+					break
+				}
+			}
+		}
 	}
+	c++
+	log.Println(c, "-------------", err)
+	http.SetCookie(w, &http.Cookie{
+		Name:     name,
+		Value:    strconv.Itoa(c),
+		Path:     "/",
+		HttpOnly: false,
+		MaxAge:   timeOut,
+		Expires:  time.Now().Add(time.Duration(timeOut)),
+		Domain:   httpsession.Domain,
+	})
+	return
 }

+ 2 - 1
src/jfw/modules/app/src/seo.json

@@ -2784,5 +2784,6 @@
       "KEYWORDS": "澳门",
       "DESCRIPTION": "澳门"
     }
-  }
+  },
+  "cookieNum": 5
 }

+ 1 - 1
src/jfw/modules/app/src/web/templates/weixin/about.html

@@ -152,7 +152,7 @@
 			</ul>
 		</div>
 		<img src="{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/images/about/bg_4.jpg?v=51430">
-		<center class="tip">电脑访问剑鱼标讯官网<font>www.jianyu360.com</font>查看详情</center>
+		<center class="tip">电脑访问剑鱼标讯官网<font>www.jianyu360.cn</font>查看详情</center>
 		<center class="phone">客服电话:400-108-6670</center>
 	</div>
 	<div class="screen_5">

+ 1 - 1
src/web/templates/weixin/about.html

@@ -305,7 +305,7 @@
 		</ul>
 	</div>
 	<img src="/images/about/bg_4.jpg">
-	<center class="tip">电脑访问剑鱼标讯官网<font>www.jianyu360.com</font>查看详情</center>
+	<center class="tip">电脑访问剑鱼标讯官网<font>www.jianyu360.cn</font>查看详情</center>
 	<center class="cstn" style="font-size: 15px;color: #fff;margin-top: -12px;padding-bottom: 12px;">客服电话:400-108-6670</center>
 </div>
 <div class="screen_5">