广告平台(站长使用)
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

97 lines
3.0 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. "github.com/gin-gonic/gin"
  9. )
  10. // Base
  11. // @Summary 右上角基本数据
  12. // @Tags 首页------嘉俊
  13. // @Description 首页-右上角基本数据
  14. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  15. // @Accept json
  16. // @Produce json
  17. // @Success 200 {string} "具体看返回内容 这是data里面的数据"
  18. // @Failure 400 {object} md.Response "具体错误"
  19. // @Router /api/index/base [GET]
  20. func Base(c *gin.Context) {
  21. user := svc.GetUser(c)
  22. name := user.Username
  23. res := map[string]string{
  24. "account_id": utils.IntToStr(user.AdmId),
  25. "name": name,
  26. "account": user.Username,
  27. }
  28. e.OutSuc(c, res, nil)
  29. return
  30. }
  31. // IndexTotal
  32. // @Summary 统计数据
  33. // @Tags 首页------嘉俊
  34. // @Description 首页-统计数据
  35. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  36. // @Accept json
  37. // @Produce json
  38. // @Success 200 {string} "具体看返回内容 这是data里面的数据"
  39. // @Failure 400 {object} md.Response "具体错误"
  40. // @Router /api/index/total [GET]
  41. func IndexTotal(c *gin.Context) {
  42. svc.IndexTotal(c)
  43. }
  44. // IndexAppList
  45. // @Summary 应用数据
  46. // @Tags 首页------嘉俊
  47. // @Description 首页-应用数据
  48. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  49. // @Accept json
  50. // @Produce json
  51. // @Param args body md.IndexAppListReq true "请求参数"
  52. // @Success 200 {object} md.IndexAppListRes "具体看返回内容 这是data里面的数据"
  53. // @Failure 400 {object} md.Response "具体错误"
  54. // @Router /api/index/app/list [POST]
  55. func IndexAppList(c *gin.Context) {
  56. var req md.IndexAppListReq
  57. err := c.ShouldBindJSON(&req)
  58. if err != nil {
  59. err = validate.HandleValidateErr(err)
  60. err1 := err.(e.E)
  61. e.OutErr(c, err1.Code, err1.Error())
  62. return
  63. }
  64. res := svc.IndexAppList(c, req)
  65. e.OutSuc(c, res, nil)
  66. return
  67. }
  68. // IndexAppListTable
  69. // @Summary 应用数据-每个应用的折线图
  70. // @Tags 首页------嘉俊
  71. // @Description 首页-应用数据-每个应用的折线图
  72. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  73. // @Accept json
  74. // @Produce json
  75. // @Param args body md.IndexAppListTableReq true "请求参数"
  76. // @Success 200 {string} "具体看返回内容 "
  77. // @Failure 400 {object} md.Response "具体错误"
  78. // @Router /api/index/app/list/table [POST]
  79. func IndexAppListTable(c *gin.Context) {
  80. var req md.IndexAppListTableReq
  81. err := c.ShouldBindJSON(&req)
  82. if err != nil {
  83. err = validate.HandleValidateErr(err)
  84. err1 := err.(e.E)
  85. e.OutErr(c, err1.Code, err1.Error())
  86. return
  87. }
  88. res := svc.BeforeSevenPoint(c, req)
  89. e.OutSuc(c, res, nil)
  90. return
  91. }