修复 model 生成脚本,统一时间字段类型为 common.LocalDateTime

This commit is contained in:
2025-04-28 09:15:49 +08:00
parent 3e837b5fec
commit 129f842153
14 changed files with 38 additions and 44 deletions

View File

@@ -6,7 +6,6 @@ package models
import (
"platform/web/common"
"time"
"gorm.io/gorm"
)
@@ -23,7 +22,7 @@ type Admin struct {
Phone string `gorm:"column:phone;comment:手机号码" json:"phone"` // 手机号码
Email string `gorm:"column:email;comment:邮箱" json:"email"` // 邮箱
Status int32 `gorm:"column:status;not null;default:1;comment:状态1-正常0-禁用" json:"status"` // 状态1-正常0-禁用
LastLogin time.Time `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间
LastLogin common.LocalDateTime `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间
LastLoginHost string `gorm:"column:last_login_host;comment:最后登录地址" json:"last_login_host"` // 最后登录地址
LastLoginAgent string `gorm:"column:last_login_agent;comment:最后登录代理" json:"last_login_agent"` // 最后登录代理
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间

View File

@@ -6,7 +6,6 @@ package models
import (
"platform/web/common"
"time"
"gorm.io/gorm"
)
@@ -26,7 +25,7 @@ type Channel struct {
AuthPass bool `gorm:"column:auth_pass;not null;comment:密码认证" json:"auth_pass"` // 密码认证
Username string `gorm:"column:username;comment:用户名" json:"username"` // 用户名
Password string `gorm:"column:password;comment:密码" json:"password"` // 密码
Expiration time.Time `gorm:"column:expiration;not null;comment:过期时间" json:"expiration"` // 过期时间
Expiration common.LocalDateTime `gorm:"column:expiration;not null;comment:过期时间" json:"expiration"` // 过期时间
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间

View File

@@ -6,7 +6,6 @@ package models
import (
"platform/web/common"
"time"
"gorm.io/gorm"
)
@@ -15,7 +14,7 @@ const TableNameCoupon = "coupon"
// Coupon mapped from table <coupon>
type Coupon struct {
ExpireAt time.Time `gorm:"column:expire_at;comment:过期时间" json:"expire_at"` // 过期时间
ExpireAt common.LocalDateTime `gorm:"column:expire_at;comment:过期时间" json:"expire_at"` // 过期时间
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间

View File

@@ -4,20 +4,18 @@
package models
import (
"time"
)
import "platform/web/common"
const TableNameResourcePsr = "resource_psr"
// ResourcePsr mapped from table <resource_psr>
type ResourcePsr struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:ID" json:"id"` // ID
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
Live int32 `gorm:"column:live;comment:轮换周期(秒)" json:"live"` // 轮换周期(秒)
Conn int32 `gorm:"column:conn;comment:最大连接数" json:"conn"` // 最大连接数
Expire time.Time `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间
Used bool `gorm:"column:used;comment:是否已使用" json:"used"` // 是否已使用
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:ID" json:"id"` // ID
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
Live int32 `gorm:"column:live;comment:轮换周期(秒)" json:"live"` // 轮换周期(秒)
Conn int32 `gorm:"column:conn;comment:最大连接数" json:"conn"` // 最大连接数
Expire common.LocalDateTime `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间
Used bool `gorm:"column:used;comment:是否已使用" json:"used"` // 是否已使用
}
// TableName ResourcePsr's table name

View File

@@ -6,7 +6,6 @@ package models
import (
"platform/web/common"
"time"
"gorm.io/gorm"
)
@@ -30,7 +29,7 @@ type User struct {
IDToken string `gorm:"column:id_token;comment:身份验证标识" json:"id_token"` // 身份验证标识
ContactQq string `gorm:"column:contact_qq;comment:QQ联系方式" json:"contact_qq"` // QQ联系方式
ContactWechat string `gorm:"column:contact_wechat;comment:微信联系方式" json:"contact_wechat"` // 微信联系方式
LastLogin time.Time `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间
LastLogin common.LocalDateTime `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间
LastLoginHost string `gorm:"column:last_login_host;comment:最后登录地址" json:"last_login_host"` // 最后登录地址
LastLoginAgent string `gorm:"column:last_login_agent;comment:最后登录代理" json:"last_login_agent"` // 最后登录代理
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间