This commit is contained in:
xing 2023-03-19 20:53:27 +08:00
parent d48a156983
commit e7ea2bf334
2 changed files with 7 additions and 2 deletions

View File

@ -177,10 +177,15 @@ func MonthPost(args ...any) (r []uint64, err error) {
{"year(post_date)", year}, {"year(post_date)", year},
{"month(post_date)", month}, {"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 return v.Id, true
}, model.Conditions( }, model.Conditions(
model.Fields("ID"), model.Fields("ID"),
model.Where(where), model.Where(where),
)) ))
l := int64(len(r))
if l > atomic.LoadInt64(&TotalRaw) {
atomic.StoreInt64(&TotalRaw, l)
}
return
} }

View File

@ -14,7 +14,7 @@ import (
) )
var widgetFn = map[string]wp.Components[string]{ var widgetFn = map[string]wp.Components[string]{
"search": {Fn: widget.Search, CacheKey: "widgetSearch"}, "search": {Fn: widget.Search},
"recent-posts": {Fn: widget.RecentPosts}, "recent-posts": {Fn: widget.RecentPosts},
"recent-comments": {Fn: widget.RecentComments}, "recent-comments": {Fn: widget.RecentComments},
"archives": {Fn: widget.Archive}, "archives": {Fn: widget.Archive},