浏览代码

记录上次身份

wangchuanjin 2 年之前
父节点
当前提交
99242a972c
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      identity/identity.go

+ 8 - 0
identity/identity.go

@@ -3,6 +3,7 @@ package identity
 import (
 import (
 	"strconv"
 	"strconv"
 
 
+	. "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	. "app.yhyue.com/moapp/jypkg/middleground"
 	. "app.yhyue.com/moapp/jypkg/middleground"
 	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
 	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
@@ -72,6 +73,13 @@ func SwitchToBest(userId int64, sess *httpsession.Session, mgd *Middleground) bo
 	if list == nil || len(list) == 0 {
 	if list == nil || len(list) == 0 {
 		return false
 		return false
 	}
 	}
+	if beforePositionId := Int64All(sess.Get("beforePositionId")); beforePositionId > 0 {
+		for _, v := range list {
+			if v.PositionId == beforePositionId {
+				return NewIdentityInfo(v).Switch(sess)
+			}
+		}
+	}
 	reqIds := []int64{}
 	reqIds := []int64{}
 	for _, v := range list {
 	for _, v := range list {
 		if v.PositionType == 1 {
 		if v.PositionType == 1 {