|
@@ -604,7 +604,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())
|
|
|
+ ok, user, userInfo := FindUserAndCreateSess(openid, f.Session(), "pc", true)
|
|
|
if ok {
|
|
|
(*user)["shareid"] = shareid
|
|
|
f.SetSession("user", *user)
|
|
@@ -785,21 +785,21 @@ func (m *Front) Wxerr() error {
|
|
|
}
|
|
|
|
|
|
//查找用户并创建session
|
|
|
-func FindUserAndCreateSess(openid string, sess *httpsession.Session) (bool, *map[string]interface{}, map[string]interface{}) {
|
|
|
+func FindUserAndCreateSess(openid string, sess *httpsession.Session, typ string, flag bool) (bool, *map[string]interface{}, map[string]interface{}) {
|
|
|
return CreateSession(map[string]interface{}{
|
|
|
"s_m_openid": openid,
|
|
|
"s_unionid": map[string]interface{}{"$ne": openid}, //处理排除未关注用户点击菜单创建的用户
|
|
|
"i_ispush": 1,
|
|
|
- }, sess)
|
|
|
+ }, sess, typ, flag)
|
|
|
}
|
|
|
|
|
|
func FindUserAndCreateSessById(userId primitive.ObjectID, sess *httpsession.Session) (bool, *map[string]interface{}, map[string]interface{}) {
|
|
|
return CreateSession(map[string]interface{}{
|
|
|
"_id": userId,
|
|
|
- }, sess)
|
|
|
+ }, sess, "pc", true)
|
|
|
}
|
|
|
|
|
|
-func CreateSession(q map[string]interface{}, sess *httpsession.Session) (bool, *map[string]interface{}, map[string]interface{}) {
|
|
|
+func CreateSession(q map[string]interface{}, sess *httpsession.Session, typ string, flag bool) (bool, *map[string]interface{}, map[string]interface{}) {
|
|
|
if q == nil || len(q) == 0 {
|
|
|
return false, nil, nil
|
|
|
}
|
|
@@ -807,6 +807,16 @@ func CreateSession(q map[string]interface{}, sess *httpsession.Session) (bool, *
|
|
|
if person == nil {
|
|
|
return false, nil, nil
|
|
|
}
|
|
|
+ log.Println(config.Sysconfig["pcSessionFlag"].(bool), flag)
|
|
|
+ //
|
|
|
+ if pcSessionFlag, ok := config.Sysconfig["pcSessionFlag"].(bool); pcSessionFlag && ok && flag {
|
|
|
+ userid := util.ObjToString(sessionVal["userId"])
|
|
|
+ sidStr := fmt.Sprint(sess.Id())
|
|
|
+ jyutil.ClearPcSession(userid, sidStr)
|
|
|
+ log.Println("sess:", sess.Id(), q["_id"])
|
|
|
+ redis.Put("other", jyutil.LoginRedisKey(userid), sess.Id(), 3600*util.IntAllDef(config.Sysconfig["pcSessionTimeout"], 168))
|
|
|
+ }
|
|
|
+ sessionVal["platform"] = typ
|
|
|
sess.SetMultiple(sessionVal)
|
|
|
infoData := map[string]interface{}{
|
|
|
"result": "ok",
|
|
@@ -836,7 +846,7 @@ func (m *Front) Sess(ostr string) error {
|
|
|
str := strings.Split(sewx.DecodeString(strs[0]), ",")
|
|
|
if len(str) == 4 {
|
|
|
openid := str[0]
|
|
|
- ok, _, _ := FindUserAndCreateSess(openid, m.Session())
|
|
|
+ ok, _, _ := FindUserAndCreateSess(openid, m.Session(), "wx", false)
|
|
|
if ok {
|
|
|
actionurl := util.ObjToString(urlMap[str[3]])
|
|
|
if actionurl != "" {
|