调整日志和鉴权接管方案

This commit is contained in:
2026-04-04 20:50:45 +08:00
parent 15f72873db
commit 76f0d815aa
20 changed files with 944 additions and 402 deletions

View File

@@ -24,8 +24,8 @@ const (
APITypeSingleLogin = 10 // 卡密登录
// 账号管理
APITypeUserLogin = 20 // 用户登录
APITypeUserRegin = 21 // 用户注册
APITypeUserLogin = 20 // 字系统登录
APITypeUserRegin = 21 // 字系统注册
APITypeUserRecharge = 22 // 用户充值
// 登出操作
@@ -188,8 +188,8 @@ func GetAPITypes(categorized bool) interface{} {
{
Name: "账号管理",
Types: []APITypeInfo{
{Type: APITypeUserLogin, Name: "用户登录"},
{Type: APITypeUserRegin, Name: "用户注册"},
{Type: APITypeUserLogin, Name: "子系统登录"},
{Type: APITypeUserRegin, Name: "子系统注册"},
{Type: APITypeUserRecharge, Name: "用户充值"},
},
},

View File

@@ -8,6 +8,7 @@ import (
type LoginLog struct {
ID uint `gorm:"primarykey" json:"id"`
Type string `gorm:"type:varchar(20);index;comment:日志类型(admin/user)" json:"type"`
UUID string `gorm:"type:char(36);index;comment:用户UUID" json:"uuid"`
Username string `gorm:"type:varchar(100);index;comment:登录用户名" json:"username"`
IP string `gorm:"type:varchar(50);comment:登录IP" json:"ip"`
Status int `gorm:"type:tinyint;comment:登录状态 1:成功 0:失败" json:"status"`

View File

@@ -22,7 +22,7 @@ type User struct {
Password string `gorm:"size:255;not null;comment:密码哈希值"`
PasswordSalt string `gorm:"size:64;not null;comment:密码加密盐值"`
Status int `gorm:"not null;default:1;comment:状态0禁用1启用" json:"status"`
Role int `gorm:"not null;default:2;comment:角色类型0超级管理员1代理成员2普通成员" json:"role"`
Role int `gorm:"not null;default:2;comment:角色类型0超级管理员1管理员2子账号" json:"role"`
Permissions string `gorm:"size:255;comment:权限列表,逗号分隔" json:"permissions"`
Nickname string `gorm:"size:64;comment:用户昵称" json:"nickname"`
Remark string `gorm:"size:255;comment:备注信息" json:"remark"`