|
@@ -1,50 +1,50 @@
|
|
|
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"
|
|
|
- "log"
|
|
|
- "net/http"
|
|
|
+ qu "app.yhyue.com/moapp/jybase/common"
|
|
|
+ "fmt"
|
|
|
+ "jy/src/jfw/modules/subscribepay/src/config"
|
|
|
+ "jy/src/jfw/modules/subscribepay/src/util"
|
|
|
+ "log"
|
|
|
+ "net/http"
|
|
|
|
|
|
- "app.yhyue.com/moapp/jybase/redis"
|
|
|
- "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
+ "app.yhyue.com/moapp/jybase/redis"
|
|
|
+ "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
|
|
|
- "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
+ "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
)
|
|
|
|
|
|
// 用户合并删除用户检测
|
|
|
type mergeFilter struct {
|
|
|
- W http.ResponseWriter
|
|
|
- R *http.Request
|
|
|
- Session *httpsession.Session
|
|
|
- GetSession map[string]interface{}
|
|
|
+ W http.ResponseWriter
|
|
|
+ R *http.Request
|
|
|
+ Session *httpsession.Session
|
|
|
+ GetSession map[string]interface{}
|
|
|
}
|
|
|
|
|
|
func (l *mergeFilter) Do() bool {
|
|
|
- //账户合并-刷新session
|
|
|
- uid, _ := l.GetSession["mgoUserId"].(string)
|
|
|
- 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)
|
|
|
- } else {
|
|
|
- jy.SetCookie(l.W, l.R, jy.ExperienceSign, "experiencing", fmt.Sprintf(".%s", l.R.Host), -1)
|
|
|
- }
|
|
|
- if flushSession, _ := l.GetSession["flushSession"].(bool); flushSession {
|
|
|
- jy.CreateUserMerge(util.MQFW, util.Mysql, l.Session, config.Middleground).FlushSession(uid)
|
|
|
- l.Session.Del("flushSession")
|
|
|
- }
|
|
|
- if val := redis.Get("session", fmt.Sprintf("usermerge_delete_%s", uid)); val != nil {
|
|
|
- if sUid, ok := val.(string); sUid != "" && ok {
|
|
|
- log.Printf("账户合并 mergeFilter 自动刷新session old:%s new:%s\n", uid, sUid)
|
|
|
- jy.CreateUserMerge(util.MQFW, util.Mysql, l.Session, config.Middleground).FlushSession(sUid)
|
|
|
- return true
|
|
|
- }
|
|
|
- }
|
|
|
- return true
|
|
|
+ //账户合并-刷新session
|
|
|
+ uid, _ := l.GetSession["mgoUserId"].(string)
|
|
|
+ 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)
|
|
|
+ } else {
|
|
|
+ jy.SetCookie(l.W, l.R, jy.ExperienceSign, "experiencing", fmt.Sprintf(".%s", l.R.Host), -1)
|
|
|
+ }
|
|
|
+ if flushSession, _ := l.GetSession["flushSession"].(bool); flushSession {
|
|
|
+ jy.CreateUserMerge(util.MQFW, util.Mysql, l.Session, config.Middleground).FlushSession(uid)
|
|
|
+ l.Session.Del("flushSession")
|
|
|
+ }
|
|
|
+ if val := redis.Get("session", fmt.Sprintf("usermerge_delete_%s", uid)); val != nil {
|
|
|
+ if sUid, ok := val.(string); sUid != "" && ok {
|
|
|
+ log.Printf("账户合并 mergeFilter 自动刷新session old:%s new:%s\n", uid, sUid)
|
|
|
+ jy.CreateUserMerge(util.MQFW, util.Mysql, l.Session, config.Middleground).FlushSession(sUid)
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
}
|