wangshan hai 1 ano
pai
achega
bb2abca1f5
Modificáronse 1 ficheiros con 5 adicións e 4 borrados
  1. 5 4
      identity/identity.go

+ 5 - 4
identity/identity.go

@@ -38,7 +38,7 @@ func NewIdentityInfo(i *pb.Identity) *IdentityInfo {
 	}
 }
 
-//切换身份
+// 切换身份
 func (i *IdentityInfo) Switch(sess *httpsession.Session, mgo *MongodbSim) bool {
 	ok := false
 	m := map[string]interface{}{
@@ -74,14 +74,15 @@ func (i *IdentityInfo) Switch(sess *httpsession.Session, mgo *MongodbSim) bool {
 	return ok
 }
 
-//切换到最优身份
+// 切换到最优身份
 func SwitchToBest(userId int64, sess *httpsession.Session, mgd *Middleground, mgo *MongodbSim, isSelectLast bool) (int64, bool) {
-	list := mgd.UserCenter.IdentityList(userId)
+	mgoUserId, _ := sess.Get("mgoUserId").(string)
+	list := mgd.UserCenter.IdentityList(userId, mgoUserId, "10000")
 	if list == nil || len(list) == 0 {
 		return -1, false
 	}
 	if isSelectLast {
-		if mgoUserId, _ := sess.Get("mgoUserId").(string); mgoUserId != "" {
+		if mgoUserId != "" {
 			user, ok := mgo.FindById("user", mgoUserId, `{"login_positionid":1}`)
 			if ok && user != nil && len(*user) > 0 {
 				if login_positionid := Int64All((*user)["login_positionid"]); login_positionid > 0 {