Files
qitongxue-api/api/user/v1/note.go
2026-09-29 10:57:01 +08:00

86 lines
3.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package v1
import "github.com/gogf/gf/v2/frame/g"
// NoteOut 笔记列表项
type NoteOut struct {
Id int64 `json:"id"`
Title string `json:"title"`
Summary string `json:"summary"` // 正文摘要(列表不返回全文)
Tags []string `json:"tags"`
IsPinned bool `json:"is_pinned"`
RemindAt string `json:"remind_at"` // 空串=未设置
RemindStatus int `json:"remind_status"` // 0..4
UpdatedAt string `json:"updated_at"`
}
type NoteListReq struct {
g.Meta `path:"/note/list" method:"get" tags:"note" summary:"笔记列表"`
Keyword string `json:"keyword"`
Tag string `json:"tag"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
type NoteListRes struct {
List []NoteOut `json:"list"`
Total int `json:"total"`
ActiveCount int `json:"active_count"` // 活跃笔记数(不含回收站)
Limit int `json:"limit"` // 免费上限 50;会员为 0(表示不限)
IsMember bool `json:"is_member"`
}
type NoteDetailReq struct {
g.Meta `path:"/note/detail" method:"get" tags:"note" summary:"笔记详情"`
Id int64 `v:"required|min:1#笔记不存在" json:"id"`
}
type NoteDetailRes struct {
Id int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Tags []string `json:"tags"`
IsPinned bool `json:"is_pinned"`
RemindAt string `json:"remind_at"`
RemindStatus int `json:"remind_status"`
}
// NoteSaveReq id=0 表示新建;新建计入额度、编辑不计入
type NoteSaveReq struct {
g.Meta `path:"/note/save" method:"post" tags:"note" summary:"新建/编辑笔记"`
Id int64 `json:"id"`
Title string `v:"required|length:1,128#标题不能为空|标题最长 128 字" json:"title"`
Content string `v:"length:0,20000#正文过长" json:"content"`
Tags []string `json:"tags"`
IsPinned bool `json:"is_pinned"`
RemindAt string `v:"datetime#提醒时间格式不正确" json:"remind_at"` // 空串=取消提醒
}
type NoteSaveRes struct {
Id int64 `json:"id"`
ActiveCount int `json:"active_count"`
}
type NoteDeleteReq struct {
g.Meta `path:"/note/delete" method:"post" tags:"note" summary:"删除笔记(软删,释放额度)"`
Id int64 `v:"required" json:"id"`
}
type NoteDeleteRes struct{}
type NoteRestoreReq struct {
g.Meta `path:"/note/restore" method:"post" tags:"note" summary:"恢复笔记(P2)"`
Id int64 `v:"required" json:"id"`
}
type NoteRestoreRes = NoteSaveRes
type NoteRemindCancelReq struct {
g.Meta `path:"/note/remind-cancel" method:"post" tags:"note" summary:"取消提醒"`
Id int64 `v:"required" json:"id"`
}
type NoteRemindCancelRes struct{}
// NoteSubscribeReportReq 前端 requestSubscribeMessage 授权成功后回传(一次授权=一次可发送)
type NoteSubscribeReportReq struct {
g.Meta `path:"/note/subscribe-report" method:"post" tags:"note" summary:"上报订阅授权次数"`
NoteId int64 `v:"required" json:"note_id"`
Count int `v:"min:1#授权次数异常" json:"count"`
}
type NoteSubscribeReportRes struct{}