- Post ScheduledAt 字段 - Scheduler goroutine 每分钟扫描到期文章 - Create/Update 校验最短 30min 定时 - Approve 审核晚于定时则即时发布 - public 列表+空间页过滤未到期文章 - 写文章页 datetime-local 选择器(min=now+30min) - AutoMigrate 追加新表
77 lines
2.5 KiB
Go
77 lines
2.5 KiB
Go
package model
|
|
|
|
// RegisterRequest 注册请求
|
|
type RegisterRequest struct {
|
|
Email string `json:"email" binding:"required,email"`
|
|
Password string `json:"password" binding:"required,min=8"`
|
|
ConfirmPassword string `json:"confirm_password" binding:"required,eqfield=Password"`
|
|
RememberMe bool `json:"remember_me"`
|
|
}
|
|
|
|
// LoginRequest 登录请求
|
|
type LoginRequest struct {
|
|
Email string `json:"email" binding:"required,email"`
|
|
Password string `json:"password" binding:"required"`
|
|
RememberMe bool `json:"remember_me"`
|
|
}
|
|
|
|
// CheckEmailRequest 检查邮箱是否已注册
|
|
type CheckEmailRequest struct {
|
|
Email string `json:"email" binding:"required,email"`
|
|
}
|
|
|
|
// ---- Post DTOs ----
|
|
|
|
// PostListResult 帖子列表查询结果
|
|
type PostListResult struct {
|
|
Items []Post `json:"items"`
|
|
Total int64 `json:"total"`
|
|
Page int `json:"page"`
|
|
TotalPages int `json:"total_pages"`
|
|
}
|
|
|
|
// PostCreateRequest 发帖请求
|
|
type PostCreateRequest struct {
|
|
Title string `json:"title" binding:"required,min=1,max=200"`
|
|
Body string `json:"body" binding:"required,min=1"`
|
|
Visibility string `json:"visibility"`
|
|
PostType string `json:"post_type"`
|
|
ReprintSource string `json:"reprint_source"`
|
|
Declaration string `json:"declaration"`
|
|
ReprintProhibited bool `json:"reprint_prohibited"`
|
|
CategoryID string `json:"category_id"`
|
|
Tags string `json:"tags"`
|
|
ScheduledAt string `json:"scheduled_at"`
|
|
}
|
|
|
|
// PostUpdateRequest 编辑请求
|
|
type PostUpdateRequest struct {
|
|
Title string `json:"title" binding:"required,min=1,max=200"`
|
|
Body string `json:"body" binding:"required,min=1"`
|
|
Visibility string `json:"visibility"`
|
|
PostType string `json:"post_type"`
|
|
ReprintSource string `json:"reprint_source"`
|
|
Declaration string `json:"declaration"`
|
|
ReprintProhibited bool `json:"reprint_prohibited"`
|
|
CategoryID string `json:"category_id"`
|
|
Tags string `json:"tags"`
|
|
ScheduledAt string `json:"scheduled_at"`
|
|
}
|
|
|
|
// PostRejectRequest 退回请求
|
|
type PostRejectRequest struct {
|
|
Reason string `json:"reason" binding:"required,min=1,max=500"`
|
|
}
|
|
|
|
// PostLockRequest 锁定请求
|
|
type PostLockRequest struct {
|
|
Reason string `json:"reason" binding:"required,min=1,max=500"`
|
|
}
|
|
|
|
// PostListQuery 列表查询参数
|
|
type PostListQuery struct {
|
|
Keyword string `form:"keyword"`
|
|
Status string `form:"status"`
|
|
Page int `form:"page"`
|
|
PageSize int `form:"page_size"`
|
|
} |