mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2026-01-09 13:28:20 +00:00
新增cool-un支持
This commit is contained in:
parent
4fd01dbf43
commit
f60525f12b
53
src/app/modules/base/controller/app/comm.ts
Normal file
53
src/app/modules/base/controller/app/comm.ts
Normal 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());
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user