Files
ai_wht_wechat/go_backend/models/models.go

348 lines
25 KiB
Go
Raw Normal View History

2025-12-19 22:36:48 +08:00
package models
import (
"time"
)
// Enterprise 企业表
type Enterprise struct {
2026-01-06 19:36:42 +08:00
ID int `gorm:"primaryKey;column:id;autoIncrement" json:"id"`
EnterpriseID string `gorm:"column:enterprise_id;type:varchar(255);not null;default:''" json:"enterprise_id" comment:"企业ID"`
2025-12-20 01:05:46 +08:00
Name string `gorm:"type:varchar(200);not null;default:''" json:"name" comment:"企业名称"`
ShortName string `gorm:"type:varchar(100);not null;default:''" json:"short_name" comment:"企业简称"`
Icon string `gorm:"type:varchar(500);not null;default:''" json:"icon" comment:"企业图标URL"`
Phone string `gorm:"type:varchar(20);not null;default:'';uniqueIndex:uk_phone" json:"phone" comment:"登录手机号"`
Password string `gorm:"type:varchar(255);not null;default:''" json:"-" comment:"登录密码(加密存储)"`
Email string `gorm:"type:varchar(128);not null;default:''" json:"email" comment:"企业邮箱"`
Website string `gorm:"type:varchar(255);not null;default:''" json:"website" comment:"企业网站"`
Address string `gorm:"type:varchar(255);not null;default:''" json:"address" comment:"企业地址"`
Status string `gorm:"type:enum('active','disabled');not null;default:'active';index:idx_status" json:"status" comment:"状态"`
UsersTotal int `gorm:"type:int(10) unsigned;not null;default:0" json:"users_total" comment:"员工总数"`
ProductsTotal int `gorm:"type:int(10) unsigned;not null;default:0" json:"products_total" comment:"产品总数"`
PublishedTotal int `gorm:"type:int(10) unsigned;not null;default:0" json:"published_total" comment:"文章发布总数"`
ArticlesTotal int `gorm:"type:int(10) unsigned;not null;default:0" json:"articles_total" comment:"文章总数"`
ReleasedMonthTotal int `gorm:"type:int(10) unsigned;not null;default:0" json:"released_month_total" comment:"本月发布数量"`
LinkedToXHSNum int `gorm:"type:int(10) unsigned;not null;default:0" json:"linked_to_xhs_num" comment:"绑定小红书"`
CreatedAt time.Time `gorm:"index:idx_created_at" json:"created_at" comment:"创建时间"`
UpdatedAt time.Time `json:"updated_at" comment:"更新时间"`
2025-12-19 22:36:48 +08:00
}
2026-01-06 19:36:42 +08:00
// User 用户账号表(原Employee,对应ai_users)
2025-12-19 22:36:48 +08:00
type User struct {
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
EnterpriseID int `gorm:"not null;default:0;index:idx_enterprise_id" json:"enterprise_id" comment:"所属企业ID"`
2026-01-06 19:36:42 +08:00
Enterprise Enterprise `gorm:"foreignKey:EnterpriseID;references:ID" json:"enterprise,omitempty"`
2025-12-19 22:36:48 +08:00
EnterpriseName string `gorm:"type:varchar(255);not null;default:''" json:"enterprise_name" comment:"企业名称"`
Username string `gorm:"type:varchar(50);not null;default:'';uniqueIndex:uk_username" json:"username" comment:"用户名"`
Password string `gorm:"type:varchar(255);not null;default:''" json:"-" comment:"密码"`
RealName string `gorm:"type:varchar(50)" json:"real_name" comment:"真实姓名"`
2026-01-06 19:36:42 +08:00
Nickname string `gorm:"type:varchar(256);not null;default:''" json:"nickname" comment:"用户昵称"`
Icon string `gorm:"type:varchar(512);not null;default:''" json:"icon" comment:"企业图标URL"`
2025-12-19 22:36:48 +08:00
Email string `gorm:"type:varchar(100)" json:"email" comment:"邮箱"`
Phone string `gorm:"type:varchar(20)" json:"phone" comment:"手机号"`
2025-12-20 01:05:46 +08:00
WechatOpenID *string `gorm:"column:wechat_openid;type:varchar(100);uniqueIndex:uk_wechat_openid" json:"wechat_openid,omitempty" comment:"微信OpenID"`
WechatUnionID *string `gorm:"column:wechat_unionid;type:varchar(100)" json:"wechat_unionid,omitempty" comment:"微信UnionID"`
2025-12-19 22:36:48 +08:00
IsBoundXHS int `gorm:"type:tinyint(1);not null;default:0;index:idx_is_bound_xhs" json:"is_bound_xhs" comment:"是否绑定小红书0=未绑定1=已绑定"`
Department string `gorm:"type:varchar(50)" json:"department" comment:"部门"`
2025-12-20 01:05:46 +08:00
Role string `gorm:"type:enum('admin','editor','reviewer','publisher','each_title_reviewer','enterprise');default:'editor'" json:"role" comment:"角色"`
2025-12-19 22:36:48 +08:00
Status string `gorm:"type:enum('active','inactive','deleted');default:'active';index:idx_status" json:"status" comment:"状态"`
CreatedAt time.Time `json:"created_at" comment:"创建时间"`
UpdatedAt time.Time `json:"updated_at" comment:"更新时间"`
}
// Employee 员工表别名,兼容旧代码
type Employee = User
// Product 产品表
type Product struct {
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
EnterpriseID int `gorm:"not null;default:0;index:idx_enterprise_id" json:"enterprise_id" comment:"所属企业ID"`
Name string `gorm:"type:varchar(200);not null;default:''" json:"name" comment:"产品名称"`
2025-12-20 01:05:46 +08:00
TypeID int `gorm:"type:int unsigned;not null;default:0" json:"type_id" comment:"type_id类型ID"`
2025-12-19 22:36:48 +08:00
TypeName string `gorm:"type:varchar(128);not null;default:''" json:"type_name" comment:"产品类型"`
ImageURL string `gorm:"type:varchar(500);not null;default:''" json:"image_url" comment:"产品主图URL"`
ImageThumbnailURL string `gorm:"type:varchar(500);not null;default:''" json:"image_thumbnail_url" comment:"缩略图URL"`
Knowledge string `gorm:"type:text" json:"knowledge" comment:"产品知识库(纯文字)"`
ArticlesTotal int `gorm:"not null;default:0" json:"articles_total" comment:"文章总数"`
PublishedTotal int `gorm:"not null;default:0" json:"published_total" comment:"发布总数"`
Status string `gorm:"type:enum('draft','active','deleted');not null;default:'draft';index:idx_status" json:"status" comment:"状态draft=草稿active=正常deleted=已删除"`
CreatedAt time.Time `gorm:"index:idx_created_at" json:"created_at" comment:"创建时间"`
UpdatedAt time.Time `json:"updated_at" comment:"更新时间"`
}
2026-01-06 19:36:42 +08:00
// Article 文章表(原Copy,对应ai_articles)
2025-12-19 22:36:48 +08:00
type Article struct {
2026-01-06 19:36:42 +08:00
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
BatchID uint64 `gorm:"type:bigint unsigned;not null;default:0" json:"batch_id" comment:"批次ID"`
EnterpriseID int `gorm:"not null;default:0;index:idx_enterprise_id" json:"enterprise_id" comment:"所属企业ID"`
ProductID int `gorm:"not null;default:0;index:idx_product_id" json:"product_id" comment:"关联产品ID"`
ProductName string `gorm:"type:varchar(256);not null;default:''" json:"product_name" comment:"产品名称"`
TopicTypeID int `gorm:"type:int unsigned;not null;default:0" json:"topic_type_id" comment:"topic类型ID"`
PromptWorkflowID int `gorm:"type:int unsigned;not null;default:0" json:"prompt_workflow_id" comment:"提示词工作流ID"`
PromptWorkflowName string `gorm:"type:varchar(100);not null;default:''" json:"prompt_workflow_name" comment:"提示词工作流名称"`
Topic string `gorm:"type:varchar(255);not null;default:''" json:"topic" comment:"topic主题"`
Title string `gorm:"type:varchar(200);not null;default:''" json:"title" comment:"标题"`
ContextSummary string `gorm:"type:varchar(1024);not null;default:''" json:"context_summary" comment:"上下文摘要"`
Content string `gorm:"type:text" json:"content" comment:"文章内容"`
Department string `gorm:"type:varchar(255);not null;default:''" json:"department" comment:"部门"`
DepartmentIDs string `gorm:"column:departmentids;type:varchar(255);not null;default:''" json:"department_ids" comment:"部门IDs"`
AuthorID *int `json:"author_id" comment:"作者ID"`
AuthorName string `gorm:"type:varchar(100)" json:"author_name" comment:"作者名称"`
DepartmentID *int `json:"department_id" comment:"部门ID"`
DepartmentName string `gorm:"type:varchar(255)" json:"department_name" comment:"部门名称"`
CreatedUserID int `gorm:"not null;default:0" json:"created_user_id" comment:"创建用户ID"`
ReviewUserID *int `json:"review_user_id" comment:"审核用户ID"`
PublishUserID *int `json:"publish_user_id" comment:"发布用户ID"`
Status string `gorm:"type:enum('topic','cover_image','generate','generate_failed','draft','pending_review','assign_authors','approved','rejected','published_review','published','failed');default:'draft';index:idx_status" json:"status" comment:"状态"`
Channel int `gorm:"type:tinyint(1);not null;default:1" json:"channel" comment:"渠道1=小红书|2=douyin|3=toutiao|4=weixin"`
ReviewComment string `gorm:"type:text" json:"review_comment" comment:"审核评论"`
PublishTime *time.Time `json:"publish_time" comment:"发布时间"`
BaijiahaoID string `gorm:"type:varchar(100)" json:"baijiahao_id" comment:"百家号ID"`
BaijiahaoStatus string `gorm:"type:varchar(50)" json:"baijiahao_status" comment:"百家号状态"`
WordCount int `gorm:"default:0" json:"word_count" comment:"字数统计"`
ImageCount int `gorm:"default:0" json:"image_count" comment:"图片数量"`
CozeTag string `gorm:"type:varchar(500)" json:"coze_tag" comment:"Coze生成的标签"`
CreatedAt time.Time `gorm:"index:idx_created_at" json:"created_at" comment:"创建时间"`
UpdatedAt time.Time `gorm:"index:idx_updated_at" json:"updated_at" comment:"更新时间"`
// 关联字段
Images []ArticleImage `gorm:"foreignKey:ArticleID" json:"images,omitempty" comment:"文章图片"`
2025-12-19 22:36:48 +08:00
}
// Copy 文案表别名,兼容旧代码
type Copy = Article
// PublishRecord 发布记录表对应ai_article_published_records
type PublishRecord struct {
2025-12-20 01:05:46 +08:00
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
ArticleID *int `gorm:"index:idx_article_id" json:"article_id" comment:"文章ID"`
EnterpriseID int `gorm:"not null;default:0;index:idx_enterprise_id" json:"enterprise_id" comment:"所属企业ID"`
ProductID int `gorm:"not null;default:0;index:idx_product_id" json:"product_id" comment:"关联产品ID"`
Topic string `gorm:"type:varchar(255);not null;default:''" json:"topic" comment:"topic主题"`
Title string `gorm:"type:varchar(200);not null;default:''" json:"title" comment:"标题"`
CreatedUserID int `gorm:"not null;default:0;index:idx_created_user_id" json:"created_user_id" comment:"创建用户ID"`
ReviewUserID *int `json:"review_user_id" comment:"审核用户ID"`
PublishUserID *int `json:"publish_user_id" comment:"发布用户ID"`
Status string `gorm:"type:enum('topic','cover_image','generate','generate_failed','draft','pending_review','assign_authors','approved','rejected','published_review','published','failed');default:'draft';index:idx_status" json:"status" comment:"状态"`
2026-01-06 19:36:42 +08:00
Channel int `gorm:"type:tinyint(1);not null;default:1" json:"channel" comment:"渠道1=小红书|2=douyin|3=toutiao|4=weixin"`
2025-12-20 01:05:46 +08:00
ReviewComment string `gorm:"type:text" json:"review_comment" comment:"审核评论"`
PublishTime *time.Time `json:"publish_time" comment:"发布时间"`
2026-01-06 19:36:42 +08:00
PublishLink string `gorm:"type:varchar(255);not null;default:''" json:"publish_link" comment:"发布访问链接"`
2025-12-20 01:05:46 +08:00
WordCount int `gorm:"default:0" json:"word_count" comment:"字数统计"`
ImageCount int `gorm:"default:0" json:"image_count" comment:"图片数量"`
CreatedAt time.Time `gorm:"index:idx_created_at" json:"created_at" comment:"创建时间"`
UpdatedAt time.Time `gorm:"index:idx_updated_at" json:"updated_at" comment:"更新时间"`
2025-12-19 22:36:48 +08:00
}
// XHSAccount 小红书账号表(保持兼容)
type XHSAccount struct {
2025-12-20 01:05:46 +08:00
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
EmployeeID int `gorm:"not null;default:0;uniqueIndex:uk_employee_id" json:"employee_id"`
Employee User `gorm:"foreignKey:EmployeeID" json:"employee,omitempty"`
XHSUserID string `gorm:"type:varchar(100);not null;default:'';index:idx_xhs_user_id" json:"xhs_user_id"`
XHSNickname string `gorm:"type:varchar(100);not null;default:''" json:"xhs_nickname"`
XHSPhone string `gorm:"type:varchar(20);not null;default:''" json:"xhs_phone"`
XHSAvatar string `gorm:"type:varchar(500);not null;default:''" json:"xhs_avatar"`
FansCount int `gorm:"not null;default:0" json:"fans_count"`
NotesCount int `gorm:"not null;default:0" json:"notes_count"`
Cookies string `gorm:"type:text" json:"cookies"`
AccessToken string `gorm:"type:varchar(500);not null;default:''" json:"access_token"`
RefreshToken string `gorm:"type:varchar(500);not null;default:''" json:"refresh_token"`
TokenExpireAt *time.Time `json:"token_expire_at"`
Status string `gorm:"type:enum('active','expired','banned');default:'active';index:idx_status" json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
2025-12-19 22:36:48 +08:00
}
// PromptWorkflow 提示词工作流表
type PromptWorkflow struct {
2025-12-20 01:05:46 +08:00
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
EnterpriseID int `gorm:"not null;default:0;index:idx_enterprise_id" json:"enterprise_id" comment:"所属企业ID"`
PromptWorkflowName string `gorm:"type:varchar(100);not null;default:''" json:"prompt_workflow_name" comment:"提示词工作流名称"`
AuthToken string `gorm:"type:varchar(100);not null;default:''" json:"auth_token" comment:"认证Token"`
WorkflowID string `gorm:"type:varchar(100);not null;default:'';index:idx_workflow_id" json:"workflow_id" comment:"工作流ID"`
Content string `gorm:"type:text" json:"content" comment:"提示词内容"`
UsageCount int `gorm:"not null;default:0" json:"usage_count" comment:"使用次数统计"`
CreatedUserID int `gorm:"not null;default:0" json:"created_user_id" comment:"创建用户ID"`
CreatedAt time.Time `gorm:"index:idx_created_at" json:"created_at" comment:"创建时间"`
UpdatedAt time.Time `json:"updated_at" comment:"更新时间"`
2025-12-19 22:36:48 +08:00
}
// ProductImage 产品图片库表
type ProductImage struct {
2025-12-20 01:05:46 +08:00
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
EnterpriseID int `gorm:"not null;default:0;index:idx_enterprise_id" json:"enterprise_id" comment:"所属企业ID"`
ProductID int `gorm:"not null;default:0;index:idx_product_id" json:"product_id" comment:"关联产品ID"`
ProductName string `gorm:"type:varchar(256);not null;default:''" json:"product_name" comment:"产品名称"`
ImageID int `gorm:"not null;default:0" json:"image_id" comment:"图片ID"`
ImageName string `gorm:"type:varchar(255);not null;default:''" json:"image_name" comment:"图片名称"`
ImageURL string `gorm:"type:varchar(500);not null;default:''" json:"image_url" comment:"图片URL"`
ThumbnailURL string `gorm:"type:varchar(500);not null;default:''" json:"thumbnail_url" comment:"缩略图URL"`
TypeName string `gorm:"type:varchar(50);not null;default:''" json:"type_name" comment:"图片类型"`
Description string `gorm:"type:varchar(500);not null;default:''" json:"description" comment:"图片描述"`
FileSize *int64 `json:"file_size" comment:"文件大小"`
Width *int `json:"width" comment:"图片宽度"`
Height *int `json:"height" comment:"图片高度"`
UploadUserID int `gorm:"not null;default:0" json:"upload_user_id" comment:"上传用户ID"`
Status string `gorm:"type:enum('active','deleted');default:'active';index:idx_status" json:"status" comment:"状态"`
CreatedAt time.Time `gorm:"index:idx_created_at" json:"created_at" comment:"上传时间"`
UpdatedAt time.Time `json:"updated_at" comment:"更新时间"`
2025-12-19 22:36:48 +08:00
}
// ArticleImage 文章图片表
type ArticleImage struct {
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
2025-12-20 01:05:46 +08:00
EnterpriseID int `gorm:"not null;default:0" json:"enterprise_id" comment:"所属企业ID"`
2025-12-19 22:36:48 +08:00
ArticleID int `gorm:"not null;default:0;index:idx_article_id" json:"article_id" comment:"文章ID"`
ImageID int `gorm:"not null;default:0;index:idx_image_id" json:"image_id" comment:"图片ID"`
ImageURL string `gorm:"type:varchar(500);not null;default:''" json:"image_url" comment:"图片URL"`
ImageThumbURL string `gorm:"type:varchar(255);not null;default:''" json:"image_thumb_url" comment:"缩略图URL"`
ImageTagID int `gorm:"not null;default:0" json:"image_tag_id" comment:"图片标签ID"`
SortOrder int `gorm:"default:0" json:"sort_order" comment:"排序"`
KeywordsID int `gorm:"not null;default:0" json:"keywords_id" comment:"关键词ID"`
KeywordsName string `gorm:"type:varchar(255);not null;default:''" json:"keywords_name" comment:"关键词名称"`
DepartmentID int `gorm:"not null;default:0" json:"department_id" comment:"部门ID"`
DepartmentName string `gorm:"type:varchar(255);not null;default:''" json:"department_name" comment:"部门名称"`
ImageSource int `gorm:"type:tinyint(1);not null;default:0" json:"image_source" comment:"图片来源1=tag|2=change"`
CreatedAt time.Time `gorm:"index:idx_created_at" json:"created_at" comment:"创建时间"`
UpdatedAt time.Time `json:"updated_at" comment:"更新时间"`
}
// ArticleTag 文章标签表
type ArticleTag struct {
2025-12-20 01:05:46 +08:00
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
EnterpriseID int `gorm:"not null;default:0" json:"enterprise_id" comment:"所属企业ID"`
ArticleID int `gorm:"not null;default:0;uniqueIndex:uk_article_tag" json:"article_id" comment:"文章ID"`
CozeTag string `gorm:"type:varchar(500)" json:"coze_tag" comment:"Coze生成的标签"`
CreatedAt time.Time `gorm:"index:idx_created_at" json:"created_at" comment:"创建时间"`
2025-12-19 22:36:48 +08:00
}
// DataStatistics 数据统计表
type DataStatistics struct {
2025-12-20 01:05:46 +08:00
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
EnterpriseID int `gorm:"not null;default:0;index:idx_enterprise_id" json:"enterprise_id" comment:"所属企业ID"`
ProductID int `gorm:"not null;default:0;index:idx_product_id" json:"product_id" comment:"关联产品ID"`
CumulativeReleasesNum int `gorm:"type:int(10) unsigned;not null;default:0" json:"cumulative_releases_num" comment:"累计发布"`
PublishedTodayNum int `gorm:"type:int(10) unsigned;not null;default:0" json:"published_today_num" comment:"今日发布"`
PublishedWeekNum int `gorm:"type:int(10) unsigned;not null;default:0" json:"published_week_num" comment:"本周发布"`
ParticipatingEmployees int `gorm:"type:int(10) unsigned;not null;default:0" json:"participating_employees_num" comment:"参与员工"`
CreatedAt time.Time `gorm:"index:idx_created_at" json:"created_at" comment:"创建时间"`
UpdatedAt time.Time `json:"updated_at" comment:"更新时间"`
2025-12-19 22:36:48 +08:00
}
// Log 操作日志表对应ai_logs
type Log struct {
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
UserID *int `gorm:"index:idx_user_id" json:"user_id" comment:"用户ID"`
Action string `gorm:"type:varchar(100);not null;default:'';index:idx_action" json:"action" comment:"操作动作"`
TargetType string `gorm:"type:varchar(50)" json:"target_type" comment:"目标类型"`
TargetID *int `json:"target_id" comment:"目标ID"`
Description string `gorm:"type:text" json:"description" comment:"描述"`
IPAddress string `gorm:"type:varchar(45)" json:"ip_address" comment:"IP地址"`
UserAgent string `gorm:"type:text" json:"user_agent" comment:"用户代理"`
RequestData string `gorm:"type:json" json:"request_data" comment:"请求数据"`
ResponseData string `gorm:"type:json" json:"response_data" comment:"响应数据"`
Status string `gorm:"type:enum('success','error','warning');default:'success';index:idx_status" json:"status" comment:"状态"`
ErrorMessage string `gorm:"type:text" json:"error_message" comment:"错误消息"`
CreatedAt time.Time `gorm:"index:idx_created_at" json:"created_at" comment:"创建时间"`
}
2026-01-06 19:36:42 +08:00
// Author 作者表(对应ai_authors)
2025-12-20 01:05:46 +08:00
type Author struct {
2026-01-06 19:36:42 +08:00
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
EnterpriseID int `gorm:"not null;default:0" json:"enterprise_id" comment:"所属企业ID"`
CreatedUserID int `gorm:"not null;default:0" json:"created_user_id" comment:"创建用户ID"`
Phone string `gorm:"type:varchar(20)" json:"phone" comment:"手机号"`
AuthorName string `gorm:"type:varchar(100);not null;default:''" json:"author_name" comment:"作者名称"`
XHSCookie string `gorm:"type:text" json:"xhs_cookie" comment:"小红书登录状态login_state JSON"`
XHSPhone string `gorm:"type:varchar(20);not null;default:''" json:"xhs_phone" comment:"小红书绑定手机号"`
XHSAccount string `gorm:"type:varchar(255);not null;default:''" json:"xhs_account" comment:"小红书账号名称"`
BoundAt *time.Time `json:"bound_at" comment:"绑定的时间"`
AppID string `gorm:"type:varchar(127);not null;default:''" json:"app_id" comment:"应用ID"`
AppToken string `gorm:"type:varchar(127);not null;default:''" json:"app_token" comment:"应用Token"`
DepartmentID int `gorm:"not null;default:0" json:"department_id" comment:"部门ID"`
DepartmentName string `gorm:"type:varchar(255);not null;default:''" json:"department_name" comment:"部门名称"`
Department string `gorm:"type:varchar(50);not null;default:''" json:"department" comment:"部门"`
Title string `gorm:"type:varchar(50)" json:"title" comment:"职称"`
Hospital string `gorm:"type:varchar(100)" json:"hospital" comment:"医院"`
Specialty string `gorm:"type:text" json:"specialty" comment:"专业"`
ToutiaoCookie string `gorm:"type:text" json:"toutiao_cookie" comment:"头条Cookie"`
ToutiaoImagesCookie string `gorm:"type:text" json:"toutiao_images_cookie" comment:"头条图片Cookie"`
Introduction string `gorm:"type:text" json:"introduction" comment:"介绍"`
AvatarURL string `gorm:"type:varchar(255)" json:"avatar_url" comment:"头像URL"`
Status string `gorm:"type:enum('active','inactive');default:'active';index:idx_status" json:"status" comment:"状态"`
Channel int `gorm:"type:tinyint(1);not null;default:1" json:"channel" comment:"渠道1=小红书|2=douyin|3=toutiao|4=weixin"`
CreatedAt time.Time `gorm:"index:idx_created_at" json:"created_at" comment:"创建时间"`
UpdatedAt time.Time `json:"updated_at" comment:"更新时间"`
}
// Feedback 用户反馈表
type Feedback struct {
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
FeedbackType string `gorm:"type:enum('功能建议','Bug反馈','体验问题','其他');not null;index:idx_feedback_type" json:"feedback_type" comment:"反馈类型"`
Description string `gorm:"type:text;charset=utf8mb4;collate=utf8mb4_unicode_ci" json:"description" comment:"问题描述最多500字"`
ContactInfo string `gorm:"type:varchar(255)" json:"contact_info" comment:"联系方式(如邮箱),选填"`
Nickname string `gorm:"type:varchar(255);not null;default:''" json:"nickname" comment:"填写用户昵称"`
CreatedUserID int `gorm:"type:int unsigned;not null;index:idx_created_user_id" json:"created_user_id" comment:"创建该反馈的用户ID关联用户表"`
CreatedAt time.Time `gorm:"index:idx_created_at" json:"created_at" comment:"创建时间"`
UpdatedAt time.Time `json:"updated_at" comment:"更新时间"`
Status string `gorm:"type:enum('待处理','处理中','已解决','已关闭');default:'待处理'" json:"status" comment:"反馈状态"`
2025-12-20 01:05:46 +08:00
}
2025-12-19 22:36:48 +08:00
// TableName 指定表名带ai_前缀
func (Enterprise) TableName() string {
return "ai_enterprises"
}
func (User) TableName() string {
return "ai_users"
}
func (Product) TableName() string {
return "ai_products"
}
func (Article) TableName() string {
return "ai_articles"
}
func (XHSAccount) TableName() string {
return "wht_xhs_accounts" // 保持兼容旧表
}
func (PublishRecord) TableName() string {
return "ai_article_published_records"
}
func (PromptWorkflow) TableName() string {
return "ai_prompt_workflow"
}
func (ProductImage) TableName() string {
return "ai_product_images"
}
func (ArticleImage) TableName() string {
return "ai_article_images"
}
func (ArticleTag) TableName() string {
return "ai_article_tags"
}
func (DataStatistics) TableName() string {
return "ai_data_statistics"
}
func (Log) TableName() string {
return "ai_logs"
}
2025-12-20 01:05:46 +08:00
func (Author) TableName() string {
return "ai_authors"
}
2026-01-06 19:36:42 +08:00
func (Feedback) TableName() string {
return "ai_feedback"
}