|
@@ -1,30 +1,35 @@
|
|
|
package filter
|
|
|
|
|
|
import (
|
|
|
- "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
- "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
- fx "app.yhyue.com/moapp/jypkg/filter/xweb"
|
|
|
- "net/http"
|
|
|
- "strings"
|
|
|
+ "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
+ "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
+ fx "app.yhyue.com/moapp/jypkg/filter/xweb"
|
|
|
+ "log"
|
|
|
+ "net/http"
|
|
|
+ "strings"
|
|
|
)
|
|
|
|
|
|
// CookieInfo 信息
|
|
|
type CookieInfo struct {
|
|
|
- W http.ResponseWriter
|
|
|
- R *http.Request
|
|
|
- IsLogin bool
|
|
|
- Session *httpsession.Session
|
|
|
+ W http.ResponseWriter
|
|
|
+ R *http.Request
|
|
|
+ IsLogin bool
|
|
|
+ Session *httpsession.Session
|
|
|
}
|
|
|
|
|
|
// Do 继承过滤器方法
|
|
|
func (ci *CookieInfo) Do() {
|
|
|
- if crr := ci.R.Referer(); !ci.IsLogin && crr != "" {
|
|
|
- if strings.Contains(crr, "cooperate") {
|
|
|
- match := strings.Split(crr, "cooperate/")
|
|
|
- if len(match) > 1 {
|
|
|
- fx.SetVisitSource(ci.Session, match[1])
|
|
|
- jy.SetCookieValue(ci.W, jy.ChannelCookieName, match[1], 7*24*60*60)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ //判断 cookie 是否有seo referer标识
|
|
|
+ if seoRefer, err := ci.R.Cookie("SeoRefer"); err != nil && seoRefer.Value != "" {
|
|
|
+ log.Println("-----------seoRefer------------", seoRefer)
|
|
|
+ }
|
|
|
+ if crr := ci.R.Referer(); !ci.IsLogin && crr != "" {
|
|
|
+ if strings.Contains(crr, "cooperate") {
|
|
|
+ match := strings.Split(crr, "cooperate/")
|
|
|
+ if len(match) > 1 {
|
|
|
+ fx.SetVisitSource(ci.Session, match[1])
|
|
|
+ jy.SetCookieValue(ci.W, jy.ChannelCookieName, match[1], 7*24*60*60)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|