|
@@ -19,32 +19,26 @@ type IdentityInfo struct {
|
|
|
EntUserName string //企业员工姓名
|
|
|
}
|
|
|
|
|
|
-//个人
|
|
|
-func (i *IdentityInfo) SwitchToPersonal(sess *httpsession.Session) bool {
|
|
|
- if sess.Del("entId", "entName", "entUserId", "entUserName", "entAccountId") {
|
|
|
- sess.SetMultiple(map[string]interface{}{
|
|
|
- "personId": i.PersonId,
|
|
|
- "userName": i.UserName,
|
|
|
- "accountId": i.AccountId,
|
|
|
- "positionId": i.PositionId,
|
|
|
- "positionType": i.PositionType,
|
|
|
- "userId": sess.Get("mgoUserId"),
|
|
|
- })
|
|
|
- return true
|
|
|
- }
|
|
|
- return false
|
|
|
-}
|
|
|
-
|
|
|
-//企业
|
|
|
-func (i *IdentityInfo) SwitchToEnt(sess *httpsession.Session) bool {
|
|
|
- sess.SetMultiple(map[string]interface{}{
|
|
|
+//切换身份
|
|
|
+func (i *IdentityInfo) Switch(sess *httpsession.Session) bool {
|
|
|
+ ok := false
|
|
|
+ m := map[string]interface{}{
|
|
|
"personId": i.PersonId,
|
|
|
"userName": i.UserName,
|
|
|
"accountId": i.AccountId,
|
|
|
"positionId": i.PositionId,
|
|
|
"positionType": i.PositionType,
|
|
|
- "userId": strconv.FormatInt(i.PositionId, 10),
|
|
|
- "entAccountId": i.EntAccountId,
|
|
|
- })
|
|
|
- return true
|
|
|
+ }
|
|
|
+ if i.PositionType == 0 {
|
|
|
+ if sess.Del("entId", "entName", "entUserId", "entUserName", "entAccountId") {
|
|
|
+ m["userId"] = sess.Get("mgoUserId")
|
|
|
+ ok = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ m["userId"] = strconv.FormatInt(i.PositionId, 10)
|
|
|
+ m["entAccountId"] = i.EntAccountId
|
|
|
+ ok = true
|
|
|
+ }
|
|
|
+ sess.SetMultiple(m)
|
|
|
+ return ok
|
|
|
}
|