批量优化
This commit is contained in:
1 parent
e3db229f41
commit
aa92ca40a2
79 files changed
+7495
-1104
No files matched your search
@@ -0,0 +1,26 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// AuthAppLoginTicket 移动端免登录票据:yz_auth_app_login_ticket
|
||||
//
|
||||
// 用途:移动端(uniapp APP / 小程序)已用统一认证登录后,打开 Web 端业务页面时
|
||||
// 通过本票据把登录态传递过去,避免 webview 里再次弹出统一登录页。
|
||||
//
|
||||
// 流程(与公众号一次性登录令牌 yz_platform_wechat_mp_login_token 同构):
|
||||
// POST /auth/app-ticket 移动端带 Bearer 令牌 → 签发一次性票据
|
||||
// POST /auth/app-ticket/exchange Web 端带票据 → 核销并换发 Web 端令牌
|
||||
//
|
||||
// 票据一次性、短时效(默认 60 秒),核销用 CAS 防重放。
|
||||
type AuthAppLoginTicket struct {
|
||||
ID uint64 `orm:"column(id);pk;auto" json:"id"`
|
||||
Ticket string `orm:"column(ticket);size(64)" json:"ticket"`
|
||||
IdentityID uint64 `orm:"column(identity_id)" json:"identity_id"`
|
||||
Tid uint64 `orm:"column(tid)" json:"tid"`
|
||||
ClientID string `orm:"column(client_id);size(64);default('')" json:"client_id"`
|
||||
ExpireAt time.Time `orm:"column(expire_at);type(datetime)" json:"expire_at"`
|
||||
UsedAt *time.Time `orm:"column(used_at);type(datetime);null" json:"used_at"`
|
||||
CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
|
||||
}
|
||||
|
||||
func (m *AuthAppLoginTicket) TableName() string { return "yz_auth_app_login_ticket" }
|
||||
@@ -200,6 +200,9 @@ func Init(_ string) {
|
||||
new(WechatMpLoginToken),
|
||||
new(WechatMpScanLogin),
|
||||
|
||||
// 微信小程序配置(docs/sql/create_wechat_mini_config.sql)
|
||||
new(WechatMiniConfig),
|
||||
|
||||
// 统一认证中心(UAC):docs/sql/create_auth_tables.sql,人工执行建表
|
||||
new(AuthIdentity),
|
||||
new(AuthIdentityThird),
|
||||
@@ -212,6 +215,7 @@ func Init(_ string) {
|
||||
new(AuthTenantIdp),
|
||||
new(AuthTenantAuthConfig),
|
||||
new(AuthLoginLog),
|
||||
new(AuthAppLoginTicket),
|
||||
|
||||
// 数据字典(docs/sql/create_dict.sql):平台端 / 租户端各一套
|
||||
new(PlatformDict),
|
||||
|
||||
@@ -2,6 +2,16 @@ package models
|
||||
|
||||
import "time"
|
||||
|
||||
// 展示端(platforms 字段取值)
|
||||
//
|
||||
// 与 views(平台端 / 租户端)是两个独立维度:
|
||||
// views —— 决定菜单出现在「平台后台」还是「租户后台」
|
||||
// platforms —— 决定菜单/模块出现在 Web 端还是移动端(APP / 小程序)
|
||||
const (
|
||||
PlatformWeb = "web" // Web 端:租户管理后台(PC 浏览器)
|
||||
PlatformApp = "app" // 移动端:uniapp APP / 微信小程序
|
||||
)
|
||||
|
||||
// SystemMenu 系统菜单表 yz_system_menu
|
||||
type SystemMenu struct {
|
||||
ID uint64 `orm:"column(id);pk;auto" json:"id"` // 菜单ID
|
||||
@@ -14,6 +24,7 @@ type SystemMenu struct {
|
||||
Status int8 `orm:"column(status);default(0)" json:"status"` // 状态:1-启用,0-禁用
|
||||
IsVisible *int8 `orm:"column(is_visible);null" json:"isVisible"` // 是否显示:1-显示 0-不显示
|
||||
Views *string `orm:"column(views);size(255);null" json:"views"` // 菜单显示端(JSON数组字符串):[1]=平台端 [2]=租户端 [1,2]=双端
|
||||
Platforms *string `orm:"column(platforms);size(64);null" json:"platforms"` // 展示端(JSON数组字符串):["web"] ["app"] ["web","app"];空/NULL=全端
|
||||
Type int8 `orm:"column(type)" json:"type"` // 菜单类型:1-目录,2-页面,3-接口
|
||||
Permission *string `orm:"column(permission);size(100);null" json:"permission"` // 权限标识(按钮类型时填写)
|
||||
Creater *string `orm:"column(creater);size(50);null" json:"creater"` // 创建者
|
||||
|
||||
@@ -15,6 +15,9 @@ type SystemModules struct {
|
||||
Sort int `orm:"column(sort);default(0)" json:"sort"`
|
||||
Status int8 `orm:"column(status);default(1)" json:"status"` // 0禁用 1启用
|
||||
IsShow int8 `orm:"column(is_show);default(1)" json:"is_show"` // 0否 1是
|
||||
// 展示端(JSON 数组字符串):["web"] ["app"] ["web","app"];空/NULL=全端显示。
|
||||
// 取值见 PlatformWeb / PlatformApp。菜单未单独配置时继承所属模块的展示端。
|
||||
Platforms *string `orm:"column(platforms);size(64);null" json:"platforms"`
|
||||
CreateTime *time.Time `orm:"column(create_time);type(datetime);null" json:"create_time"`
|
||||
UpdateTime *time.Time `orm:"column(update_time);type(datetime);null" json:"update_time"`
|
||||
DeleteTime *time.Time `orm:"column(delete_time);type(datetime);null" json:"delete_time"`
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// =============================================================
|
||||
// 微信小程序配置(表结构见 docs/sql/create_wechat_mini_config.sql)
|
||||
//
|
||||
// 小程序与公众号是两套独立应用,AppID / AppSecret 不可混用,
|
||||
// 因此单独建表;AppSecret 以 AES-256-GCM 加密存储(复用 wechatmp 的密钥)。
|
||||
// =============================================================
|
||||
|
||||
// WechatMiniConfig 微信小程序配置 yz_platform_wechat_mini_config(单行)
|
||||
type WechatMiniConfig struct {
|
||||
ID uint64 `orm:"column(id);pk;auto" json:"id"`
|
||||
AppID string `orm:"column(app_id);size(64)" json:"app_id"`
|
||||
AppSecret string `orm:"column(app_secret);size(512)" json:"-"` // 加密存储,不回显
|
||||
Enabled int8 `orm:"column(enabled);default(0)" json:"enabled"`
|
||||
AutoBind int8 `orm:"column(auto_bind);default(1)" json:"auto_bind"` // 1:手机号命中身份后自动绑定小程序
|
||||
Remark string `orm:"column(remark);size(255)" json:"remark"`
|
||||
CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
|
||||
UpdateTime *time.Time `orm:"column(update_time);type(datetime);null" json:"update_time"`
|
||||
}
|
||||
|
||||
func (m *WechatMiniConfig) TableName() string { return "yz_platform_wechat_mini_config" }
|
||||
Reference in new issue
Block a user