86738c903e
后端: - User.Role enum 增加 superadmin,启动时 ALTER TABLE 兼容已有 DB - 新增 SuperAdminOnly() 中间件 - 新增 POST /api/v1/admin/clear-data 接口(按表名白名单删除,多租户隔离) 前端: - AppUser/AuthUser 支持 role 字段持久化与传递 - 数据导入 Tab 末尾增加「危险操作 — 数据清空」区块(仅 superadmin 可见) - 支持多选:入库单/出库单/库存管理/商品详情/往来单位 - 红色警告框 + 二次确认弹窗(需手动输入"确认清空") Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
13 lines
531 B
Go
13 lines
531 B
Go
package model
|
|
|
|
type User struct {
|
|
TenantBase
|
|
Username string `gorm:"size:50;uniqueIndex:uk_shop_username" json:"username"`
|
|
PasswordHash string `gorm:"size:255" json:"-"`
|
|
RealName string `gorm:"size:50" json:"real_name"`
|
|
Phone string `gorm:"size:30" json:"phone"`
|
|
Role string `gorm:"type:enum('admin','operator','readonly','superadmin');default:'operator'" json:"role"`
|
|
IsActive bool `gorm:"default:true" json:"is_active"`
|
|
CustomFields JSON `gorm:"type:json" json:"custom_fields,omitempty"`
|
|
}
|