修复提取并发问题 & 修复接口时区问题

This commit is contained in:
2026-05-18 13:54:01 +08:00
parent 8f89503c88
commit 71554da541
16 changed files with 386 additions and 239 deletions

View File

@@ -2,12 +2,14 @@ package handlers
import (
"errors"
"platform/pkg/u"
"platform/web/auth"
"platform/web/core"
g "platform/web/globals"
m "platform/web/models"
q "platform/web/queries"
s "platform/web/services"
"time"
"github.com/gofiber/fiber/v2"
"github.com/shopspring/decimal"
@@ -65,9 +67,17 @@ func PageUserByAdmin(c *fiber.Ctx) error {
do = do.Where(q.User.AdminID.IsNull())
}
}
if req.CreatedAtStart != nil {
start := u.DateHead(*req.CreatedAtStart)
do = do.Where(q.User.CreatedAt.Gte(start))
}
if req.CreatedAtEnd != nil {
end := u.DateTail(*req.CreatedAtEnd)
do = do.Where(q.User.CreatedAt.Lte(end))
}
// 查询用户列表
users, total, err := q.User.
users, total, err := q.User.Debug().
Preload(q.User.Admin, q.User.Discount).
Omit(q.User.Password, q.Admin.Password).
Where(do).
@@ -102,11 +112,13 @@ func PageUserByAdmin(c *fiber.Ctx) error {
type PageUserByAdminReq struct {
core.PageReq
Account *string `json:"account,omitempty"`
Name *string `json:"name,omitempty"`
Identified *bool `json:"identified,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Assigned *bool `json:"assigned,omitempty"`
Account *string `json:"account,omitempty"`
Name *string `json:"name,omitempty"`
Identified *bool `json:"identified,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Assigned *bool `json:"assigned,omitempty"`
CreatedAtStart *time.Time `json:"created_at_start,omitempty"`
CreatedAtEnd *time.Time `json:"created_at_end,omitempty"`
}
// 管理员获取单个用户