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

hdl_index.go 2.5 KiB

2 viikkoa sitten
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. res := map[string]string{
  28. "account_id": utils.IntToStr(user.MediumId),
  29. "name": user.Username,
  30. "account": user.Username,
  31. "settle_type": utils.IntToStr(data.SettlementType),
  32. "settle_type_str": settleType[data.SettlementType],
  33. }
  34. e.OutSuc(c, res, nil)
  35. return
  36. }
  37. // IndexTotal
  38. // @Summary 统计数据
  39. // @Tags 首页------嘉俊
  40. // @Description 首页-统计数据
  41. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  42. // @Accept json
  43. // @Produce json
  44. // @Success 200 {string} "具体看返回内容 这是data里面的数据"
  45. // @Failure 400 {object} md.Response "具体错误"
  46. // @Router /api/index/total [GET]
  47. func IndexTotal(c *gin.Context) {
  48. svc.IndexTotal(c)
  49. }
  50. // IndexAppList
  51. // @Summary 数据明细
  52. // @Tags 数据中心------嘉俊
  53. // @Description 数据中心-数据明细
  54. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  55. // @Accept json
  56. // @Produce json
  57. // @Param args body md.IndexAppListReq true "请求参数"
  58. // @Success 200 {object} md.IndexAppListRes "具体看返回内容 这是data里面的数据"
  59. // @Failure 400 {object} md.Response "具体错误"
  60. // @Router /api/index/app/list [POST]
  61. func IndexAppList(c *gin.Context) {
  62. var req md.IndexAppListReq
  63. err := c.ShouldBindJSON(&req)
  64. if err != nil {
  65. err = validate.HandleValidateErr(err)
  66. err1 := err.(e.E)
  67. e.OutErr(c, err1.Code, err1.Error())
  68. return
  69. }
  70. res := svc.IndexAppList(c, req)
  71. e.OutSuc(c, res, nil)
  72. return
  73. }