Browse Source

记录上次身份

wangchuanjin 2 years ago
parent
commit
99242a972c
1 changed files with 8 additions and 0 deletions
  1. 8 0
      identity/identity.go

+ 8 - 0
identity/identity.go

@@ -3,6 +3,7 @@ package identity
 import (
 	"strconv"
 
+	. "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	. "app.yhyue.com/moapp/jypkg/middleground"
 	"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 {
 		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{}
 	for _, v := range list {
 		if v.PositionType == 1 {