最新7.X 配置多数据源,报错
Ganshixiong opened this issue · comments
src/config/config.local.ts
错误信息
把eps关闭或者只使用一个数据源的时候不会出现路由重复定义错误
baseCommController类代码如下:(下载下来的示例代码,为进行更改)
import { Provide, Inject, Get, Post, Body, ALL } from '@midwayjs/decorator';
import { CoolController, BaseController } from '@cool-midway/core';
import { BaseSysUserEntity } from '../../entity/sys/user';
import { BaseSysLoginService } from '../../service/sys/login';
import { BaseSysPermsService } from '../../service/sys/perms';
import { BaseSysUserService } from '../../service/sys/user';
import { Context } from '@midwayjs/koa';
import { PluginService } from '../../../plugin/service/info';
/**
- Base 通用接口 一般写不需要权限过滤的接口
*/
@provide()
@CoolController()
export class BaseCommController extends BaseController {
@Inject()
baseSysUserService: BaseSysUserService;
@Inject()
baseSysPermsService: BaseSysPermsService;
@Inject()
baseSysLoginService: BaseSysLoginService;
@Inject()
ctx: Context;
@Inject()
pluginService: PluginService;
/**
- 获得个人信息
*/
@get('/person', { summary: '个人信息' })
async person() {
return this.ok(await this.baseSysUserService.person());
}
/**
- 修改个人信息
*/
@post('/personUpdate', { summary: '修改个人信息' })
async personUpdate(@Body(ALL) user: BaseSysUserEntity) {
await this.baseSysUserService.personUpdate(user);
return this.ok();
}
/**
- 权限菜单
*/
@get('/permmenu', { summary: '权限与菜单' })
async permmenu() {
return this.ok(
await this.baseSysPermsService.permmenu(this.ctx.admin.roleIds)
);
}
/**
- 文件上传
*/
@post('/upload', { summary: '文件上传' })
async upload() {
const file = await this.pluginService.getInstance('upload');
return this.ok(await file.upload(this.ctx));
}
/**
- 文件上传模式,本地或者云存储
*/
@get('/uploadMode', { summary: '文件上传模式' })
async uploadMode() {
const file = await this.pluginService.getInstance('upload');
return this.ok(await file.getMode());
}
/**
- 退出
*/
@post('/logout', { summary: '退出' })
async logout() {
await this.baseSysLoginService.logout();
return this.ok();
}
}
已修复更新 "@cool-midway/core": "^7.1.10"