fix(email): convert RegisterStartTime and RegisterEndTime to time.Time for accurate query filtering
This commit is contained in:
parent
bc1e6315a8
commit
4f32d67113
@ -45,10 +45,10 @@ func (l *CreateBatchSendEmailTaskLogic) CreateBatchSendEmailTask(req *types.Crea
|
|||||||
Where("auth_type = ?", "email")
|
Where("auth_type = ?", "email")
|
||||||
|
|
||||||
if req.RegisterStartTime != 0 {
|
if req.RegisterStartTime != 0 {
|
||||||
query = query.Where("user.created_at >= ?", req.RegisterStartTime)
|
query = query.Where("user.created_at >= ?", time.UnixMilli(req.RegisterStartTime))
|
||||||
}
|
}
|
||||||
if req.RegisterEndTime != 0 {
|
if req.RegisterEndTime != 0 {
|
||||||
query = query.Where("user.created_at <= ?", req.RegisterEndTime)
|
query = query.Where("user.created_at <= ?", time.UnixMilli(req.RegisterEndTime))
|
||||||
}
|
}
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package marketing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/perfect-panel/server/internal/model/user"
|
"github.com/perfect-panel/server/internal/model/user"
|
||||||
"github.com/perfect-panel/server/internal/svc"
|
"github.com/perfect-panel/server/internal/svc"
|
||||||
@ -37,10 +38,14 @@ func (l *GetPreSendEmailCountLogic) GetPreSendEmailCount(req *types.GetPreSendEm
|
|||||||
Where("auth_type = ?", "email")
|
Where("auth_type = ?", "email")
|
||||||
|
|
||||||
if req.RegisterStartTime != 0 {
|
if req.RegisterStartTime != 0 {
|
||||||
query = query.Where("user.created_at >= ?", req.RegisterStartTime)
|
|
||||||
|
registerStartTime := time.UnixMilli(req.RegisterStartTime)
|
||||||
|
|
||||||
|
query = query.Where("user.created_at >= ?", registerStartTime)
|
||||||
}
|
}
|
||||||
if req.RegisterEndTime != 0 {
|
if req.RegisterEndTime != 0 {
|
||||||
query = query.Where("user.created_at <= ?", req.RegisterEndTime)
|
registerEndTime := time.UnixMilli(req.RegisterEndTime)
|
||||||
|
query = query.Where("user.created_at <= ?", registerEndTime)
|
||||||
}
|
}
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user