1234567891011121314151617181920212223242526 |
- package util
- import (
- "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/entity"
- "fmt"
- "github.com/zeromicro/go-zero/core/logx"
- "net/http"
- )
- func GetTouristCookieInfo(r *http.Request) (sessionId, trustedId string, err error) {
- cn, ce := r.Cookie(entity.CookieName)
- ti, te := r.Cookie(entity.JYTrustedId)
- if ce != nil || cn == nil || cn.Value == "" { //session
- err = fmt.Errorf("当用户信息有误")
- logx.Error("当前用户没有session信息")
- return
- }
- if te != nil || ti == nil || ti.Value == "" { //不存在信用标识
- err = fmt.Errorf("当用户信息有误")
- logx.Error("当前用户没有JYTrustedIdn信息")
- return
- }
- sessionId = cn.Value
- trustedId = ti.Value
- return
- }
|