新增cool-un支持

This commit is contained in:
ap 2021-12-20 18:12:10 +08:00
parent 4fd01dbf43
commit f60525f12b
2 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,53 @@
import { Provide, Inject, Get, Post } from '@midwayjs/decorator';
import {
CoolController,
BaseController,
ICoolCache,
ICoolFile,
} from '@cool-midway/core';
import { Context } from 'egg';
/**
*
*/
@Provide()
@CoolController()
export class BaseAppCommController extends BaseController {
@Inject('cool:eps:open')
eps;
@Inject('cool:cache')
coolCache: ICoolCache;
@Inject('cool:file')
coolFile: ICoolFile;
@Inject()
ctx: Context;
/**
*
* @returns
*/
@Get('/eps', { summary: '实体信息与路径' })
public async getEps() {
console.log(this.coolCache.getMode());
return this.ok(this.eps);
}
/**
*
*/
@Post('/upload', { summary: '文件上传' })
async upload() {
return this.ok(await this.coolFile.upload(this.ctx));
}
/**
*
*/
@Get('/uploadMode', { summary: '文件上传模式' })
async uploadMode() {
return this.ok(this.coolFile.getMode());
}
}