适配新版配套中间件

master
yutent 2025-01-07 14:46:08 +08:00
parent b2de266b92
commit edbe01b3e1
1 changed files with 6 additions and 6 deletions

View File

@ -12,7 +12,7 @@ export function createRouter() {
let dynamic = this.get('dynamic')
let name = dynamic ? 'index' : req.controller
let ModuleController = this.$load(name)
let paths = req.path.concat()
let actions = req.actions.concat()
// 1. 先判断控制器是否存在
if (!ModuleController) {
@ -20,8 +20,8 @@ export function createRouter() {
}
// 2. 默认二级路由为index
if (paths.length < 1 && dynamic === false) {
paths.push('index')
if (actions.length < 1 && dynamic === false) {
actions.push('index')
}
// 3. 实例化控制器
@ -49,13 +49,13 @@ export function createRouter() {
}
if (dynamic) {
return ctrol.indexAction.apply(ctrol, paths)
return ctrol.indexAction.apply(ctrol, actions)
} else {
route = paths.shift()
route = actions.shift()
act = route + 'Action'
if (ctrol[act]) {
return ctrol[act].apply(ctrol, paths)
return ctrol[act].apply(ctrol, actions)
} else {
err = new Error(`Action [${route}] not found`)
err.status = 404