广告平台(站长下代理使用)
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.
 
 
 
 
 
 

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