From 09e99ac3790d3ca08e2cebaa4d1cd4dd172ff2ed Mon Sep 17 00:00:00 2001 From: xing Date: Sun, 5 Feb 2023 18:29:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- .../theme/twentyseventeen/twentyseventeen.go | 18 ++++++++++-------- model/query.go | 2 -- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 56478be..12c9ce7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/fthvgb1/wp-go -go 1.18 +go 1.19 require ( github.com/dlclark/regexp2 v1.7.0 diff --git a/internal/theme/twentyseventeen/twentyseventeen.go b/internal/theme/twentyseventeen/twentyseventeen.go index fe7a5eb..430dea9 100644 --- a/internal/theme/twentyseventeen/twentyseventeen.go +++ b/internal/theme/twentyseventeen/twentyseventeen.go @@ -165,12 +165,14 @@ func (h handle) bodyClass() string { case plugins.Detail: s = fmt.Sprintf("postid-%d", h.ginH["post"].(models.Posts).Id) } - return map[int]string{ - plugins.Home: "home blog ", - plugins.Archive: "archive date page-two-column", - plugins.Category: str.Join("archive category page-two-column ", s), - plugins.Tag: str.Join("archive category page-two-column ", s), - plugins.Search: str.Join("search ", s), - plugins.Detail: str.Join("post-template-default single single-post single-format-standard ", s), - }[h.scene] + return str.Join(class[h.scene], s) +} + +var class = map[int]string{ + plugins.Home: "home blog ", + plugins.Archive: "archive date page-two-column", + plugins.Category: "archive category page-two-column", + plugins.Tag: "archive category page-two-column ", + plugins.Search: "search ", + plugins.Detail: "post-template-default single single-post single-format-standard ", } diff --git a/model/query.go b/model/query.go index 0d47169..2f0278e 100644 --- a/model/query.go +++ b/model/query.go @@ -6,7 +6,6 @@ import ( "golang.org/x/exp/constraints" "math/rand" "strings" - "time" ) func SimplePagination[T Model](ctx context.Context, where ParseWhere, fields, group string, page, pageSize int, order SqlBuilder, join SqlBuilder, having SqlBuilder, in ...[]any) (r []T, total int, err error) { @@ -59,7 +58,6 @@ func SimplePagination[T Model](ctx context.Context, where ParseWhere, fields, gr err = globalBb.Get(ctx, &n, sq, args...) } else { tpx := "select count(*) n from (select %s from %s %s %s %s %s ) %s" - rand.Seed(int64(time.Now().Nanosecond())) sq := fmt.Sprintf(tpx, group, rr.Table(), j, w, groupBy, h, fmt.Sprintf("table%d", rand.Int())) err = globalBb.Get(ctx, &n, sq, args...) }