Commit 200a5129 authored by qinhaitao's avatar qinhaitao

fix: 🐛 bug

parent 0943e0a6
......@@ -155,7 +155,7 @@
{
"type": "common",
"behave": "check",
"name": "checkActivityTime",
"name": "checkActivityTime"
},
{
......
......@@ -25,6 +25,7 @@ export default class {{name | capitalize}}Controller {
*/
{{-macro.genDecorator(model[fn].decorators)}}
@services([{{-macro.genServicesDecorator(model[fn].main)}}])
{{-macro.genPreDecorator(model[fn].decorators)}}
async {{fn}}(
context: IContext<IParams>,
{ activityInfo, userInfo{{-macro.genRegisteInfosParams(model[fn].decorators)}} }: IControllerInfos,
......
......@@ -8,13 +8,23 @@ import { {%for service, service_item in type_item %}{{type|capitalize}}{{service
{# 生成装饰器 #}
{% macro genDecorator(decorators) %}
{%- for decorator in decorators %}
{%- if decorator.name != 'preCheck' and decorator.name != 'preUpdate' %}
@{{ decorator.name }}
{%- if decorator.name == 'preCheck' or decorator.name == 'preUpdate' -%}
([{%- 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' -%}
{%- if decorator.name == 'noCatch' or decorator.name == 'noCheckUser' -%}
{%- else -%}
([{%- for param in decorator.params -%}'{{ param }}'{%- if loop.last %}{% else %}, {% endif %}{%- endfor -%}])
{%- 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 -%}
{% 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