package eta import ( "eta/eta_bridge/global" "time" ) // SysThirdSession // @Description: 第三方登录会话session type SysThirdSession struct { ID uint64 `gorm:"primaryKey;column:id"` SysUserID uint64 `gorm:"column:sys_user_id"` UserName string `gorm:"column:user_name"` AccessToken string `gorm:"index:access_token;column:access_token"` ThirdAccessToken string `gorm:"index:third_access_token;column:third_access_token"` //ThirdRefreshToken string `gorm:"column:third_refresh_token"` ThirdExpiredTime time.Time `gorm:"column:third_expired_time"` CreatedTime time.Time `gorm:"index:created_time;column:created_time"` LastUpdatedTime time.Time `gorm:"index:last_updated_time;column:last_updated_time"` } func (m *SysThirdSession) TableName() string { return "sys_third_session" } // AddSysThirdSession 新增第三方的session func AddSysThirdSession(item *SysThirdSession) (err error) { err = global.MYSQL["hz_eta"].Create(item).Error return } // GetSysThirdSessionByToken 根据Token获取第三方session func GetSysThirdSessionByToken(token string) (item *SysThirdSession, err error) { err = global.MYSQL["hz_eta"].Where("access_token = ? AND expired_time > NOW()", token).Order("expired_time DESC").First(&item).Error return }