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

2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. }