Эх сурвалжийг харах

feat:JianyuDebug下允许账号同时登录

wangchuanjin 1 жил өмнө
parent
commit
1be21001a5

+ 1 - 1
src/jfw/active/active_future.go

@@ -39,7 +39,7 @@ func (a *Active) FutureIndex(share_openid string) error {
 				if code != "" {
 					openid = jyutil.Getopenid(code)
 					if openid != "" {
-						FindUserAndCreateSess(openid, a.Session(), "wx", false, true)
+						FindUserAndCreateSess(a.Request, openid, a.Session(), "wx", false, true)
 					}
 				}
 			} else {

+ 1 - 1
src/jfw/active/active_seal.go

@@ -255,7 +255,7 @@ func (a *Active) Index() error {
 				if code != "" {
 					openid := jyutil.Getopenid(code)
 					if openid != "" {
-						FindUserAndCreateSess(openid, a.Session(), "wx", false, true)
+						FindUserAndCreateSess(a.Request, openid, a.Session(), "wx", false, true)
 					}
 				}
 			} else {

+ 1 - 1
src/jfw/active/live.go

@@ -128,7 +128,7 @@ func (this *Active) LivePage() error {
 						checkIsSubscribeFlag = CheckUserIsSubscribe(openid)
 						if checkIsSubscribeFlag {
 							//关注用户 建session
-							go FindUserAndCreateSess(openid, this.Session(), "wx", false, true)
+							go FindUserAndCreateSess(this.Request, openid, this.Session(), "wx", false, true)
 						}
 					}
 				}

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

@@ -1,13 +1,14 @@
 package filter
 
 import (
-	jybase "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/encrypt"
-	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"jy/src/jfw/front"
 	"jy/src/jfw/jyutil"
 	"net/http"
 	"strconv"
+
+	jybase "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 )
 
 // SessionKeep 延长登录时间过滤器
@@ -30,7 +31,7 @@ func (sk *SessionKeep) Do() bool {
 			baseUserIdStr := encrypt.SE.DecodeString(ck.Value)
 			if baseUserId, _ = strconv.ParseInt(baseUserIdStr, 10, 64); baseUserId > 0 {
 				//模拟登录 更新用户session
-				front.FindUserAndCreateSessByBaseUserId(baseUserId, sk.Session, false, true)
+				front.FindUserAndCreateSessByBaseUserId(sk.R, baseUserId, sk.Session, false, true)
 			}
 		}
 	}

+ 1 - 1
src/jfw/front/applysub.go

@@ -200,7 +200,7 @@ func (a *Applysub) Index() error {
 			if code != "" {
 				openid = jyutil.Getopenid(code)
 				if openid != "" {
-					FindUserAndCreateSess(openid, a.Session(), "wx", false, true)
+					FindUserAndCreateSess(a.Request, openid, a.Session(), "wx", false, true)
 				}
 			}
 		} else {

+ 2 - 2
src/jfw/front/commonPayWx.go

@@ -32,7 +32,7 @@ var (
 		"areaPack":          {"省份订阅包"},
 		"filePack":          {"附件下载包"},
 		"buyerPortraitPack": {"采购单位画像包"},
-		"docMember":               {"剑鱼文库会员"},
+		"docMember":         {"剑鱼文库会员"},
 	}
 )
 
@@ -105,7 +105,7 @@ func (w *WxPayCommon) ToMyWxOrder() error {
 				openid := jyutil.Getopenid(code)
 				if openid != "" {
 					if CheckUserIsSubscribe(openid) {
-						FindUserAndCreateSess(openid, w.Session(), "wx", false, true)
+						FindUserAndCreateSess(w.Request, openid, w.Session(), "wx", false, true)
 					}
 				}
 			}

+ 4 - 4
src/jfw/front/distribution.go

@@ -46,7 +46,7 @@ func (this *Distrib) LinkShare(discored string) error {
 					checkIsSubscribeFlag = CheckUserIsSubscribe(openid)
 					if checkIsSubscribeFlag {
 						//关注用户 建session
-						FindUserAndCreateSess(openid, this.Session(), "wx", false, true)
+						FindUserAndCreateSess(this.Request, openid, this.Session(), "wx", false, true)
 					}
 				}
 			}
