mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2024-11-01 14:10:29 +08:00
urltag
This commit is contained in:
parent
206151a016
commit
5023b904e2
@ -1,11 +1,19 @@
|
|||||||
|
import { CoolUrlTagData, TagTypes } from '@cool-midway/core';
|
||||||
import { IMiddleware } from '@midwayjs/core';
|
import { IMiddleware } from '@midwayjs/core';
|
||||||
import { Middleware } from '@midwayjs/decorator';
|
import { Inject, Middleware } from '@midwayjs/decorator';
|
||||||
import { NextFunction, Context } from '@midwayjs/koa';
|
import { NextFunction, Context } from '@midwayjs/koa';
|
||||||
|
|
||||||
@Middleware()
|
@Middleware()
|
||||||
export class DemoMiddleware implements IMiddleware<Context, NextFunction> {
|
export class DemoMiddleware implements IMiddleware<Context, NextFunction> {
|
||||||
|
@Inject()
|
||||||
|
tag: CoolUrlTagData;
|
||||||
|
|
||||||
resolve() {
|
resolve() {
|
||||||
return async (ctx: Context, next: NextFunction) => {
|
return async (ctx: Context, next: NextFunction) => {
|
||||||
|
const urls = this.tag.byKey(TagTypes.IGNORE_TOKEN);
|
||||||
|
|
||||||
|
console.log('忽略token的URL数组', urls);
|
||||||
|
|
||||||
// 控制器前执行的逻辑
|
// 控制器前执行的逻辑
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
// 执行下一个 Web 中间件,最后执行到控制器
|
// 执行下一个 Web 中间件,最后执行到控制器
|
||||||
|
Loading…
Reference in New Issue
Block a user