Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinhaitao
taobao-mini-template
Commits
200a5129
Commit
200a5129
authored
Nov 17, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:
🐛
bug
parent
0943e0a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
config.json
v2.0/compileServer/config.json
+1
-1
controller.njk
v2.0/compileServer/templates/controller.njk
+1
-0
macro.njk
v2.0/compileServer/templates/macro.njk
+13
-3
No files found.
v2.0/compileServer/config.json
View file @
200a5129
...
@@ -155,7 +155,7 @@
...
@@ -155,7 +155,7 @@
{
{
"type"
:
"common"
,
"type"
:
"common"
,
"behave"
:
"check"
,
"behave"
:
"check"
,
"name"
:
"checkActivityTime"
,
"name"
:
"checkActivityTime"
},
},
{
{
...
...
v2.0/compileServer/templates/controller.njk
View file @
200a5129
...
@@ -25,6 +25,7 @@ export default class {{name | capitalize}}Controller {
...
@@ -25,6 +25,7 @@ export default class {{name | capitalize}}Controller {
*/
*/
{{-macro.genDecorator(model[fn].decorators)}}
{{-macro.genDecorator(model[fn].decorators)}}
@services([{{-macro.genServicesDecorator(model[fn].main)}}])
@services([{{-macro.genServicesDecorator(model[fn].main)}}])
{{-macro.genPreDecorator(model[fn].decorators)}}
async {{fn}}(
async {{fn}}(
context: IContext<IParams>,
context: IContext<IParams>,
{ activityInfo, userInfo{{-macro.genRegisteInfosParams(model[fn].decorators)}} }: IControllerInfos,
{ activityInfo, userInfo{{-macro.genRegisteInfosParams(model[fn].decorators)}} }: IControllerInfos,
...
...
v2.0/compileServer/templates/macro.njk
View file @
200a5129
...
@@ -8,13 +8,23 @@ import { {%for service, service_item in type_item %}{{type|capitalize}}{{service
...
@@ -8,13 +8,23 @@ import { {%for service, service_item in type_item %}{{type|capitalize}}{{service
{# 生成装饰器 #}
{# 生成装饰器 #}
{% macro genDecorator(decorators) %}
{% macro genDecorator(decorators) %}
{%- for decorator in decorators %}
{%- for decorator in decorators %}
{%- if decorator.name != 'preCheck' and decorator.name != 'preUpdate' %}
@{{ decorator.name }}
@{{ decorator.name }}
{%- if decorator.name == 'preCheck' or decorator.name == 'preUpdate' -%}
{%- if decorator.name == 'noCatch' or decorator.name == 'noCheckUser' -%}
([{%- for param in decorator.params -%}{{param.name}}{%- if param.params %}({%- for utilParam in param.params -%}{{utilParam}}{%- if loop.last %}{% else %}, {% endif %}{%- endfor -%}){% endif %}{%- if loop.last %}{% else %}, {% endif %}{%- endfor -%}])
{%- elif decorator.name == 'noCatch' or decorator.name == 'noCheckUser' -%}
{%- else -%}
{%- else -%}
([{%- for param in decorator.params -%}'{{ param }}'{%- if loop.last %}{% else %}, {% endif %}{%- endfor -%}])
([{%- for param in decorator.params -%}'{{ param }}'{%- if loop.last %}{% else %}, {% endif %}{%- endfor -%}])
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{% endmacro %}
{# 生成装饰器 #}
{% macro genPreDecorator(decorators) %}
{%- for decorator in decorators %}
{%- if decorator.name == 'preCheck' or decorator.name == 'preUpdate' -%}
@{{ decorator.name }}
([{%- for param in decorator.params -%}{{param.name}}{%- if param.params %}({%- for utilParam in param.params -%}{{utilParam}}{%- if loop.last %}{% else %}, {% endif %}{%- endfor -%}){% endif %}{%- if loop.last %}{% else %}, {% endif %}{%- endfor -%}])
{%- endif -%}
{%- endfor -%}
{%- endfor -%}
{% endmacro %}
{% endmacro %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment