feat: add data statistic chart
This commit is contained in:
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user