Update Context for store
This commit is contained in:
@@ -30,7 +30,7 @@ func (h *DashboardHandler) GetOverview(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, stats)
|
||||
}
|
||||
|
||||
// GetChart 获取仪表盘的图表数据
|
||||
// GetChart
|
||||
func (h *DashboardHandler) GetChart(c *gin.Context) {
|
||||
var groupID *uint
|
||||
if groupIDStr := c.Query("groupId"); groupIDStr != "" {
|
||||
@@ -40,7 +40,7 @@ func (h *DashboardHandler) GetChart(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
chartData, err := h.queryService.QueryHistoricalChart(groupID)
|
||||
chartData, err := h.queryService.QueryHistoricalChart(c.Request.Context(), groupID)
|
||||
if err != nil {
|
||||
apiErr := errors.NewAPIError(errors.ErrDatabase, err.Error())
|
||||
c.JSON(apiErr.HTTPStatus, apiErr)
|
||||
@@ -49,10 +49,10 @@ func (h *DashboardHandler) GetChart(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, chartData)
|
||||
}
|
||||
|
||||
// GetRequestStats 处理对“期间调用概览”的请求
|
||||
// GetRequestStats
|
||||
func (h *DashboardHandler) GetRequestStats(c *gin.Context) {
|
||||
period := c.Param("period") // 从 URL 路径中获取 period
|
||||
stats, err := h.queryService.GetRequestStatsForPeriod(period)
|
||||
period := c.Param("period")
|
||||
stats, err := h.queryService.GetRequestStatsForPeriod(c.Request.Context(), period)
|
||||
if err != nil {
|
||||
apiErr := errors.NewAPIError(errors.ErrBadRequest, err.Error())
|
||||
c.JSON(apiErr.HTTPStatus, apiErr)
|
||||
|
||||
Reference in New Issue
Block a user