feat: add data statistic chart

This commit is contained in:
engigu
2024-01-24 21:33:51 +08:00
parent 4ded53c2ce
commit 7440c377fb
10 changed files with 382 additions and 5 deletions
+25
View File
@@ -0,0 +1,25 @@
package v1
import (
"fmt"
"github.com/gin-gonic/gin"
"message-nest/pkg/app"
"message-nest/service/statistic_service"
"net/http"
)
// GetStatisticData 获取发送统计数据
func GetStatisticData(c *gin.Context) {
var (
appG = app.Gin{C: c}
)
msgService := statistic_service.StatisticService{}
data, err := msgService.GetStatisticData()
if err != nil {
appG.CResponse(http.StatusInternalServerError, fmt.Sprintf("获取失败!原因:%s", err), nil)
return
}
appG.CResponse(http.StatusOK, "获取成功", data)
}
+3
View File
@@ -81,6 +81,9 @@ func InitRouter(f embed.FS) *gin.Engine {
apiV1.POST("/settings/reset", v1.RestDefaultSettings)
apiV1.GET("/settings/getsetting", v1.GetUserSetting)
// statistic
apiV1.GET("/statistic", v1.GetStatisticData)
}
return app