mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2024-11-01 22:20:30 +08:00
优化类型提示
This commit is contained in:
parent
c4b1de03f6
commit
56c288324b
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cool-midway/core",
|
||||
"version": "6.0.2",
|
||||
"version": "6.0.3",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -63,7 +63,7 @@ export interface CoolConfig {
|
||||
qiniu?: QINIUConfig;
|
||||
};
|
||||
/** IOT 配置 */
|
||||
iot: CoolIotConfig;
|
||||
iot?: CoolIotConfig;
|
||||
}
|
||||
|
||||
export interface CoolRpcConfig {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cool-midway/core",
|
||||
"version": "6.0.2",
|
||||
"version": "6.0.3",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { App, Config, Inject, Middleware } from '@midwayjs/decorator';
|
||||
import * as _ from 'lodash';
|
||||
import { RESCODE } from '@cool-midway/core';
|
||||
import { CoolCommException, RESCODE } from '@cool-midway/core';
|
||||
import * as jwt from 'jsonwebtoken';
|
||||
import { NextFunction, Context } from '@midwayjs/koa';
|
||||
import { IMiddleware, IMidwayApplication } from '@midwayjs/core';
|
||||
@ -38,7 +38,10 @@ export class BaseAuthorityMiddleware
|
||||
if (_.startsWith(url, adminUrl)) {
|
||||
try {
|
||||
ctx.admin = jwt.verify(token, this.jwtConfig.jwt.secret);
|
||||
} catch (err) {}
|
||||
} catch (err) {
|
||||
throw new CoolCommException('登录失效~');
|
||||
}
|
||||
if (ctx.admin.isRefresh) throw new CoolCommException('登录失效~');
|
||||
// 不需要登录 无需权限校验
|
||||
if (
|
||||
new RegExp(`^${adminUrl}?.*/open/`).test(url) ||
|
||||
|
Loading…
Reference in New Issue
Block a user