From af0ee28433ce63e0ce0d84929fd2958552b12b00 Mon Sep 17 00:00:00 2001 From: cool Date: Sat, 16 Mar 2024 16:09:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BC=93=E5=AD=98=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin-cli/package.json | 7 ++++--- plugin-cli/src/index.ts | 9 ++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/plugin-cli/package.json b/plugin-cli/package.json index 11a9e61..40ab7b0 100644 --- a/plugin-cli/package.json +++ b/plugin-cli/package.json @@ -1,6 +1,6 @@ { "name": "@cool-midway/plugin-cli", - "version": "7.1.3", + "version": "7.1.4", "description": "cool-admin midway plugin", "main": "dist/index.js", "scripts": { @@ -22,7 +22,8 @@ "readme": "README.md", "license": "MIT", "dependencies": { - "@midwayjs/core": "^3.14.0", + "@midwayjs/cache-manager": "^3.15.2", + "@midwayjs/core": "^3.15.0", "archiver": "^6.0.1", "esbuild": "^0.19.11", "esbuild-plugin-copy": "^2.1.1" @@ -30,4 +31,4 @@ "devDependencies": { "typescript": "^5.3.3" } -} \ No newline at end of file +} diff --git a/plugin-cli/src/index.ts b/plugin-cli/src/index.ts index 53a7107..457d3f6 100644 --- a/plugin-cli/src/index.ts +++ b/plugin-cli/src/index.ts @@ -1,3 +1,4 @@ +import { MidwayCache } from "@midwayjs/cache-manager"; import { IMidwayContext, IMidwayApplication } from "@midwayjs/core"; // 文件上传 @@ -46,6 +47,8 @@ export abstract class BasePlugin { ctx: IMidwayContext; /** 应用实例,用到此项无法本地调试,需安装到cool-admin中才能调试 */ app: IMidwayApplication; + /** 缓存 */ + cache: MidwayCache; setCtx(ctx: IMidwayContext) { this.ctx = ctx; @@ -66,10 +69,14 @@ export abstract class BasePlugin { async init( pluginInfo: PluginInfo, ctx?: IMidwayContext, - app?: IMidwayApplication + app?: IMidwayApplication, + other?: any ) { this.pluginInfo = pluginInfo; this.ctx = ctx; this.app = app; + if (other) { + this.cache = other.cache; + } } }