修正模型外键的数据类型为 uint

This commit is contained in:
GeekMaster
2025-05-05 17:27:55 +08:00
parent 7bc55f3ed1
commit 5e59b3a708
9 changed files with 30 additions and 31 deletions

View File

@@ -5,18 +5,18 @@ import (
)
type ChatRole struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
Name string `gorm:"column:name;type:varchar(30);not null;comment:角色名称" json:"name"`
Tid uint `gorm:"column:tid;type:int;not null;comment:分类ID" json:"tid"`
Marker string `gorm:"column:marker;type:varchar(30);uniqueIndex;not null;comment:角色标识" json:"marker"`
Context string `gorm:"column:context_json;type:text;not null;comment:角色语料 json" json:"context_json"`
HelloMsg string `gorm:"column:hello_msg;type:varchar(255);not null;comment:打招呼信息" json:"hello_msg"`
Icon string `gorm:"column:icon;type:varchar(255);not null;comment:角色图标" json:"icon"`
Enable bool `gorm:"column:enable;type:tinyint(1);not null;comment:是否被启用" json:"enable"`
SortNum int `gorm:"column:sort_num;type:smallint;not null;default:0;comment:角色排序" json:"sort_num"`
ModelId uint `gorm:"column:model_id;type:int;not null;default:0;comment:绑定模型ID" json:"model_id"`
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"`
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
Name string `gorm:"column:name;type:varchar(30);not null;comment:角色名称" json:"name"`
Tid uint `gorm:"column:tid;type:int;not null;comment:分类ID" json:"tid"`
Key string `gorm:"column:marker;type:varchar(30);uniqueIndex;not null;comment:角色标识" json:"marker"`
Context string `gorm:"column:context_json;type:text;not null;comment:角色语料 json" json:"context_json"`
HelloMsg string `gorm:"column:hello_msg;type:varchar(255);not null;comment:打招呼信息" json:"hello_msg"`
Icon string `gorm:"column:icon;type:varchar(255);not null;comment:角色图标" json:"icon"`
Enable bool `gorm:"column:enable;type:tinyint(1);not null;comment:是否被启用" json:"enable"`
SortNum int `gorm:"column:sort_num;type:smallint;not null;default:0;comment:角色排序" json:"sort_num"`
ModelId uint `gorm:"column:model_id;type:int;not null;default:0;comment:绑定模型ID" json:"model_id"`
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"`
}
func (m *ChatRole) TableName() string {

View File

@@ -2,9 +2,8 @@ package vo
type AdminUser struct {
BaseVo
Username string `json:"username"`
Status bool `json:"status"` // 当前状态
LastLoginAt int64 `json:"last_login_at"` // 最后登录时间
LastLoginIp string `json:"last_login_ip"` // 最后登录 IP
RoleIds interface{} `json:"role_ids"` //角色ids
Username string `json:"username"`
Status bool `json:"status"` // 当前状态
LastLoginAt int64 `json:"last_login_at"` // 最后登录时间
LastLoginIp string `json:"last_login_ip"` // 最后登录 IP
}

View File

@@ -5,14 +5,14 @@ import "geekai/core/types"
type ChatRole struct {
BaseVo
Key string `json:"key"` // 角色唯一标识
Tid int `json:"tid"`
Tid uint `json:"tid"`
Name string `json:"name"` // 角色名称
Context []types.Message `json:"context"` // 角色语料信息
HelloMsg string `json:"hello_msg"` // 打招呼的消息
Icon string `json:"icon"` // 角色聊天图标
Enable bool `json:"enable"` // 是否启用被启用
SortNum int `json:"sort"` // 排序
ModelId int `json:"model_id"` // 绑定模型 ID
ModelId uint `json:"model_id"` // 绑定模型 ID
ModelName string `json:"model_name"` // 模型名称
TypeName string `json:"type_name"` // 分类名称
}

View File

@@ -3,7 +3,7 @@ package vo
type MidJourneyJob struct {
Id uint `json:"id"`
Type string `json:"type"`
UserId int `json:"user_id"`
UserId uint `json:"user_id"`
ChannelId string `json:"channel_id"`
TaskId string `json:"task_id"`
MessageId string `json:"message_id"`

View File

@@ -3,14 +3,14 @@ package vo
import "math"
type Page struct {
Items interface{} `json:"items"`
Page int `json:"page"`
PageSize int `json:"page_size"`
Total int64 `json:"total"`
TotalPage int `json:"total_page"`
Items any `json:"items"`
Page int `json:"page"`
PageSize int `json:"page_size"`
Total int64 `json:"total"`
TotalPage int `json:"total_page"`
}
func NewPage(total int64, page int, pageSize int, items interface{}) Page {
func NewPage(total int64, page int, pageSize int, items any) Page {
totalPage := math.Ceil(float64(total) / float64(pageSize))
return Page{
Items: items,

View File

@@ -7,7 +7,7 @@ import (
type SdJob struct {
Id uint `json:"id"`
Type string `json:"type"`
UserId int `json:"user_id"`
UserId uint `json:"user_id"`
TaskId string `json:"task_id"`
ImgURL string `json:"img_url"`
Params types.SdTaskParams `json:"params"`

View File

@@ -2,7 +2,7 @@ package vo
type SunoJob struct {
Id uint `json:"id"`
UserId int `json:"user_id"`
UserId uint `json:"user_id"`
Channel string `json:"channel"`
Title string `json:"title"`
Type int `json:"type"`

View File

@@ -2,7 +2,7 @@ package vo
type VideoJob struct {
Id uint `json:"id"`
UserId int `json:"user_id"`
UserId uint `json:"user_id"`
Channel string `json:"channel"`
Type string `json:"type"`
TaskId string `json:"task_id"`