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" } // WechatMiniApp 微信小程序(多应用) yz_platform_wechat_mini_app // 支持配置多个小程序:认证端登录时按客户端传入的 appid 精确匹配 // (未传 appid 时回退第一条启用记录),AppSecret 加密存储不回显。 type WechatMiniApp struct { ID uint64 `orm:"column(id);pk;auto" json:"id"` Name string `orm:"column(name);size(128);default('')" json:"name"` 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"` DeleteTime *time.Time `orm:"column(delete_time);type(datetime);null" json:"delete_time"` } func (m *WechatMiniApp) TableName() string { return "yz_platform_wechat_mini_app" }