67b97e4b38
看板(Recharts): - 概览页加 DAU/WAU/MAU、今日/本月新增 KPI,新增趋势/活跃趋势/月活/留存曲线 - GET /admin/analytics 内存计算,活跃口径=当天有记录/发帖/评论,排除 bot 内容安全(微信官方 UGC): - 文本 msg_sec_check 同步判、图片 media_check_async 异步查 - 帖子/评论加 pending/rejected 审核态,feed 只放 published - 图片结果回调 /api/wx/sec-callback,JSON/XML + 明文模式,签名校验 - 检测不了/未发布时一律转待审核,走后台手动审核 - 后台帖子/评论审核页:修好看不到图(补 attachPostImages)、 加状态筛选 + 通过/打回;新增评论审核状态接口 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
35 lines
1.6 KiB
Go
35 lines
1.6 KiB
Go
package model
|
|
|
|
import "gorm.io/datatypes"
|
|
|
|
// 帖子状态
|
|
const (
|
|
PostPending = "pending" // 待审核:内容安全未通过/待人工,前端 feed 不展示
|
|
PostPublished = "published" // 已过审,正常展示
|
|
PostRejected = "rejected" // 内容安全判定风险,打回
|
|
PostHidden = "hidden"
|
|
PostDeleted = "deleted"
|
|
)
|
|
|
|
// Post 社区帖子
|
|
type Post struct {
|
|
Base
|
|
UserID string `gorm:"size:24;index" json:"user_id"`
|
|
PetID *string `gorm:"size:24" json:"pet_id"`
|
|
AuthorName string `gorm:"size:64" json:"author_name"`
|
|
AuthorEmoji string `gorm:"size:16" json:"author_emoji"`
|
|
Identity string `gorm:"size:16" json:"identity"` // petName / anonymous / official
|
|
Content string `gorm:"type:text" json:"content"`
|
|
Tags datatypes.JSON `json:"tags"`
|
|
Images datatypes.JSON `json:"images"` // 展示用:URL 数组(真实图)或 emoji 数组(机器人)
|
|
ImageFileIDs datatypes.JSON `json:"image_file_ids"` // 关联 files 表的 id 数组,读取时解析为 Images
|
|
LikeCount int `json:"like_count"`
|
|
CommentCount int `json:"comment_count"`
|
|
Status string `gorm:"size:16;default:published;index" json:"status"`
|
|
IsAI bool `gorm:"size:24;index" json:"is_ai"` // AI 运营生成的帖子,前端打「AI」标
|
|
|
|
// 以下为计算字段,按当前登录用户填充
|
|
Followed bool `gorm:"-" json:"followed"` // 我是否已关注该作者
|
|
IsSelf bool `gorm:"-" json:"is_self"` // 是不是我自己发的
|
|
}
|