|
@@ -1,8 +1,9 @@
|
|
-import { Controller, Get, Inject } from '@midwayjs/core';
|
|
|
|
|
|
+import { Body, Controller, Get, Inject, Post } from '@midwayjs/core';
|
|
import { InitSystemDataService } from '../service/initData/initSystemData.service';
|
|
import { InitSystemDataService } from '../service/initData/initSystemData.service';
|
|
import { DataDealService } from '../service/initData/dataDeal.service';
|
|
import { DataDealService } from '../service/initData/dataDeal.service';
|
|
import { NeedAdminMiddleware } from '../middleware/needAdmin.middleware';
|
|
import { NeedAdminMiddleware } from '../middleware/needAdmin.middleware';
|
|
import { ESService } from '../service/elasticsearch/es.service';
|
|
import { ESService } from '../service/elasticsearch/es.service';
|
|
|
|
+import { DbBackupService } from '../service/dbBackup.service';
|
|
|
|
|
|
/**所有的操作都不需要await.目前是 下达一个无监控的任务进程 */
|
|
/**所有的操作都不需要await.目前是 下达一个无监控的任务进程 */
|
|
@Controller('/system/func', { middleware: [NeedAdminMiddleware] })
|
|
@Controller('/system/func', { middleware: [NeedAdminMiddleware] })
|
|
@@ -13,41 +14,54 @@ export class SystemFuncController {
|
|
DataDeal: DataDealService;
|
|
DataDeal: DataDealService;
|
|
@Inject()
|
|
@Inject()
|
|
es: ESService;
|
|
es: ESService;
|
|
|
|
+ @Inject()
|
|
|
|
+ dbBackUp: DbBackupService;
|
|
|
|
+
|
|
|
|
+ @Post('/dbRestore', { routerName: `还原数据库` })
|
|
|
|
+ async dbRestore(@Body('path') path: string) {
|
|
|
|
+ this.dbBackUp.restore(path);
|
|
|
|
+ return 'ok'
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Get('/dbBackUp', { routerName: `备份数据库` })
|
|
|
|
+ async dbBackUpIntoJson() {
|
|
|
|
+ await this.dbBackUp.getTables();
|
|
|
|
+ }
|
|
|
|
|
|
@Get('/')
|
|
@Get('/')
|
|
async index() {
|
|
async index() {
|
|
console.log('in');
|
|
console.log('in');
|
|
}
|
|
}
|
|
|
|
|
|
- @Get('/initES')
|
|
|
|
|
|
+ @Get('/initES', { routerName: `初始化es索引及数据` })
|
|
async initES() {
|
|
async initES() {
|
|
this.es.initES();
|
|
this.es.initES();
|
|
}
|
|
}
|
|
|
|
|
|
/**修正导入的数据为 richText的数据 */
|
|
/**修正导入的数据为 richText的数据 */
|
|
- @Get('/cid')
|
|
|
|
|
|
+ @Get('/cid', { routerName: `修正数据` })
|
|
async correctImportData() {
|
|
async correctImportData() {
|
|
this.DataDeal.correctImportData();
|
|
this.DataDeal.correctImportData();
|
|
}
|
|
}
|
|
|
|
|
|
/**初始化后台目录 */
|
|
/**初始化后台目录 */
|
|
- @Get('/ism')
|
|
|
|
|
|
+ @Get('/ism', { routerName: `初始化后台目录` })
|
|
async initSystemMenus() {
|
|
async initSystemMenus() {
|
|
this.InitSystemData.initSystemMenus();
|
|
this.InitSystemData.initSystemMenus();
|
|
}
|
|
}
|
|
|
|
|
|
/**初始化用户目录 */
|
|
/**初始化用户目录 */
|
|
- @Get('/ium')
|
|
|
|
|
|
+ @Get('/ium', { routerName: `初始化用户目录` })
|
|
async initUserMenus() {
|
|
async initUserMenus() {
|
|
this.InitSystemData.initUserMenus();
|
|
this.InitSystemData.initUserMenus();
|
|
}
|
|
}
|
|
/**初始化角色数据 */
|
|
/**初始化角色数据 */
|
|
- @Get('/ir')
|
|
|
|
|
|
+ @Get('/ir', { routerName: `初始化角色数据` })
|
|
async initRoleData() {
|
|
async initRoleData() {
|
|
this.InitSystemData.initRoleData();
|
|
this.InitSystemData.initRoleData();
|
|
}
|
|
}
|
|
/**初始化角色的菜单(不包含管理员) */
|
|
/**初始化角色的菜单(不包含管理员) */
|
|
- @Get('/irm')
|
|
|
|
|
|
+ @Get('/irm', { routerName: `初始化角色菜单` })
|
|
async initRoleMenus() {
|
|
async initRoleMenus() {
|
|
this.InitSystemData.initRoleMenus();
|
|
this.InitSystemData.initRoleMenus();
|
|
}
|
|
}
|