remove
This commit is contained in:
@@ -9,7 +9,7 @@ import { checkAuth, getLoginUser } from './middleware/auth-manual.ts';
|
||||
export { User, Org, UserServices, UserInit, OrgInit, UserModel, OrgModel, UserSecret, UserSecretInit };
|
||||
|
||||
/**
|
||||
* 可以不需要user成功, 有则赋值,交给下一个中间件
|
||||
* 可以不需要user成功, 有则赋值,没有则无所谓,交给下一个中间件
|
||||
*/
|
||||
export const authCan = 'auth-can';
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,23 @@ import { OauthUser } from '@/oauth/oauth.ts';
|
||||
export const redis = useContextKey<Redis>('redis');
|
||||
|
||||
const UserSecretStatus = ['active', 'inactive', 'expired'] as const;
|
||||
|
||||
type Data = {
|
||||
[key: string]: any;
|
||||
/**
|
||||
* 微信开放平台的某一个应用的openid
|
||||
*/
|
||||
wxOpenid?: string;
|
||||
/**
|
||||
* 微信开放平台的unionid:主要
|
||||
*/
|
||||
wxUnionid?: string;
|
||||
/**
|
||||
* 微信公众号的openid:次要
|
||||
*/
|
||||
wxmpOpenid?: string;
|
||||
|
||||
}
|
||||
export class UserSecret extends Model {
|
||||
static oauth = oauth;
|
||||
declare id: string;
|
||||
@@ -18,7 +35,7 @@ export class UserSecret extends Model {
|
||||
declare description: string;
|
||||
declare status: (typeof UserSecretStatus)[number];
|
||||
declare expiredTime: Date;
|
||||
declare data: any;
|
||||
declare data: Data;
|
||||
/**
|
||||
* 验证token
|
||||
* @param token
|
||||
@@ -44,9 +61,6 @@ export class UserSecret extends Model {
|
||||
if (userSecret.status !== 'active') {
|
||||
return null; // 如果用户密钥状态不是active,则返回null
|
||||
}
|
||||
if (!userSecret.token) {
|
||||
return null; // 如果用户密钥没有token,则返回null
|
||||
}
|
||||
// 如果用户密钥未过期,则返回用户信息
|
||||
const oauthUser = await userSecret.getOauthUser();
|
||||
if (!oauthUser) {
|
||||
|
||||
Reference in New Issue
Block a user