Files
2026-10-03 23:46:55 +08:00

27 lines
1.4 KiB
Go

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" }