From e7ea2bf3349e73a14add8357b6775f3a20b284d5 Mon Sep 17 00:00:00 2001 From: xing Date: Sun, 19 Mar 2023 20:53:27 +0800 Subject: [PATCH] fix bug --- internal/pkg/dao/posts.go | 7 ++++++- internal/theme/wp/components/widgetareadata.go | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/pkg/dao/posts.go b/internal/pkg/dao/posts.go index fc4ba23..120e7c3 100644 --- a/internal/pkg/dao/posts.go +++ b/internal/pkg/dao/posts.go @@ -177,10 +177,15 @@ func MonthPost(args ...any) (r []uint64, err error) { {"year(post_date)", year}, {"month(post_date)", month}, } - return model.Column[models.Posts, uint64](ctx, func(v models.Posts) (uint64, bool) { + r, err = model.Column[models.Posts, uint64](ctx, func(v models.Posts) (uint64, bool) { return v.Id, true }, model.Conditions( model.Fields("ID"), model.Where(where), )) + l := int64(len(r)) + if l > atomic.LoadInt64(&TotalRaw) { + atomic.StoreInt64(&TotalRaw, l) + } + return } diff --git a/internal/theme/wp/components/widgetareadata.go b/internal/theme/wp/components/widgetareadata.go index 8e162ab..30527b3 100644 --- a/internal/theme/wp/components/widgetareadata.go +++ b/internal/theme/wp/components/widgetareadata.go @@ -14,7 +14,7 @@ import ( ) var widgetFn = map[string]wp.Components[string]{ - "search": {Fn: widget.Search, CacheKey: "widgetSearch"}, + "search": {Fn: widget.Search}, "recent-posts": {Fn: widget.RecentPosts}, "recent-comments": {Fn: widget.RecentComments}, "archives": {Fn: widget.Archive},