Commit e1c91c2d authored by qinhaitao's avatar qinhaitao

perf: ️ 优化结构

parent ff6eea1d
...@@ -139,6 +139,7 @@ const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => { ...@@ -139,6 +139,7 @@ const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => {
//编译controller.common //编译controller.common
for (let commonController in config.controllers.common) { for (let commonController in config.controllers.common) {
const controller = config.controllers.common[commonController]
await gulp await gulp
.src(`${serverTemplatePath}/controller.njk`) .src(`${serverTemplatePath}/controller.njk`)
.pipe( .pipe(
...@@ -146,14 +147,14 @@ const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => { ...@@ -146,14 +147,14 @@ const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => {
...nunjucksRenderConfig, ...nunjucksRenderConfig,
data: { data: {
name: commonController, name: commonController,
model: config.controllers.common[commonController], model: controller,
...controllerImport(config.controllers.common[commonController]), ...controllerImport(controller),
commmonDecorators: getDecorators(config.controllers.common[commonController], 'common'), commmonDecorators: getDecorators(controller, 'common'),
customDecorators: getDecorators(config.controllers.common[commonController], 'custom'), customDecorators: getDecorators(controller, 'custom'),
commonPreChecks: getPreChecks(config.controllers.common[commonController], 'common'), commonPreChecks: getPreChecks(controller, 'common'),
customPreChecks: getPreChecks(config.controllers.common[commonController], 'custom'), customPreChecks: getPreChecks(controller, 'custom'),
commonPreUpdates: getPreUpdates(config.controllers.common[commonController], 'common'), commonPreUpdates: getPreUpdates(controller, 'common'),
customPreUpdates: getPreUpdates(config.controllers.common[commonController], 'custom') customPreUpdates: getPreUpdates(controller, 'custom')
} }
}) })
) )
...@@ -162,6 +163,7 @@ const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => { ...@@ -162,6 +163,7 @@ const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => {
} }
//编译controller.custom //编译controller.custom
for (let customController in config.controllers.custom) { for (let customController in config.controllers.custom) {
const controller = config.controllers.custom[customController]
await gulp await gulp
.src(`${serverTemplatePath}/controller.njk`) .src(`${serverTemplatePath}/controller.njk`)
.pipe( .pipe(
...@@ -169,14 +171,14 @@ const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => { ...@@ -169,14 +171,14 @@ const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => {
...nunjucksRenderConfig, ...nunjucksRenderConfig,
data: { data: {
name: customController, name: customController,
model: config.controllers.custom[customController], model: controller,
...controllerImport(config.controllers.custom[customController]), ...controllerImport(controller),
commmonDecorators: getDecorators(config.controllers.custom[customController], 'common'), commmonDecorators: getDecorators(controller, 'common'),
customDecorators: getDecorators(config.controllers.custom[customController], 'custom'), customDecorators: getDecorators(controller, 'custom'),
commonPreChecks: getPreChecks(config.controllers.custom[customController], 'common'), commonPreChecks: getPreChecks(controller, 'common'),
customPreChecks: getPreChecks(config.controllers.custom[customController], 'custom'), customPreChecks: getPreChecks(controller, 'custom'),
commonPreUpdates: getPreUpdates(config.controllers.custom[customController], 'common'), commonPreUpdates: getPreUpdates(controller, 'common'),
customPreUpdates: getPreUpdates(config.controllers.custom[customController], 'custom') customPreUpdates: getPreUpdates(controller, 'custom')
} }
}) })
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment