浏览代码

fix:匿名用户处理修改

duxin 1 年之前
父节点
当前提交
8d0bd11439
共有 2 个文件被更改,包括 18 次插入19 次删除
  1. 4 5
      src/jfw/filter/anonymousUser.go
  2. 14 14
      src/jfw/timetask/timetask.go

+ 4 - 5
src/jfw/filter/anonymousUser.go

@@ -15,7 +15,6 @@ import (
 	"fmt"
 	"github.com/bwmarrin/snowflake"
 	"io/ioutil"
-	"jy/src/jfw/config"
 	"log"
 	"net/http"
 	"strings"
@@ -112,8 +111,8 @@ func (sk *AnonymousAuth) Do() {
 				Value:    util.InterfaceToStr(guestUID),
 				Path:     "/",
 				HttpOnly: true,
-				Domain:   util.ObjToString(config.Sysconfig["cookiedomain"]),
-				Expires:  time.Now().AddDate(10, 0, 0),
+				//Domain:   util.ObjToString(config.Sysconfig["cookiedomain"]),
+				Expires: time.Now().AddDate(10, 0, 0),
 			}
 			http.SetCookie(sk.W, cookie)
 			//未登录用户增加匿名身份信息
@@ -168,8 +167,8 @@ func (sk *AnonymousAuth) Do() {
 				Value:    trustedId,
 				Path:     "/",
 				HttpOnly: true,
-				Domain:   util.ObjToString(config.Sysconfig["cookiedomain"]),
-				Expires:  time.Now().AddDate(10, 0, 0),
+				//Domain:   util.ObjToString(config.Sysconfig["cookiedomain"]),
+				Expires: time.Now().AddDate(10, 0, 0),
 			}
 			http.SetCookie(sk.W, cookie)
 			public.BaseMysql.Update("anonymous_identity", map[string]interface{}{"guestUID": jyGuestUID.Value},

+ 14 - 14
src/jfw/timetask/timetask.go

@@ -1,14 +1,14 @@
 package timetask
 
 import (
-    qutil "app.yhyue.com/moapp/jybase/common"
-    "jy/src/jfw/config"
-    "fmt"
-    "jy/src/jfw/nodemgr"
+	qutil "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jypkg/public"
+	"fmt"
+	"jy/src/jfw/config"
+	"jy/src/jfw/nodemgr"
 	"log"
-    "math"
-    "time"
+	"math"
+	"time"
 
 	"app.yhyue.com/moapp/jybase/redis"
 
@@ -39,7 +39,7 @@ func task() {
 	}
 }
 
-//每周六晚上十一点更新redis订阅词
+// 每周六晚上十一点更新redis订阅词
 func updateHotKeys() {
 	c := cron.New()
 	c.AddFunc("0 0 23 * * 6", func() {
@@ -50,13 +50,13 @@ func updateHotKeys() {
 			}
 		}
 	})
-    c.AddFunc("0 0 1 * * 1", func() { //每周1清理匿名用户日志表 保留最近30天
-        tm:=time.Now().AddDate(0,0,-qutil.IntAllDef(config.Sysconfig["anonymousTime"],30)).Unix()
-        count := public.BaseMysql.CountBySql(fmt.Sprintf(`SELECT count(*) FROM anonymous_identity WHERE  creation_time < %d and refer = ''  and   fid is null`,tm))
-        for i := 0; i < int(math.Ceil(float64(count)/float64(2000))); i++ {
-            public.BaseMysql.SelectBySql(fmt.Sprintf(`DELETE FROM anonymous_identity WHERE creation_time < %d and refer = '' AND fid IS NULL LIMIT 2000;`,tm))
-        }
-    })
+	c.AddFunc("0 0 1 * * 1", func() { //每周1清理匿名用户日志表 保留最近30天
+		tm := time.Now().AddDate(0, 0, -qutil.IntAllDef(config.Sysconfig["anonymousTime"], 30)).Unix()
+		count := public.BaseMysql.CountBySql(fmt.Sprintf(`SELECT count(*) FROM anonymous_identity WHERE  creation_time < %d and refer = ''  and   fid is null`, tm))
+		for i := 0; i < int(math.Ceil(float64(count)/float64(2000))); i++ {
+			public.BaseMysql.SelectBySql(fmt.Sprintf(`DELETE FROM anonymous_identity WHERE creation_time < %d and refer = '' AND fid IS NULL LIMIT 2000;`, tm))
+		}
+	})
 	c.Start()
 	defer c.Stop()
 	chan bool(nil) <- true