广告平台(站长使用)
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

114 linhas
3.5 KiB

  1. package hdl
  2. import (
  3. "applet/app/e"
  4. "applet/app/lib/validate"
  5. "applet/app/md"
  6. "applet/app/svc"
  7. "applet/app/utils"
  8. "code.fnuoos.com/zhimeng/model.git/src/implement"
  9. "github.com/gin-gonic/gin"
  10. )
  11. // Base
  12. // @Summary 右上角基本数据
  13. // @Tags 首页------嘉俊
  14. // @Description 首页-右上角基本数据
  15. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  16. // @Accept json
  17. // @Produce json
  18. // @Success 200 {string} "具体看返回内容 这是data里面的数据"
  19. // @Failure 400 {object} md.Response "具体错误"
  20. // @Router /api/index/base [GET]
  21. func Base(c *gin.Context) {
  22. user := svc.GetUser(c)
  23. name := user.Username
  24. res := map[string]string{
  25. "account_id": utils.IntToStr(user.AdmId),
  26. "name": name,
  27. "account": user.Username,
  28. "logo": "",
  29. "label": "",
  30. "seo_logo": "",
  31. "seo_title": "",
  32. }
  33. NewAdminRoleDb := implement.NewAdminRoleDb(svc.MasterDb(c))
  34. role, _ := NewAdminRoleDb.GetAdminRoleByAdminId(user.AdmId)
  35. if role != nil {
  36. NewRoleDb := implement.NewRoleDb(svc.MasterDb(c), role.RoleId)
  37. getRole, _ := NewRoleDb.GetRole()
  38. if getRole != nil {
  39. res["logo"] = getRole.Logo
  40. res["label"] = getRole.Label
  41. res["seo_logo"] = getRole.SeoLogo
  42. res["seo_title"] = getRole.SeoTitle
  43. }
  44. }
  45. e.OutSuc(c, res, nil)
  46. return
  47. }
  48. // IndexTotal
  49. // @Summary 统计数据
  50. // @Tags 首页------嘉俊
  51. // @Description 首页-统计数据
  52. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  53. // @Accept json
  54. // @Produce json
  55. // @Success 200 {string} "具体看返回内容 这是data里面的数据"
  56. // @Failure 400 {object} md.Response "具体错误"
  57. // @Router /api/index/total [GET]
  58. func IndexTotal(c *gin.Context) {
  59. svc.IndexTotal(c)
  60. }
  61. // IndexAppList
  62. // @Summary 应用数据
  63. // @Tags 首页------嘉俊
  64. // @Description 首页-应用数据
  65. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  66. // @Accept json
  67. // @Produce json
  68. // @Param args body md.IndexAppListReq true "请求参数"
  69. // @Success 200 {object} md.IndexAppListRes "具体看返回内容 这是data里面的数据"
  70. // @Failure 400 {object} md.Response "具体错误"
  71. // @Router /api/index/app/list [POST]
  72. func IndexAppList(c *gin.Context) {
  73. var req md.IndexAppListReq
  74. err := c.ShouldBindJSON(&req)
  75. if err != nil {
  76. err = validate.HandleValidateErr(err)
  77. err1 := err.(e.E)
  78. e.OutErr(c, err1.Code, err1.Error())
  79. return
  80. }
  81. res := svc.IndexAppList(c, req)
  82. e.OutSuc(c, res, nil)
  83. return
  84. }
  85. // IndexAppListTable
  86. // @Summary 应用数据-每个应用的折线图
  87. // @Tags 首页------嘉俊
  88. // @Description 首页-应用数据-每个应用的折线图
  89. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  90. // @Accept json
  91. // @Produce json
  92. // @Param args body md.IndexAppListTableReq true "请求参数"
  93. // @Success 200 {string} "具体看返回内容 "
  94. // @Failure 400 {object} md.Response "具体错误"
  95. // @Router /api/index/app/list/table [POST]
  96. func IndexAppListTable(c *gin.Context) {
  97. var req md.IndexAppListTableReq
  98. err := c.ShouldBindJSON(&req)
  99. if err != nil {
  100. err = validate.HandleValidateErr(err)
  101. err1 := err.(e.E)
  102. e.OutErr(c, err1.Code, err1.Error())
  103. return
  104. }
  105. res := svc.BeforeSevenPoint(c, req)
  106. e.OutSuc(c, res, nil)
  107. return
  108. }