From 2aa693918691ecf967b810ab8f6ed80505cc8177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Sun, 18 Sep 2022 10:26:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(stat):=E4=BF=AE=E6=AD=A3=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=9A=84=E5=85=B3=E8=81=94=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/park.go | 4 ++-- service/statistics.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/model/park.go b/model/park.go index 6b464d0..d6a3916 100644 --- a/model/park.go +++ b/model/park.go @@ -61,8 +61,8 @@ type ParkSimplified struct { } type ParkPeriodStatistics struct { - Id string `bun:",notnull" json:"id"` - Name string `bun:",notnull" json:"name"` + Id string `bun:"park__id,notnull" json:"id"` + Name string `bun:"park__name,notnull" json:"name"` Period *time.Time `bun:"type:date" json:"period" time_format:"simple_date" time_location:"shanghai"` } diff --git a/service/statistics.go b/service/statistics.go index e779de0..739e017 100644 --- a/service/statistics.go +++ b/service/statistics.go @@ -66,10 +66,10 @@ func (_StatisticsService) ParksNewestState(userIds ...string) ([]model.ParkPerio Relation("Park", func(q *bun.SelectQuery) *bun.SelectQuery { return q.Column("id", "name") }). - Where("p.enabled = ?", true). - Where("r.publidhed = ?", true) + Where("park.enabled = ?", true). + Where("r.published = ?", true) if len(userIds) > 0 { - query = query.Where("p.user_id in (?)", bun.In(userIds)) + query = query.Where("park.user_id in (?)", bun.In(userIds)) } parks := make([]model.ParkPeriodStatistics, 0) groupedParks := make(map[string]model.ParkPeriodStatistics, 0)