@@ -94,7 +94,7 @@ func (this *Distrib) LinkShareX(discored string) error {
 					checkIsSubscribeFlag = CheckUserIsSubscribe(openid)
 					if checkIsSubscribeFlag {
 						//关注用户 建session
-						FindUserAndCreateSess(openid, this.Session(), "wx", false, true)
+						FindUserAndCreateSess(this.Request, openid, this.Session(), "wx", false, true)
 					}
 				}
 			}
@@ -142,7 +142,7 @@ func (this *Distrib) LinkShareG(discored string) error {
 					checkIsSubscribeFlag = CheckUserIsSubscribe(openid)
 					if checkIsSubscribeFlag {
 						//关注用户 建session
-						FindUserAndCreateSess(openid, this.Session(), "wx", false, true)
+						FindUserAndCreateSess(this.Request, openid, this.Session(), "wx", false, true)
 					}
 				}
 			}
@@ -192,7 +192,7 @@ func (this *Distrib) LinkShareE(discored string) error {
 					checkIsSubscribeFlag = CheckUserIsSubscribe(openid)
 					if checkIsSubscribeFlag {
 						//关注用户 建session
-						FindUserAndCreateSess(openid, this.Session(), "wx", false, true)
+						FindUserAndCreateSess(this.Request, openid, this.Session(), "wx", false, true)
 					}
 				}
 			}

+ 1 - 1
src/jfw/front/follow.go

@@ -1583,7 +1583,7 @@ func (this *Follow) FollowGift(shareid string) error {
 						openid = jyutil.Getopenid(code)
 						if openid != "" {
 							if CheckUserIsSubscribe(openid) {
-								FindUserAndCreateSess(openid, this.Session(), "wx", false, true)
+								FindUserAndCreateSess(this.Request, openid, this.Session(), "wx", false, true)
 							}
 						}
 					}

+ 15 - 11
src/jfw/front/front.go

