Files
qitongxue-api/internal/model/entity/entity_notes.go
2026-09-29 10:57:01 +08:00

32 lines
1.9 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 entity
import "github.com/gogf/gf/v2/os/gtime"
// Notes 笔记主体(含定时提醒与订阅授权计数)。
//
// 额度语义(见 PRD-02 §4.1.1):
// - 免费用户活跃笔记数(DeletedAt IS NULL)上限 50,会员不限量;
// - 新建计入、编辑不计入、删除(软删除)立即释放额度;
// - 会员判定走 logic.EffectiveLevelKey,会员过期即回落免费额度。
//
// 提醒语义(见 PRD-02 §4.1.2、架构 §4.2):
// - RemindStatus 取值见 consts(0 未设置 / 1 待提醒 / 2 已提醒 / 3 发送失败 / 4 已过期);
// - SubscribeCount 记录「已获授权的可发送次数」,前端 requestSubscribeMessage 成功后累加,
// 发送前条件扣减,不足即降级为站内提醒。
type Notes struct {
Id int64 `json:"id"`
UserId int64 `json:"user_id"` // 归属用户
Title string `json:"title"` // 标题
Content string `json:"content"` // 正文(长文本,可为空)
Tags string `json:"tags"` // 标签,逗号分隔(便于 LIKE/FIND_IN_SET 筛选)
IsPinned int `json:"is_pinned"` // 置顶:1 是 / 0 否
RemindAt *gtime.Time `json:"remind_at"` // 提醒时间,NULL=未设置
RemindStatus int `json:"remind_status"` // 0 未设置 / 1 待提醒 / 2 已提醒 / 3 发送失败 / 4 已过期
RemindSentAt *gtime.Time `json:"remind_sent_at"` // 实际发送时间
RemindAttempts int `json:"remind_attempts"` // 发送尝试次数(失败重试上限用)
SubscribeCount int `json:"subscribe_count"` // 已获授权的可发送次数
DeletedAt *gtime.Time `json:"deleted_at"` // 软删除时间,NULL=未删除(不占额度)
CreatedAt *gtime.Time `json:"created_at"`
UpdatedAt *gtime.Time `json:"updated_at"`
}