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
bcdba582
Commit
bcdba582
authored
Nov 10, 2020
by
maggie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复无参数装饰器编译
parent
f24c72a9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
9 deletions
+10
-9
generate.js
v2.0/compileServer/generate.js
+1
-1
macro.njk
v2.0/compileServer/templates/macro.njk
+4
-4
task.controller.ts
v2.0/src/controller/common/task.controller.ts
+4
-4
test1.controller.ts
v2.0/src/controller/custom/test1.controller.ts
+1
-0
No files found.
v2.0/compileServer/generate.js
View file @
bcdba582
...
...
@@ -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
}
...
...
v2.0/compileServer/templates/macro.njk
View file @
bcdba582
...
...
@@ -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 %}
...
...
v2.0/src/controller/common/task.controller.ts
View file @
bcdba582
...
...
@@ -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
>
,
...
...
v2.0/src/controller/custom/test1.controller.ts
View file @
bcdba582
...
...
@@ -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
>
,
...
...
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