mirror of
https://github.com/yangjian102621/geekai.git
synced 2026-04-26 21:14:27 +08:00
重命名数据表
This commit is contained in:
@@ -5,18 +5,18 @@ import (
|
||||
)
|
||||
|
||||
type AdminUser struct {
|
||||
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
Username string `gorm:"column:username;type:varchar(30);uniqueIndex;not null;comment:用户名" json:"username"`
|
||||
Password string `gorm:"column:password;type:char(64);not null;comment:密码" json:"password"`
|
||||
Salt string `gorm:"column:salt;type:char(12);not null;comment:密码盐" json:"salt"`
|
||||
Status bool `gorm:"column:status;type:tinyint(1);not null;comment:当前状态" json:"status"`
|
||||
LastLoginAt int64 `gorm:"column:last_login_at;type:int;not null;comment:最后登录时间" json:"last_login_at"`
|
||||
LastLoginIp string `gorm:"column:last_login_ip;type:char(16);not null;comment:最后登录 IP" json:"last_login_ip"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;comment:创建时间" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null;comment:更新时间" json:"updated_at"`
|
||||
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
Username string `gorm:"column:username;type:varchar(30);uniqueIndex;not null;comment:用户名" json:"username"`
|
||||
Password string `gorm:"column:password;type:char(64);not null;comment:密码" json:"password"`
|
||||
Salt string `gorm:"column:salt;type:char(12);not null;comment:密码盐" json:"salt"`
|
||||
Status bool `gorm:"column:status;type:tinyint(1);not null;comment:当前状态" json:"status"`
|
||||
LastLoginAt int64 `gorm:"column:last_login_at;type:int;not null;comment:最后登录时间" json:"last_login_at"`
|
||||
LastLoginIp string `gorm:"column:last_login_ip;type:char(16);not null;comment:最后登录 IP" json:"last_login_ip"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;comment:创建时间" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null;comment:更新时间" json:"updated_at"`
|
||||
}
|
||||
|
||||
// TableName 表名
|
||||
func (m *AdminUser) TableName() string {
|
||||
return "chatgpt_admin_users"
|
||||
return "geekai_admin_users"
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ import (
|
||||
|
||||
// ApiKey OpenAI API 模型
|
||||
type ApiKey struct {
|
||||
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
Name string `gorm:"column:name;type:varchar(30);comment:名称" json:"name"`
|
||||
Value string `gorm:"column:value;type:varchar(255);not null;comment:API KEY value" json:"value"`
|
||||
Type string `gorm:"column:type;type:varchar(10);default:chat;not null;comment:用途(chat=>聊天,img=>图片)" json:"type"`
|
||||
LastUsedAt int64 `gorm:"column:last_used_at;type:int;not null;comment:最后使用时间" json:"last_used_at"`
|
||||
LastUsedAt int64 `gorm:"column:last_used_at;type:int;not null;comment:最后使用时间" json:"last_used_at"`
|
||||
ApiURL string `gorm:"column:api_url;type:varchar(255);comment:API 地址" json:"api_url"`
|
||||
Enabled bool `gorm:"column:enabled;type:tinyint(1);comment:是否启用" json:"enabled"`
|
||||
Enabled bool `gorm:"column:enabled;type:tinyint(1);comment:是否启用" json:"enabled"`
|
||||
ProxyURL string `gorm:"column:proxy_url;type:varchar(100);comment:代理地址" json:"proxy_url"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
|
||||
@@ -20,5 +20,5 @@ type ApiKey struct {
|
||||
|
||||
// TableName 表名
|
||||
func (m *ApiKey) TableName() string {
|
||||
return "chatgpt_api_keys"
|
||||
return "geekai_api_keys"
|
||||
}
|
||||
|
||||
@@ -3,15 +3,15 @@ package model
|
||||
import "time"
|
||||
|
||||
type AppType struct {
|
||||
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
Name string `gorm:"column:name;type:varchar(50);not null;comment:名称" json:"name"`
|
||||
Icon string `gorm:"column:icon;type:varchar(255);not null;comment:图标URL" json:"icon"`
|
||||
SortNum int `gorm:"column:sort_num;type:tinyint;not null;comment:排序" json:"sort_num"`
|
||||
Enabled bool `gorm:"column:enabled;type:tinyint(1);not null;comment:是否启用" json:"enabled"`
|
||||
Enabled bool `gorm:"column:enabled;type:tinyint(1);not null;comment:是否启用" json:"enabled"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
|
||||
}
|
||||
|
||||
// TableName 表名
|
||||
func (m *AppType) TableName() string {
|
||||
return "chatgpt_app_types"
|
||||
return "geekai_app_types"
|
||||
}
|
||||
|
||||
@@ -20,5 +20,5 @@ type ChatApp struct {
|
||||
}
|
||||
|
||||
func (m *ChatApp) TableName() string {
|
||||
return "chatgpt_chat_roles"
|
||||
return "geekai_chat_roles"
|
||||
}
|
||||
|
||||
@@ -17,5 +17,5 @@ type ChatItem struct {
|
||||
}
|
||||
|
||||
func (m *ChatItem) TableName() string {
|
||||
return "chatgpt_chat_items"
|
||||
return "geekai_chat_items"
|
||||
}
|
||||
|
||||
@@ -21,5 +21,5 @@ type ChatMessage struct {
|
||||
}
|
||||
|
||||
func (m *ChatMessage) TableName() string {
|
||||
return "chatgpt_chat_history"
|
||||
return "geekai_chat_history"
|
||||
}
|
||||
|
||||
@@ -25,5 +25,5 @@ type ChatModel struct {
|
||||
}
|
||||
|
||||
func (m *ChatModel) TableName() string {
|
||||
return "chatgpt_chat_models"
|
||||
return "geekai_chat_models"
|
||||
}
|
||||
|
||||
@@ -7,5 +7,5 @@ type Config struct {
|
||||
}
|
||||
|
||||
func (m *Config) TableName() string {
|
||||
return "chatgpt_configs"
|
||||
return "geekai_configs"
|
||||
}
|
||||
|
||||
@@ -17,5 +17,5 @@ type DallJob struct {
|
||||
}
|
||||
|
||||
func (m *DallJob) TableName() string {
|
||||
return "chatgpt_dall_jobs"
|
||||
return "geekai_dall_jobs"
|
||||
}
|
||||
|
||||
@@ -14,5 +14,5 @@ type File struct {
|
||||
}
|
||||
|
||||
func (m *File) TableName() string {
|
||||
return "chatgpt_files"
|
||||
return "geekai_files"
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package model
|
||||
|
||||
type Function struct {
|
||||
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
Name string `gorm:"column:name;type:varchar(30);uniqueIndex;not null;comment:函数名称" json:"name"`
|
||||
Label string `gorm:"column:label;type:varchar(30);comment:函数标签" json:"label"`
|
||||
Description string `gorm:"column:description;type:varchar(255);comment:函数描述" json:"description"`
|
||||
Parameters string `gorm:"column:parameters;type:text;comment:函数参数(JSON)" json:"parameters"`
|
||||
Token string `gorm:"column:token;type:varchar(255);comment:API授权token" json:"token"`
|
||||
Action string `gorm:"column:action;type:varchar(255);comment:函数处理 API" json:"action"`
|
||||
Enabled bool `gorm:"column:enabled;type:tinyint(1);not null;default:0;comment:是否启用" json:"enabled"`
|
||||
Enabled bool `gorm:"column:enabled;type:tinyint(1);not null;default:0;comment:是否启用" json:"enabled"`
|
||||
}
|
||||
|
||||
func (m *Function) TableName() string {
|
||||
return "chatgpt_functions"
|
||||
return "geekai_functions"
|
||||
}
|
||||
|
||||
@@ -12,5 +12,5 @@ type InviteCode struct {
|
||||
}
|
||||
|
||||
func (m *InviteCode) TableName() string {
|
||||
return "chatgpt_invite_codes"
|
||||
return "geekai_invite_codes"
|
||||
}
|
||||
|
||||
@@ -15,5 +15,5 @@ type InviteLog struct {
|
||||
}
|
||||
|
||||
func (m *InviteLog) TableName() string {
|
||||
return "chatgpt_invite_logs"
|
||||
return "geekai_invite_logs"
|
||||
}
|
||||
|
||||
@@ -51,5 +51,5 @@ const (
|
||||
|
||||
// TableName 返回数据表名称
|
||||
func (JimengJob) TableName() string {
|
||||
return "chatgpt_jimeng_jobs"
|
||||
return "geekai_jimeng_jobs"
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@ package model
|
||||
|
||||
// Menu 系统菜单
|
||||
type Menu struct {
|
||||
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
Name string `gorm:"column:name;type:varchar(30);not null;comment:菜单名称" json:"name"`
|
||||
Icon string `gorm:"column:icon;type:varchar(150);not null;comment:菜单图标" json:"icon"`
|
||||
URL string `gorm:"column:url;type:varchar(100);not null;comment:地址" json:"url"`
|
||||
SortNum int `gorm:"column:sort_num;type:smallint;not null;comment:排序" json:"sort_num"`
|
||||
Enabled bool `gorm:"column:enabled;type:tinyint(1);not null;comment:是否启用" json:"enabled"`
|
||||
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
Name string `gorm:"column:name;type:varchar(30);not null;comment:菜单名称" json:"name"`
|
||||
Icon string `gorm:"column:icon;type:varchar(150);not null;comment:菜单图标" json:"icon"`
|
||||
URL string `gorm:"column:url;type:varchar(100);not null;comment:地址" json:"url"`
|
||||
SortNum int `gorm:"column:sort_num;type:smallint;not null;comment:排序" json:"sort_num"`
|
||||
Enabled bool `gorm:"column:enabled;type:tinyint(1);not null;comment:是否启用" json:"enabled"`
|
||||
}
|
||||
|
||||
func (m *Menu) TableName() string {
|
||||
return "chatgpt_menus"
|
||||
return "geekai_menus"
|
||||
}
|
||||
|
||||
@@ -24,5 +24,5 @@ type MidJourneyJob struct {
|
||||
}
|
||||
|
||||
func (m *MidJourneyJob) TableName() string {
|
||||
return "chatgpt_mj_jobs"
|
||||
return "geekai_mj_jobs"
|
||||
}
|
||||
|
||||
16
api/store/model/moderation.go
Normal file
16
api/store/model/moderation.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type Moderation struct {
|
||||
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户ID" json:"user_id"`
|
||||
Input string `gorm:"column:prompt;type:text;not null;comment:用户输入" json:"input"`
|
||||
Output string `gorm:"column:output;type:text;not null;comment:AI 输出" json:"output"`
|
||||
Result string `gorm:"column:result;type:text;not null;comment:鉴别结果" json:"result"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
|
||||
}
|
||||
|
||||
func (m *Moderation) TableName() string {
|
||||
return "geekai_moderation"
|
||||
}
|
||||
@@ -26,5 +26,5 @@ type Order struct {
|
||||
}
|
||||
|
||||
func (m *Order) TableName() string {
|
||||
return "chatgpt_orders"
|
||||
return "geekai_orders"
|
||||
}
|
||||
|
||||
@@ -20,5 +20,5 @@ type PowerLog struct {
|
||||
}
|
||||
|
||||
func (m *PowerLog) TableName() string {
|
||||
return "chatgpt_power_logs"
|
||||
return "geekai_power_logs"
|
||||
}
|
||||
|
||||
@@ -18,5 +18,5 @@ type Product struct {
|
||||
}
|
||||
|
||||
func (m *Product) TableName() string {
|
||||
return "chatgpt_products"
|
||||
return "geekai_products"
|
||||
}
|
||||
|
||||
@@ -16,5 +16,5 @@ type Redeem struct {
|
||||
}
|
||||
|
||||
func (m *Redeem) TableName() string {
|
||||
return "chatgpt_redeems"
|
||||
return "geekai_redeems"
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ type SdJob struct {
|
||||
}
|
||||
|
||||
func (m *SdJob) TableName() string {
|
||||
return "chatgpt_sd_jobs"
|
||||
return "geekai_sd_jobs"
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@ type SunoJob struct {
|
||||
}
|
||||
|
||||
func (m *SunoJob) TableName() string {
|
||||
return "chatgpt_suno_jobs"
|
||||
return "geekai_suno_jobs"
|
||||
}
|
||||
|
||||
@@ -29,5 +29,5 @@ type User struct {
|
||||
}
|
||||
|
||||
func (m *User) TableName() string {
|
||||
return "chatgpt_users"
|
||||
return "geekai_users"
|
||||
}
|
||||
|
||||
@@ -15,5 +15,5 @@ type UserLoginLog struct {
|
||||
}
|
||||
|
||||
func (m *UserLoginLog) TableName() string {
|
||||
return "chatgpt_user_login_logs"
|
||||
return "geekai_user_login_logs"
|
||||
}
|
||||
|
||||
@@ -23,5 +23,5 @@ type VideoJob struct {
|
||||
}
|
||||
|
||||
func (m *VideoJob) TableName() string {
|
||||
return "chatgpt_video_jobs"
|
||||
return "geekai_video_jobs"
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ func NewGormConfig() *gorm.Config {
|
||||
return &gorm.Config{
|
||||
Logger: logger.Default.LogMode(logger.Warn),
|
||||
NamingStrategy: schema.NamingStrategy{
|
||||
TablePrefix: "chatgpt_", // 设置表前缀
|
||||
SingularTable: false, // 使用单数表名形式
|
||||
TablePrefix: "geekai_", // 设置表前缀
|
||||
SingularTable: false, // 使用单数表名形式
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user