广告平台(媒体使用)
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.
 
 
 
 
 
 

90 linhas
2.7 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. 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. NewMediumListDb := implement.NewMediumListDb(db.Db)
  25. data, _ := NewMediumListDb.GetMediumList(user.MediumId)
  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.MediumId),
  40. "name": name,
  41. "account": user.Username,
  42. "state": state,
  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. }