|
@@ -1,7 +1,10 @@
|
|
|
package active
|
|
|
|
|
|
import (
|
|
|
+ "app.yhyue.com/moapp/jybase/redis"
|
|
|
+ "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
"app.yhyue.com/moapp/jypkg/public"
|
|
|
+ "fmt"
|
|
|
"regexp"
|
|
|
|
|
|
util "app.yhyue.com/moapp/jybase/common"
|
|
@@ -48,9 +51,12 @@ type Active struct {
|
|
|
|
|
|
}
|
|
|
|
|
|
-var mongodb = public.MQFW
|
|
|
-var se = encrypt.SimpleEncrypt{Key: "topnet2015topnet2015"}
|
|
|
-var mobileReg = regexp.MustCompile("(?i)(Android|Mobile|Phone)")
|
|
|
+var (
|
|
|
+ mongodb = public.MQFW
|
|
|
+ se = encrypt.SimpleEncrypt{Key: "topnet2015topnet2015"}
|
|
|
+ mobileReg = regexp.MustCompile("(?i)(Android|Mobile|Phone)")
|
|
|
+ cacheTimeOut = 3 * 24 * 60 * 60 //三天
|
|
|
+)
|
|
|
|
|
|
func init() {
|
|
|
//添加模块解析
|
|
@@ -95,6 +101,12 @@ func (a *Active) TransitRoute(key string) error {
|
|
|
redirectUrl = util.ObjToString(shortUrl["href"])
|
|
|
}
|
|
|
}
|
|
|
+ //未登录
|
|
|
+ if userId, _ := a.GetSession("userId").(string); userId == "" {
|
|
|
+ jy.SetCookieValue(a.ResponseWriter, jy.ChannelCookieName, key, cacheTimeOut) //三天
|
|
|
+ redis.Put("limitation", fmt.Sprintf("firstVisitTagByWX_%s", a.Session().Id()), key, cacheTimeOut) //登录注册 用户标识
|
|
|
+ return a.Redirect(redirectUrl)
|
|
|
+ }
|
|
|
}
|
|
|
return a.Redirect(redirectUrl)
|
|
|
}
|