广告平台(站长下代理使用)
Você não pode selecionar mais de 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.

2 meses atrás
1 mês atrás
2 meses atrás
1 mês atrás
2 meses atrás
2 meses atrás
2 meses atrás
1 mês atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. db "code.fnuoos.com/zhimeng/model.git/src"
  9. "code.fnuoos.com/zhimeng/model.git/src/super/implement"
  10. "github.com/gin-gonic/gin"
  11. )
  12. // Base
  13. // @Summary 右上角基本数据
  14. // @Tags 首页------嘉俊
  15. // @Description 首页-右上角基本数据
  16. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  17. // @Accept json
  18. // @Produce json
  19. // @Success 200 {string} "具体看返回内容 这是data里面的数据"
  20. // @Failure 400 {object} md.Response "具体错误"
  21. // @Router /api/index/base [GET]
  22. func Base(c *gin.Context) {
  23. user := svc.GetUser(c)
  24. NewAgentListDb := implement.NewAgentListDb(db.Db)
  25. data, _ := NewAgentListDb.GetAgentList(user.AgentId)
  26. settleType := []string{"", "日结", "周结", "月结", "预付"}
  27. name := user.Username
  28. if data.CompanyName != "" {
  29. name = data.CompanyName
  30. }
  31. if data.CompanyAbbreviation != "" {
  32. name = data.CompanyAbbreviation
  33. }
  34. state := "0"
  35. if data.State == 2 {
  36. state = "1"
  37. }
  38. res := map[string]string{
  39. "account_id": utils.IntToStr(user.AgentId),
  40. "name": name,
  41. "state": state,
  42. "account": user.Username,
  43. "settle_type": utils.IntToStr(data.SettlementType),
  44. "settle_type_str": settleType[data.SettlementType],
  45. }
  46. e.OutSuc(c, res, nil)
  47. return
  48. }
  49. // IndexTotal
  50. // @Summary 统计数据
  51. // @Tags 首页------嘉俊
  52. // @Description 首页-统计数据
  53. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  54. // @Accept json
  55. // @Produce json
  56. // @Success 200 {string} "具体看返回内容 这是data里面的数据"
  57. // @Failure 400 {object} md.Response "具体错误"
  58. // @Router /api/index/total [GET]
  59. func IndexTotal(c *gin.Context) {
  60. svc.IndexTotal(c)
  61. }
  62. // IndexAppList
  63. // @Summary 应用列表
  64. // @Tags 首页------嘉俊
  65. // @Description 首页-应用列表
  66. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  67. // @Accept json
  68. // @Produce json
  69. // @Param args body md.IndexAppListReq true "请求参数"
  70. // @Success 200 {object} md.IndexAppListRes "具体看返回内容 这是data里面的数据"
  71. // @Failure 400 {object} md.Response "具体错误"
  72. // @Router /api/index/app/list [POST]
  73. func IndexAppList(c *gin.Context) {
  74. var req md.IndexAppListReq
  75. err := c.ShouldBindJSON(&req)
  76. if err != nil {
  77. err = validate.HandleValidateErr(err)
  78. err1 := err.(e.E)
  79. e.OutErr(c, err1.Code, err1.Error())
  80. return
  81. }
  82. res := svc.IndexAppList(c, req)
  83. e.OutSuc(c, res, nil)
  84. return
  85. }
  86. // IndexAppListTable
  87. // @Summary 应用数据-每个应用的折线图
  88. // @Tags 首页------嘉俊
  89. // @Description 首页-应用数据-每个应用的折线图
  90. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  91. // @Accept json
  92. // @Produce json
  93. // @Param args body md.IndexAppListTableReq true "请求参数"
  94. // @Success 200 {string} "具体看返回内容 "
  95. // @Failure 400 {object} md.Response "具体错误"
  96. // @Router /api/index/app/list/table [POST]
  97. func IndexAppListTable(c *gin.Context) {
  98. var req md.IndexAppListTableReq
  99. err := c.ShouldBindJSON(&req)
  100. if err != nil {
  101. err = validate.HandleValidateErr(err)
  102. err1 := err.(e.E)
  103. e.OutErr(c, err1.Code, err1.Error())
  104. return
  105. }
  106. res := svc.BeforeSevenPoint(c, req)
  107. e.OutSuc(c, res, nil)
  108. return
  109. }