查询使用 utc 时间
This commit is contained in:
@@ -2,7 +2,6 @@ package handlers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"platform/pkg/u"
|
||||
"platform/web/auth"
|
||||
"platform/web/core"
|
||||
g "platform/web/globals"
|
||||
@@ -276,34 +275,28 @@ func couponUserPageConditions(req CouponUserPageFilter) []gen.Condition {
|
||||
}
|
||||
if req.Expired != nil {
|
||||
if *req.Expired {
|
||||
conds = append(conds, q.CouponUser.ExpireAt.IsNotNull(), q.CouponUser.ExpireAt.Lte(time.Now()))
|
||||
conds = append(conds, q.CouponUser.ExpireAt.IsNotNull(), q.CouponUser.ExpireAt.Lte(time.Now().UTC()))
|
||||
} else {
|
||||
conds = append(conds, q.CouponUser.Where(q.CouponUser.ExpireAt.IsNull()).Or(q.CouponUser.ExpireAt.Gt(time.Now())))
|
||||
conds = append(conds, q.CouponUser.Where(q.CouponUser.ExpireAt.IsNull()).Or(q.CouponUser.ExpireAt.Gt(time.Now().UTC())))
|
||||
}
|
||||
}
|
||||
if req.CreatedAtStart != nil {
|
||||
start := u.DateHead(*req.CreatedAtStart)
|
||||
conds = append(conds, q.CouponUser.CreatedAt.Gte(start))
|
||||
conds = append(conds, q.CouponUser.CreatedAt.Gte(req.CreatedAtStart.UTC()))
|
||||
}
|
||||
if req.CreatedAtEnd != nil {
|
||||
end := u.DateTail(*req.CreatedAtEnd)
|
||||
conds = append(conds, q.CouponUser.CreatedAt.Lte(end))
|
||||
conds = append(conds, q.CouponUser.CreatedAt.Lte(req.CreatedAtEnd.UTC()))
|
||||
}
|
||||
if req.ExpireAtStart != nil {
|
||||
start := u.DateHead(*req.ExpireAtStart)
|
||||
conds = append(conds, q.CouponUser.ExpireAt.Gte(start))
|
||||
conds = append(conds, q.CouponUser.ExpireAt.Gte(req.ExpireAtStart.UTC()))
|
||||
}
|
||||
if req.ExpireAtEnd != nil {
|
||||
end := u.DateTail(*req.ExpireAtEnd)
|
||||
conds = append(conds, q.CouponUser.ExpireAt.Lte(end))
|
||||
conds = append(conds, q.CouponUser.ExpireAt.Lte(req.ExpireAtEnd.UTC()))
|
||||
}
|
||||
if req.UsedAtStart != nil {
|
||||
start := u.DateHead(*req.UsedAtStart)
|
||||
conds = append(conds, q.CouponUser.UsedAt.Gte(start))
|
||||
conds = append(conds, q.CouponUser.UsedAt.Gte(req.UsedAtStart.UTC()))
|
||||
}
|
||||
if req.UsedAtEnd != nil {
|
||||
end := u.DateTail(*req.UsedAtEnd)
|
||||
conds = append(conds, q.CouponUser.UsedAt.Lte(end))
|
||||
conds = append(conds, q.CouponUser.UsedAt.Lte(req.UsedAtEnd.UTC()))
|
||||
}
|
||||
return conds
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user