智慧食堂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.7 KiB

  1. package hdl
  2. import (
  3. "applet/app/customer/svc"
  4. "applet/app/db"
  5. "applet/app/e"
  6. "applet/app/enum"
  7. "github.com/gin-gonic/gin"
  8. )
  9. func UserInfo(c *gin.Context) {
  10. //1、获取用户信息
  11. userInfo := svc.GetUser(c)
  12. //2、获取用户身份信息
  13. userIdentityDb := db.UserIdentityDb{}
  14. userIdentityDb.Set(userInfo.Id)
  15. identity, err := userIdentityDb.FindUserIdentity()
  16. if err != nil {
  17. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  18. return
  19. }
  20. var identityList []map[string]interface{}
  21. for _, v := range *identity {
  22. identityList = append(identityList, map[string]interface{}{
  23. "identity": v.UserIdentity,
  24. "enterprise": v.Enterprise,
  25. })
  26. }
  27. e.OutSuc(c, map[string]interface{}{
  28. "user_info": userInfo,
  29. "user_identity": identityList,
  30. "user_identity_kind_list": []map[string]interface{}{
  31. {
  32. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForStudent),
  33. "value": enum.UserIdentityForCentralKitchenForStudent,
  34. },
  35. {
  36. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForTeacher),
  37. "value": enum.UserIdentityForCentralKitchenForTeacher,
  38. },
  39. {
  40. "name": enum.UserIdentity.String(enum.UserIdentityForCentralKitchenForWorker),
  41. "value": enum.UserIdentityForCentralKitchenForWorker,
  42. },
  43. {
  44. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForStudent),
  45. "value": enum.UserIdentityForSelfSupportForStudent,
  46. },
  47. {
  48. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForTeacher),
  49. "value": enum.UserIdentityForSelfSupportForTeacher,
  50. },
  51. {
  52. "name": enum.UserIdentity.String(enum.UserIdentityForSelfSupportForWorker),
  53. "value": enum.UserIdentityForSelfSupportForWorker,
  54. },
  55. },
  56. }, nil)
  57. return
  58. }