@@ -6,24 +6,25 @@ import (
// Enterprise 企业表
type Enterprise struct {
ID int ` gorm:"primaryKey;autoIncrement" json:"id" `
EnterpriseID string ` gorm:"type:varchar(255);not null;default:''" json:"enterprise_id" comment:"企业ID" `
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:"产品总数" `
Articles Total int ` gorm:"type:int(10) unsigned;not null;default:0" json:"articles _total" comment:"文章总数" `
ReleasedMonth Total 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:"创建时间 "`
Upd atedAt time . Time ` json:"upd ated_at" comment:"更新 时间" `
ID int ` gorm:"primaryKey;autoIncrement" json:"id" `
EnterpriseID string ` gorm:"type:varchar(255);not null;default:''" json:"enterprise_id" comment:"企业ID" `
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:"产品总数" `
Published Total int ` gorm:"type:int(10) unsigned;not null;default:0" json:"published _total" comment:"文章发布 总数" `
Articles Total 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:"绑定小红书 "`
Cre atedAt time . Time ` gorm:"index:idx_created_at" json:"cre ated_at" comment:"创建 时间"`
UpdatedAt time . Time ` json:"updated_at" comment:"更新时间" `
}
// User 用户账号表( 原Employee, 对应ai_users)
@@ -37,15 +38,15 @@ type User struct {
RealName string ` gorm:"type:varchar(50)" json:"real_name" comment:"真实姓名" `
Email string ` gorm:"type:varchar(100)" json:"email" comment:"邮箱" `
Phone string ` gorm:"type:varchar(20)" json:"phone" comment:"手机号" `
WechatOpenID * string ` gorm:"type:varchar(100);uniqueIndex:uk_wechat_openid" json:"wechat_openid,omitempty" comment:"微信OpenID" `
WechatUnionID * string ` gorm:"type:varchar(100)" json:"wechat_unionid,omitempty" comment:"微信UnionID" `
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" `
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:"小红书账号名称" `
XHSCookie string ` gorm:"type:text" json:"xhs_cookie" comment:"小红书Cookie" `
IsBoundXHS int ` gorm:"type:tinyint(1);not null;default:0;index:idx_is_bound_xhs" json:"is_bound_xhs" comment:"是否绑定小红书: 0=未绑定, 1=已绑定" `
BoundAt * time . Time ` json:"bound_at" comment:"绑定小红书的时间" `
Department string ` gorm:"type:varchar(50)" json:"department" comment:"部门" `
Role string ` gorm:"type:enum('admin','editor','reviewer','publisher','each_title_reviewer');default:'editor'" json:"role" comment:"角色" `
Role string ` gorm:"type:enum('admin','editor','reviewer','publisher','each_title_reviewer','enterprise' );default:'editor'" json:"role" comment:"角色" `
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:"更新时间" `
@@ -59,6 +60,7 @@ 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:"产品名称" `
TypeID int ` gorm:"type:int unsigned;not null;default:0" json:"type_id" comment:"type_id类型ID" `
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" `
@@ -72,35 +74,35 @@ type Product struct {
// Article 文章表( 原Copy, 对应ai_articles)
type Article struct {
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" `
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" `
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:"标题" `
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','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=baidu|2=toutiao|3=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:"更新时间" `
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" `
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" `
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:"标题" `
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=baidu|2=toutiao|3=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:"更新时间" `
}
// Copy 文案表别名,兼容旧代码
@@ -108,83 +110,85 @@ type Copy = Article
// PublishRecord 发布记录表( 对应ai_article_published_records)
type PublishRecord struct {
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','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=baidu|2=toutiao|3=weixin" `
ReviewComment string ` gorm:"type:text" json:"review_comment" comment:"审核评论" `
PublishTime * time . Time ` json:"publish_time" comment:"发布时间" `
PublishLink string ` gorm:"type:varchar(128);not null;default:''" json:"publish_link" comment:"发布访问链接" `
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:"更新时间" `
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:"状态" `
Channel int ` gorm:"type:tinyint(1);not null;default:1" json:"channel" comment:"渠道: 1=baidu|2=toutiao|3=weixin" `
ReviewComment string ` gorm:"type:text" json:"review_comment" comment:"审核评论" `
PublishTime * time . Time ` json:"publish_time" comment:"发布时间" `
PublishLink string ` gorm:"type:varchar(128);not null;default:''" json:"publish_link" comment:"发布访问链接" `
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:"更新时间" `
}
// XHSAccount 小红书账号表(保持兼容)
type XHSAccount struct {
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" `
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" `
}
// PromptWorkflow 提示词工作流表
type PromptWorkflow struct {
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:"更新时间" `
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:"更新时间" `
}
// ProductImage 产品图片库表
type ProductImage struct {
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" `
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 " `
Thumbnail URL 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:"上传时间 "`
Upd atedAt time . Time ` json:"upd ated_at" comment:"更新 时间" `
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:"图片名称 " `
Image URL 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:"状态 "`
Cre atedAt time . Time ` gorm:"index:idx_created_at" json:"cre ated_at" comment:"上传 时间"`
UpdatedAt time . Time ` json:"updated_at" comment:"更新时间" `
}
// ArticleImage 文章图片表
type ArticleImage struct {
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;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" `
@@ -202,23 +206,24 @@ type ArticleImage struct {
// ArticleTag 文章标签表
type ArticleTag struct {
ID int ` gorm:"primaryKey;autoIncrement" json:"id" `
Articl eID int ` gorm:"not null;default:0;uniqueIndex:uk_article_tag" json:"articl e_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:"创建时间 " `
ID int ` gorm:"primaryKey;autoIncrement" json:"id" `
Enterpris eID int ` gorm:"not null;default:0" json:"enterpris e_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:"创建时间" `
}
// DataStatistics 数据统计表
type DataStatistics struct {
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:"更新时间" `
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:"更新时间" `
}
// Log 操作日志表( 对应ai_logs)
@@ -238,6 +243,31 @@ type Log struct {
CreatedAt time . Time ` gorm:"index:idx_created_at" json:"created_at" comment:"创建时间" `
}
// Author 作者表( 对应ai_authors)
type Author struct {
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:"作者名称" `
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=baidu|2=toutiao|3=weixin" `
CreatedAt time . Time ` gorm:"index:idx_created_at" json:"created_at" comment:"创建时间" `
UpdatedAt time . Time ` json:"updated_at" comment:"更新时间" `
}
// TableName 指定表名( 带ai_前缀)
func ( Enterprise ) TableName ( ) string {
return "ai_enterprises"
@@ -286,3 +316,7 @@ func (DataStatistics) TableName() string {
func ( Log ) TableName ( ) string {
return "ai_logs"
}
func ( Author ) TableName ( ) string {
return "ai_authors"
}