add week
This commit is contained in:
parent
0c36328ac3
commit
60c5a986ed
@ -47,7 +47,7 @@ export class User extends Model {
|
||||
* @param uid
|
||||
* @returns
|
||||
*/
|
||||
async createToken(uid?: string, loginType?: 'default' | 'plugin' | 'month' | 'season' | 'year', expand: any = {}) {
|
||||
async createToken(uid?: string, loginType?: 'default' | 'plugin' | 'month' | 'season' | 'year' | 'week', expand: any = {}) {
|
||||
const { id, username, type } = this;
|
||||
const oauthUser: OauthUser = {
|
||||
id,
|
||||
|
@ -58,7 +58,7 @@ export type UserExpand = {
|
||||
} & StoreSetOpts;
|
||||
|
||||
type StoreSetOpts = {
|
||||
loginType?: 'default' | 'plugin' | 'month' | 'season' | 'year'; // 登陆类型 'default' | 'plugin' | 'month' | 'season' | 'year'
|
||||
loginType?: 'default' | 'plugin' | 'month' | 'season' | 'year' | 'week'; // 登陆类型 'default' | 'plugin' | 'month' | 'season' | 'year'
|
||||
expire?: number; // 过期时间,单位为秒
|
||||
hasRefreshToken?: boolean;
|
||||
[key: string]: any;
|
||||
@ -137,6 +137,9 @@ export class RedisTokenStore implements Store<OauthUser> {
|
||||
let expire = opts?.expire;
|
||||
if (!expire) {
|
||||
switch (opts.loginType) {
|
||||
case 'week':
|
||||
expire = 7 * 24 * 60 * 60;
|
||||
break;
|
||||
case 'month':
|
||||
expire = 30 * 24 * 60 * 60;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user