Commit 200a5129 authored by qinhaitao's avatar qinhaitao

fix: 🐛 bug

parent 0943e0a6
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
{ {
"type": "common", "type": "common",
"behave": "check", "behave": "check",
"name": "checkActivityTime", "name": "checkActivityTime"
}, },
{ {
......
...@@ -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,
......
...@@ -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 %}
......
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