Commit bcdba582 authored by maggie's avatar maggie

修复无参数装饰器编译

parent f24c72a9
......@@ -33,7 +33,7 @@ const customFileMap = (controllers = {}) => {
if (decorator.type === 'custom') {
result.decorators[decorator.name] = true
}
for (let util of decorator.params) {
for (let util of decorator.params || []) {
if (util.type && util.type === 'custom') {
result.utils[util.name] = true
}
......
......@@ -8,13 +8,13 @@ import { {%for service, service_item in type_item %}{{type|capitalize}}{{service
{# 生成装饰器 #}
{% macro genDecorator(decorators) %}
{%- for decorator in decorators %}
@{{ decorator.type }}Decorator.{{ decorator.name }}([
@{{ decorator.type }}Decorator.{{ decorator.name }}
{%- if decorator.name == 'preCheck' or decorator.name == 'preUpdate' -%}
{%- for param in decorator.params -%}{{param.type}}Util{{param.behave | capitalize}}.{{param.name}}{%- if loop.last %}{% else %}, {% endif %}{%- endfor -%}
([{%- for param in decorator.params -%}{{param.type}}Util{{param.behave | capitalize}}.{{param.name}}{%- if loop.last %}{% else %}, {% endif %}{%- endfor -%})]
{%- elif decorator.name == 'noCatch' or decorator.name == 'noCheckUser' -%}
{%- 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 -%}
])
{%- endfor -%}
{% endmacro %}
......
......@@ -15,8 +15,8 @@ export default class TaskController {
*/
@commonDecorator.checkParams(['activityId'])
@commonDecorator.registeInfos(['vipInfo'])
@commonDecorator.preCheck([commonUtilCheck.checkActivityTime])
@commonDecorator.preUpdate([commonUtilUpdate.updateVip, commonUtilUpdate.updateSignTask, commonUtilUpdate.updateOrderGoods])
@commonDecorator.preCheck([commonUtilCheck.checkActivityTime)]
@commonDecorator.preUpdate([commonUtilUpdate.updateVip, commonUtilUpdate.updateSignTask, commonUtilUpdate.updateOrderGoods)]
@services([CommonTaskService])
async getTaskList(
context: IContext<IParams>,
......@@ -33,7 +33,7 @@ export default class TaskController {
*/
@commonDecorator.checkParams(['activityId', 'taskType'])
@commonDecorator.registeInfos(['session'])
@commonDecorator.preCheck([commonUtilCheck.checkActivityTime, commonUtilCheck.checkTaskLimit, commonUtilCheck.checkExchangeCreditsTask])
@commonDecorator.preCheck([commonUtilCheck.checkActivityTime, commonUtilCheck.checkTaskLimit, commonUtilCheck.checkExchangeCreditsTask)]
@services([CommonTaskService])
async doCompleteTask(
context: IContext<IParams>,
......@@ -49,7 +49,7 @@ export default class TaskController {
* 领取任务奖励
*/
@commonDecorator.checkParams(['activityId', 'taskType', 'rewardsKey'])
@commonDecorator.preCheck([commonUtilCheck.checkActivityTime, commonUtilCheck.checkRemainTimes])
@commonDecorator.preCheck([commonUtilCheck.checkActivityTime, commonUtilCheck.checkRemainTimes)]
@services([CommonTaskService])
async receiveTaskRewards(
context: IContext<IParams>,
......
......@@ -17,6 +17,7 @@ export default class Test1Controller {
*/
@commonDecorator.checkParams(['activityId', 'type'])
@customDecorator.test1(['tt'])
@commonDecorator.noCatch
@services([CommonStatService, CustomTestService])
async addStat(
context: IContext<IParams>,
......
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