@@ -9,6 +9,7 @@ import (
 	"jy/src/jfw/wx"
 	"log"
 	"math/rand"
+	"net/http"
 	"net/url"
 	"regexp"
 	"strconv"
@@ -621,7 +622,7 @@ func (f *Front) Login(key string) error {
 	shareid := se.DecodeString(key)
 	openid := redis.GetStr("sso", "p_usershare_"+shareid)
 	if openid != "" {
-		ok, user, userInfo := FindUserAndCreateSess(openid, f.Session(), "pc", true, true)
+		ok, user, userInfo := FindUserAndCreateSess(f.Request, openid, f.Session(), "pc", true, true)
 		if ok {
 			(*user)["shareid"] = shareid
 			f.SetSession("user", *user)
@@ -807,27 +808,27 @@ func (m *Front) Wxerr() error {
 }
 
 // 查找用户并创建session
-func FindUserAndCreateSess(openid string, sess *httpsession.Session, typ string, flag, isSwitchToBestIdentity bool) (bool, *map[string]interface{}, map[string]interface{}) {
-	return CreateSession(map[string]interface{}{
+func FindUserAndCreateSess(request *http.Request, openid string, sess *httpsession.Session, typ string, flag, isSwitchToBestIdentity bool) (bool, *map[string]interface{}, map[string]interface{}) {
+	return CreateSession(request, map[string]interface{}{
 		"s_m_openid": openid,
 		"s_unionid":  map[string]interface{}{"$ne": openid}, //处理排除未关注用户点击菜单创建的用户
 		"i_ispush":   1,
 	}, sess, typ, flag, isSwitchToBestIdentity)
 }
-func FindUserAndCreateSessByBaseUserId(userId int64, sess *httpsession.Session, flag, isSwitchToBestIdentity bool) (bool, *map[string]interface{}, map[string]interface{}) {
-	return CreateSession(map[string]interface{}{
+func FindUserAndCreateSessByBaseUserId(request *http.Request, userId int64, sess *httpsession.Session, flag, isSwitchToBestIdentity bool) (bool, *map[string]interface{}, map[string]interface{}) {
+	return CreateSession(request, map[string]interface{}{
 		"base_user_id": userId,
 	}, sess, "pc", flag, isSwitchToBestIdentity)
 
 }
 
-func FindUserAndCreateSessById(userId primitive.ObjectID, sess *httpsession.Session, flag, isSwitchToBestIdentity bool) (bool, *map[string]interface{}, map[string]interface{}) {
-	return CreateSession(map[string]interface{}{
+func FindUserAndCreateSessById(request *http.Request, userId primitive.ObjectID, sess *httpsession.Session, flag, isSwitchToBestIdentity bool) (bool, *map[string]interface{}, map[string]interface{}) {
+	return CreateSession(request, map[string]interface{}{
 		"_id": userId,
 	}, sess, "pc", flag, isSwitchToBestIdentity)
 }
 
-func CreateSession(q map[string]interface{}, sess *httpsession.Session, typ string, flag, isSwitchToBestIdentity bool) (bool, *map[string]interface{}, map[string]interface{}) {
+func CreateSession(request *http.Request, q map[string]interface{}, sess *httpsession.Session, typ string, flag, isSwitchToBestIdentity bool) (bool, *map[string]interface{}, map[string]interface{}) {
 	if q == nil || len(q) == 0 {
 		return false, nil, nil
 	}
@@ -836,6 +837,9 @@ func CreateSession(q map[string]interface{}, sess *httpsession.Session, typ stri
 		return false, nil, nil
 	}
 	userid := util.ObjToString(sessionVal["userId"])
+	if request != nil && strings.Contains(request.UserAgent(), "JianyuDebug") {
+		flag = true
+	}
 	if pcSessionFlag, ok := config.Sysconfig["pcSessionFlag"].(bool); pcSessionFlag && ok && flag {
 		//无限制登陆用户
 		if util.IntAll(sessionVal["i_unlimited"]) <= 0 {
@@ -896,18 +900,18 @@ func (m *Front) Sess(ostr string) error {
 					identity = config.Middleground.UserCenter.IdentityByPositionId(util.Int64All(userFlag))
 				}
 				if identity != nil {
-					ok, _, _ = FindUserAndCreateSessByBaseUserId(identity.UserId, m.Session(), false, false)
+					ok, _, _ = FindUserAndCreateSessByBaseUserId(m.Request, identity.UserId, m.Session(), false, false)
 				}
 			} else {
 				hasIdentity := false
 				if str[1] == "_id" {
-					if ok, _, _ = FindUserAndCreateSessById(mgdb.StringTOBsonId(userFlag), m.Session(), false, !hasIdentity); ok {
+					if ok, _, _ = FindUserAndCreateSessById(m.Request, mgdb.StringTOBsonId(userFlag), m.Session(), false, !hasIdentity); ok {
 						hasIdentity = true
 					}
 				} else {
 					//P387用户身份及搜索模式优化-微信公众号点击菜单重新获取上次身份
 					if userFlag != "" {
-						if ok, _, _ = FindUserAndCreateSess(userFlag, m.Session(), "wx", false, !hasIdentity); ok {
+						if ok, _, _ = FindUserAndCreateSess(m.Request, userFlag, m.Session(), "wx", false, !hasIdentity); ok {
 							hasIdentity = true
 						}
 					}

+ 7 - 6
src/jfw/front/frontRouter.go

@@ -1,11 +1,6 @@
 package front
 
 import (
-	"app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/encrypt"
-	elastic "app.yhyue.com/moapp/jybase/es"
-	"app.yhyue.com/moapp/jybase/redis"
-	"app.yhyue.com/moapp/jypkg/public"
 	"fmt"
 	"jy/src/jfw/config"
 	"jy/src/jfw/jyutil"
@@ -14,6 +9,12 @@ import (
 	"regexp"
 	"strings"
 
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	elastic "app.yhyue.com/moapp/jybase/es"
+	"app.yhyue.com/moapp/jybase/redis"
+	"app.yhyue.com/moapp/jypkg/public"
+
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 
 	//"strings"
@@ -85,7 +86,7 @@ func (this *CommonRouter) WxCommonPage(folder, loginSign, htmlPage string) error
 				return this.Redirect(fmt.Sprintf(config.Wxoauth, url.QueryEscape(this.Site()+this.Url()), "wx"), 302)
 			}
 			openid = jyutil.Getopenid(this.GetString("code"))
-			if ok, _, _ := FindUserAndCreateSess(openid, this.Session(), "wx", false, true); !ok {
+			if ok, _, _ := FindUserAndCreateSess(this.Request, openid, this.Session(), "wx", false, true); !ok {
 				return this.Redirect("/swordfish/about")
 			}
 		}

+ 9 - 7
src/jfw/front/login.go

@@ -1,16 +1,18 @@
 package front
 
 import (
-	"app.yhyue.com/moapp/jybase/date"
 	"fmt"
-	"github.com/gogf/gf/v2/util/gconv"
 	"jy/src/jfw/config"
 	jutil "jy/src/jfw/jyutil"
 	"log"
+	"net/http"
 	"regexp"
 	"strings"
 	"time"
 
+	"app.yhyue.com/moapp/jybase/date"
+	"github.com/gogf/gf/v2/util/gconv"
+
 	qutil "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/dchest/captcha"
 	"app.yhyue.com/moapp/jybase/encrypt"
@@ -111,7 +113,7 @@ func (l *Login) Login() error {
 			}, `{"s_phone":-1}`, `{"_id":1,"s_password":1}`, false, 0, 1)
 			if ok && user != nil && len(*user) > 0 {
 				if qutil.ObjToString((*user)[0]["s_password"]) == qutil.GetMd5String(password) {
-					ok, _, userInfo := afterLogin(phone, l.Session(), true)
+					ok, _, userInfo := afterLogin(l.Request, phone, l.Session(), true)
 					if ok {
 						result["userInfo"] = userInfo
 						go anonymousLogin(l.Session(), l.Cookie("JYTrustedId"))
@@ -212,7 +214,7 @@ func (l *Login) Login() error {
 						//用户日志保存
 						jy.SaveUserLog(public.Mgo_Log, _id, phone, "phone", "pc", source, "", gconv.String(l.GetSession("RSource")), gconv.String(sessVal["RSource"]), qutil.GetIp(l.Request), l.UserAgent(), "jybx", "")
 						jy.ClearPhoneIdentSession(l.Session())
-						ok, _, userInfo := afterLogin(phone, l.Session(), false)
+						ok, _, userInfo := afterLogin(l.Request, phone, l.Session(), false)
 						userInfo["isNewUser"] = true
 						nsqPath, _ := config.Sysconfig["nsq"].(string)
 						nsq_topic, _ := config.Sysconfig["nsq_topic"].(string)
@@ -256,7 +258,7 @@ func (l *Login) Login() error {
 						})
 					}
 					jy.ClearPhoneIdentSession(l.Session())
-					ok, _, userInfo := afterLogin(phone, l.Session(), false)
+					ok, _, userInfo := afterLogin(l.Request, phone, l.Session(), false)
 					if ok {
 						result["userInfo"] = userInfo
 						go anonymousLogin(l.Session(), l.Cookie("JYTrustedId"))
@@ -471,7 +473,7 @@ func anonymousLogin(session *httpsession.Session, trustedId string) {
 	//}
 }
 
-func afterLogin(phone string, session *httpsession.Session, fool bool) (bool, *map[string]interface{}, map[string]interface{}) {
+func afterLogin(request *http.Request, phone string, session *httpsession.Session, fool bool) (bool, *map[string]interface{}, map[string]interface{}) {
 	ok, user := getPhoneUser(phone, fool)
 	if !ok {
 		return false, nil, nil
@@ -479,7 +481,7 @@ func afterLogin(phone string, session *httpsession.Session, fool bool) (bool, *m
 	if user == nil || len(user) == 0 {
 		return false, nil, nil
 	}
-	return FindUserAndCreateSessById(user["_id"].(primitive.ObjectID), session, true, true)
+	return FindUserAndCreateSessById(request, user["_id"].(primitive.ObjectID), session, true, true)
 }
 
 func GetModule(source string) string {

+ 4 - 3
src/jfw/front/org_structure.go

@@ -9,12 +9,13 @@ package front
 
 import (
 	"fmt"
-	"github.com/gogf/gf/v2/util/gconv"
 	"jy/src/jfw/config"
 	"log"
 	"net/url"
 	"time"
 
+	"github.com/gogf/gf/v2/util/gconv"
+
 	"jy/src/jfw/jyutil"
 	. "jy/src/jfw/public"
 
@@ -95,7 +96,7 @@ func (this *OrgStructure) InvitationPage() error {
 			isSubscribe = CheckUserIsSubscribe(openId)
 			if isSubscribe {
 				registered = "1"
-				FindUserAndCreateSess(openId, this.Session(), "wx", false, true)
+				FindUserAndCreateSess(this.Request, openId, this.Session(), "wx", false, true)
 				phone = util.If(this.GetSession("phone") != nil, this.GetSession("phone"), "").(string)
 			}
 		}
@@ -123,7 +124,7 @@ func (this *OrgStructure) Authorize() error {
 	if openId != "" {
 		isSubscribe = CheckUserIsSubscribe(openId)
 		if isSubscribe {
-			FindUserAndCreateSess(openId, this.Session(), "wx", false, true)
+			FindUserAndCreateSess(this.Request, openId, this.Session(), "wx", false, true)
 		} else { //获取未关注用户uninoid
 			unionId = GetUnionid(openId)
 		}

+ 3 - 2
src/jfw/front/pchelper.go

@@ -3,7 +3,6 @@ package front
 import (
 	"encoding/base64"
 	"fmt"
-	"github.com/gogf/gf/v2/util/gconv"
 	"jy/src/jfw/config"
 	"jy/src/jfw/jyutil"
 	"log"
@@ -11,6 +10,8 @@ import (
 	"strings"
 	"time"
 
+	"github.com/gogf/gf/v2/util/gconv"
+
 	"app.yhyue.com/moapp/jypkg/public"
 
 	. "app.yhyue.com/moapp/jybase/date"
@@ -308,7 +309,7 @@ func (l *PcHelper) ToAct(token string) error {
 				if phone != "" && deMac != "" {
 					if len([]rune(phone)) == 11 {
 						//PcHelperLoginInfo(phone, l.Session())
-						CreateSession(map[string]interface{}{
+						CreateSession(l.Request, map[string]interface{}{
 							"i_appid": 2,
 							"s_phone": phone,
 						}, l.Session(), "pchelper", true, true)

+ 2 - 2
src/jfw/front/shorturl.go

@@ -141,7 +141,7 @@ func (s *Short) Article(stype, id string) error {
 				if code := s.GetString("code"); code != "" {
 					if openid := jyutil.Getopenid(code); openid != "" {
 						if CheckUserIsSubscribe(openid) {
-							FindUserAndCreateSess(openid, s.Session(), "wx", false, true)
+							FindUserAndCreateSess(s.Request, openid, s.Session(), "wx", false, true)
 							//生session后 重新获取一下
 							//userId, _ = s.GetSession("userId").(string)
 							sess = s.Session().GetMultiple()
@@ -450,7 +450,7 @@ func (s *Short) LoginCommon(sess map[string]interface{}, stype, id string, bm bo
 			}
 			//之前sessionkeep.go中没有放userId,造成关注有问题
 			if userId == "" {
-				FindUserAndCreateSess(ssOpenid.(string), s.Session(), "wx", false, true)
+				FindUserAndCreateSess(s.Request, ssOpenid.(string), s.Session(), "wx", false, true)
 			}
 		}
 		surl := s.GetString("url")

+ 11 - 10
src/jfw/front/singleLogin.go

@@ -1,6 +1,14 @@
 package front
 
 import (
+	"fmt"
+	"jy/src/jfw/config"
+	"jy/src/jfw/jyutil"
+	"log"
+	"net/url"
+	"strings"
+	"time"
+
 	qutil "app.yhyue.com/moapp/jybase/common"
 	. "app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
@@ -10,15 +18,8 @@ import (
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 	. "app.yhyue.com/moapp/jypkg/identity"
 	"app.yhyue.com/moapp/jypkg/public"
-	"fmt"
 	"go.mongodb.org/mongo-driver/bson"
 	"go.mongodb.org/mongo-driver/bson/primitive"
-	"jy/src/jfw/config"
-	"jy/src/jfw/jyutil"
-	"log"
-	"net/url"
-	"strings"
-	"time"
 )
 
 type SingleLogin struct {
@@ -54,7 +55,7 @@ func (this *SingleLogin) KeyPhrases(key string) error {
 				if code := this.GetString("code"); code != "" {
 					if openid := jyutil.Getopenid(code); openid != "" {
 						if CheckUserIsSubscribe(openid) {
-							FindUserAndCreateSess(openid, this.Session(), "wx", false, true)
+							FindUserAndCreateSess(this.Request, openid, this.Session(), "wx", false, true)
 							//生session后 重新获取一下
 							sess = this.Session().GetMultiple()
 							userId, _ = sess["userId"].(string)
@@ -72,7 +73,7 @@ func (this *SingleLogin) KeyPhrases(key string) error {
 			mgoUserId := qutil.InterfaceToStr(sess["mgoUserId"])
 			//身份切换
 			if positionType > 0 {
-				FindUserAndCreateSessById(mgdb.StringTOBsonId(mgoUserId), this.Session(), false, false)
+				FindUserAndCreateSessById(this.Request, mgdb.StringTOBsonId(mgoUserId), this.Session(), false, false)
 				identity := config.Middleground.UserCenter.IdentityByUserId(qutil.Int64All(this.GetSession("base_user_id")))
 				if identity != nil {
 					NewIdentityInfo(identity).Switch(this.Session(), &public.MQFW)
@@ -213,7 +214,7 @@ func (this *SingleLogin) SingleLogin() error {
 			}(id)
 		}
 		if this.GetSession("userId") == nil || this.GetSession("phone") == nil {
-			CreateSession(map[string]interface{}{
+			CreateSession(this.Request, map[string]interface{}{
 				"s_m_openid": openid,
 				"s_unionid":  map[string]interface{}{"$ne": openid}, //处理排除未关注用户点击菜单创建的用户
 			}, this.Session(), "singleLogin", false, true)

+ 4 - 3
src/jfw/front/swordfish.go

@@ -1,8 +1,6 @@
 package front
 
 import (
-	. "app.yhyue.com/moapp/jybase/date"
-	. "app.yhyue.com/moapp/jybase/mongodb"
 	"encoding/base64"
 	"encoding/json"
 	"fmt"
@@ -17,6 +15,9 @@ import (
 	"strings"
 	"time"
 
+	. "app.yhyue.com/moapp/jybase/date"
+	. "app.yhyue.com/moapp/jybase/mongodb"
+
 	util "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	elastic "app.yhyue.com/moapp/jybase/es"
@@ -1389,7 +1390,7 @@ func (m *Front) About() error {
 	if myopenid != "" {
 		isSubscribe = CheckUserIsSubscribe(myopenid)
 		if isSubscribe {
-			FindUserAndCreateSess(myopenid, m.Session(), "wx", false, true)
+			FindUserAndCreateSess(m.Request, myopenid, m.Session(), "wx", false, true)
 			myopenid, _ = getsession["s_m_openid"].(string)
 			mynickname, _ = getsession["s_nickname"].(string)
 		}

+ 1 - 1
src/jfw/front/vipsubscribe.go

@@ -218,7 +218,7 @@ func (s *Subscribepay) Introduce() error {
 				if openid != "" {
 					isSubscribe := CheckUserIsSubscribe(openid)
 					if isSubscribe {
-						FindUserAndCreateSess(openid, s.Session(), "wx", false, true)
+						FindUserAndCreateSess(s.Request, openid, s.Session(), "wx", false, true)
 						userId = util.ObjToString(s.GetSession("userId"))
 					}
 				}

+ 10 - 9
src/jfw/front/websocket.go

@@ -1,14 +1,6 @@
 package front
 
 import (
-	qutil "app.yhyue.com/moapp/jybase/common"
-	. "app.yhyue.com/moapp/jybase/date"
-	"app.yhyue.com/moapp/jybase/encrypt"
-	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
-	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
-	"app.yhyue.com/moapp/jybase/redis"
-	"app.yhyue.com/moapp/jypkg/golang.org/x/net/websocket"
-	"app.yhyue.com/moapp/jypkg/public"
 	"encoding/json"
 	"fmt"
 	. "jy/src/jfw/config"
@@ -18,6 +10,15 @@ import (
 	"strings"
 	"sync"
 	"time"
+
+	qutil "app.yhyue.com/moapp/jybase/common"
+	. "app.yhyue.com/moapp/jybase/date"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"app.yhyue.com/moapp/jybase/redis"
+	"app.yhyue.com/moapp/jypkg/golang.org/x/net/websocket"
+	"app.yhyue.com/moapp/jypkg/public"
 )
 
 // socket对象放在内存中,待rpc回调使用
@@ -173,7 +174,7 @@ func LoginInfo(shareid, openid string, Sess interface{}) map[string]interface{}
 	}
 	sess, _ := Sess.(*httpsession.Session)
 	if openid != "" {
-		ok, user, infoData := FindUserAndCreateSess(openid, sess, "pc", true, true)
+		ok, user, infoData := FindUserAndCreateSess(nil, openid, sess, "pc", true, true)
 		if ok {
 			(*user)["shareid"] = shareid
 			sess.Set("user", *user)

+ 3 - 3
src/jfw/front/ws_dataExport.go

@@ -56,7 +56,7 @@ func (w *WsDataExport) WxToOrderDetail() error {
 			if code != "" {
 				openid := jyutil.Getopenid(code)
 				if openid != "" {
-					FindUserAndCreateSess(openid, w.Session(), "wx", false, true)
+					FindUserAndCreateSess(w.Request, openid, w.Session(), "wx", false, true)
 				}
 			}
 		} else {
@@ -233,7 +233,7 @@ func (w *WsDataExport) ToPreview(_id string) error {
 			if code != "" {
 				openid = jyutil.Getopenid(code)
 				if openid != "" {
-					FindUserAndCreateSess(openid, w.Session(), "wx", false, true)
+					FindUserAndCreateSess(w.Request, openid, w.Session(), "wx", false, true)
 				}
 			}
 		} else {
@@ -263,7 +263,7 @@ func (w *WsDataExport) SubmitOrder() error {
 			if code != "" {
 				openid = jyutil.Getopenid(code)
 				if openid != "" {
-					FindUserAndCreateSess(openid, w.Session(), "wx", false, true)
+					FindUserAndCreateSess(w.Request, openid, w.Session(), "wx", false, true)
 				}
 			}
 		} else {