From 06d52fbd1453632cb093464701dc20412725c989 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Fri, 5 Nov 2021 11:50:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE=E6=8C=87?= =?UTF-8?q?=E6=A0=87=E5=A2=9E=E9=87=8F=E6=95=B0=E6=8D=AE=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=B8=8D=E5=AF=B9=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/repo_statistic.go | 4 ++-- routers/repo/repo_statistic.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/models/repo_statistic.go b/models/repo_statistic.go index adef672e0..825ef48a8 100755 --- a/models/repo_statistic.go +++ b/models/repo_statistic.go @@ -81,9 +81,9 @@ func DeleteRepoStatDaily(date string) error { return nil } -func GetRepoStatisticByDate(date string) ([]*RepoStatistic, error) { +func GetRepoStatisticByDate(date string, repoId int64) ([]*RepoStatistic, error) { repoStatistics := make([]*RepoStatistic, 0) - err := xStatistic.Where("date = ?", date).Find(&repoStatistics) + err := xStatistic.Where("date = ? and repo_id=?", date, repoId).Find(&repoStatistics) return repoStatistics, err } diff --git a/routers/repo/repo_statistic.go b/routers/repo/repo_statistic.go index 2de22a1ee..6dbdc1ca2 100755 --- a/routers/repo/repo_statistic.go +++ b/routers/repo/repo_statistic.go @@ -115,7 +115,7 @@ func RepoStatisticDaily(date string) { } dayBeforeDate := t.AddDate(0, 0, -1).Format("2006-01-02") - repoStatisticsBefore, err := models.GetRepoStatisticByDate(dayBeforeDate) + repoStatisticsBefore, err := models.GetRepoStatisticByDate(dayBeforeDate, repo.ID) if err != nil { log.Error("get data of day before the date failed ", err)