Commit e1c91c2d authored by qinhaitao's avatar qinhaitao

perf: ️ 优化结构

parent ff6eea1d
......@@ -139,6 +139,7 @@ const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => {
//编译controller.common
for (let commonController in config.controllers.common) {
const controller = config.controllers.common[commonController]
await gulp
.src(`${serverTemplatePath}/controller.njk`)
.pipe(
......@@ -146,14 +147,14 @@ const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => {
...nunjucksRenderConfig,
data: {
name: commonController,
model: config.controllers.common[commonController],
...controllerImport(config.controllers.common[commonController]),
commmonDecorators: getDecorators(config.controllers.common[commonController], 'common'),
customDecorators: getDecorators(config.controllers.common[commonController], 'custom'),
commonPreChecks: getPreChecks(config.controllers.common[commonController], 'common'),
customPreChecks: getPreChecks(config.controllers.common[commonController], 'custom'),
commonPreUpdates: getPreUpdates(config.controllers.common[commonController], 'common'),
customPreUpdates: getPreUpdates(config.controllers.common[commonController], 'custom')
model: controller,
...controllerImport(controller),
commmonDecorators: getDecorators(controller, 'common'),
customDecorators: getDecorators(controller, 'custom'),
commonPreChecks: getPreChecks(controller, 'common'),
customPreChecks: getPreChecks(controller, 'custom'),
commonPreUpdates: getPreUpdates(controller, 'common'),
customPreUpdates: getPreUpdates(controller, 'custom')
}
})
)
......@@ -162,6 +163,7 @@ const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => {
}
//编译controller.custom
for (let customController in config.controllers.custom) {
const controller = config.controllers.custom[customController]
await gulp
.src(`${serverTemplatePath}/controller.njk`)
.pipe(
......@@ -169,14 +171,14 @@ const run = async (gulp, nunjucksRender, rename, nunjucksRenderConfig) => {
...nunjucksRenderConfig,
data: {
name: customController,
model: config.controllers.custom[customController],
...controllerImport(config.controllers.custom[customController]),
commmonDecorators: getDecorators(config.controllers.custom[customController], 'common'),
customDecorators: getDecorators(config.controllers.custom[customController], 'custom'),
commonPreChecks: getPreChecks(config.controllers.custom[customController], 'common'),
customPreChecks: getPreChecks(config.controllers.custom[customController], 'custom'),
commonPreUpdates: getPreUpdates(config.controllers.custom[customController], 'common'),
customPreUpdates: getPreUpdates(config.controllers.custom[customController], 'custom')
model: controller,
...controllerImport(controller),
commmonDecorators: getDecorators(controller, 'common'),
customDecorators: getDecorators(controller, 'custom'),
commonPreChecks: getPreChecks(controller, 'common'),
customPreChecks: getPreChecks(controller, 'custom'),
commonPreUpdates: getPreUpdates(controller, 'common'),
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