commit
a75c48cdb4
2
go.mod
2
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
|
||||
|
|
|
@ -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 ",
|
||||
}
|
||||
|
|
|
@ -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...)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user