兼容serverless部署,修改插件配置无需重启

This commit is contained in:
ap 2021-03-10 00:57:33 +08:00
parent 5563a4adbf
commit a59308fc6f
12 changed files with 90 additions and 86 deletions

4
f.yml
View File

@ -6,3 +6,7 @@ provider:
memorySize: 512
deployType: egg ## 部署的应用类型
package:
include:
- public/*

View File

@ -15,6 +15,7 @@
"lodash": "^4.17.21",
"md5": "^2.3.0",
"midwayjs-cool-core": "/Users/ap/Documents/srcs/cool-admin/midway-core/core/dist",
"midwayjs-cool-oss": "/Users/ap/Documents/srcs/cool-admin/midway-core/oss/dist",
"midwayjs-cool-redis": "/Users/ap/Documents/srcs/cool-admin/midway-core/redis/dist",
"midwayjs-cool-wxpay": "^1.0.10",
"mysql2": "^2.2.5",

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

1
public/uploads/说明.md Normal file
View File

@ -0,0 +1 @@
文件上传目录

View File

@ -55,9 +55,7 @@ export class BaseAuthorityMiddleware implements IWebMiddleware {
return;
}
// 需要动态获得缓存
this.coolCache = await this.app
.getApplicationContext()
.getAsync('cool:cache');
this.coolCache = await ctx.requestContext.getAsync('cool:cache');
// 判断密码版本是否正确
const passwordV = await this.coolCache.get(
`admin:passwordVersion:${ctx.admin.userId}`

View File

@ -24,7 +24,7 @@ export default (appInfo: EggAppInfo) => {
// 靜態目錄及緩存設置
config.static = {
prefix: '/',
dir: path.join(appInfo.baseDir, 'app/public'),
dir: path.join(appInfo.baseDir, '..', 'public'),
dynamic: true,
preload: false,
// maxAge: 31536000,

View File

@ -4,7 +4,7 @@ import { Application } from 'egg';
import * as orm from '@midwayjs/orm';
import * as cool from 'midwayjs-cool-core';
import * as wxpay from 'midwayjs-cool-wxpay';
// import * as oss from 'midwayjs-cool-oss';
import * as oss from 'midwayjs-cool-oss';
import * as redis from 'midwayjs-cool-redis';
// import * as queue from 'midwayjs-cool-queue';
// import * as alipay from 'midwayjs-cool-alipay';
@ -18,7 +18,7 @@ import * as redis from 'midwayjs-cool-redis';
// 必须,不可移除, cool-admin 官方组件 https://www.cool-js.com
cool,
// oss插件需要到后台配置之后才有用默认是本地上传
//oss,
oss,
// 将缓存替换成redis
redis,
// 队列