userInfo.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package public
  2. import (
  3. "app.yhyue.com/moapp/jybase/common"
  4. "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
  5. )
  6. // SessUserInfo 从session获取用户基本信息
  7. type SessUserInfo struct {
  8. BaseUserId int64
  9. AccountId int64
  10. EntId int64
  11. PositionType int64
  12. PositionId int64
  13. EntUserId int64
  14. Phone string
  15. MgoUserId string
  16. UserId string
  17. }
  18. // GetUserBaseInfo 获取用户基本信息从session
  19. func GetUserBaseInfo(sess *httpsession.Session) SessUserInfo {
  20. getSession := sess.GetMultiple()
  21. return SessUserInfo{
  22. MgoUserId: common.ObjToString(getSession["mgoUserId"]),
  23. BaseUserId: common.Int64All(getSession["base_user_id"]),
  24. AccountId: common.Int64All(getSession["accountId"]),
  25. EntId: common.Int64All(getSession["entId"]),
  26. PositionType: common.Int64All(getSession["positionType"]),
  27. PositionId: common.Int64All(getSession["positionId"]),
  28. Phone: common.ObjToString(getSession["phone"]),
  29. UserId: common.ObjToString(getSession["userId"]),
  30. EntUserId: common.Int64All(getSession["entUserId"]),
  31. }
  32. }