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
bd634c74
Commit
bd634c74
authored
Nov 11, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
🎸
config.json
parent
cde4439e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
257 additions
and
1 deletion
+257
-1
config.json
v2.0/compileServer/config.json
+236
-0
controller.njk
v2.0/compileServer/templates/controller.njk
+2
-1
macro.njk
v2.0/compileServer/templates/macro.njk
+19
-0
No files found.
v2.0/compileServer/config.json
View file @
bd634c74
...
...
@@ -416,6 +416,242 @@
}
]
}
},
"awards"
:
{
"getMyPrizeList"
:
{
"desc"
:
"我的奖品列表"
,
"decorators"
:
[
{
"type"
:
"common"
,
"name"
:
"checkParams"
,
"params"
:
[
"activityId"
]
}
],
"main"
:
[
{
"type"
:
"common"
,
"service"
:
"awards"
,
"function"
:
"getMyPrizeList"
,
"params"
:
[
{
"type"
:
"var"
,
"value"
:
"activityInfo"
}
],
"return"
:
true
}
]
},
"receiveObjectPrize"
:
{
"desc"
:
"领取实物"
,
"decorators"
:
[
{
"type"
:
"common"
,
"name"
:
"checkParams"
,
"params"
:
[
"activityId"
,
"id"
,
"name"
,
"phone"
,
"province"
,
"city"
,
"area"
,
"addressDetail"
,
"streetName"
]
},
{
"type"
:
"common"
,
"name"
:
"preCheck"
,
"params"
:
[
{
"type"
:
"common"
,
"behave"
:
"check"
,
"name"
:
"checkPrizeExpired"
},
{
"type"
:
"common"
,
"behave"
:
"check"
,
"name"
:
"checkValidObjectPrize"
}
]
}
],
"main"
:
[
{
"type"
:
"common"
,
"service"
:
"awards"
,
"function"
:
"recieveObjectPrize"
,
"params"
:
[
{
"type"
:
"var"
,
"value"
:
"context"
}
],
"return"
:
true
}
]
},
"receiveEnamePrize"
:
{
"desc"
:
"领取权益"
,
"decorators"
:
[
{
"type"
:
"common"
,
"name"
:
"checkParams"
,
"params"
:
[
"activityId"
,
"id"
]
},
{
"type"
:
"common"
,
"name"
:
"registeInfos"
,
"params"
:
[
"session"
]
},
{
"type"
:
"common"
,
"name"
:
"preCheck"
,
"params"
:
[
{
"type"
:
"common"
,
"behave"
:
"check"
,
"name"
:
"checkPrizeExpired"
},
{
"type"
:
"common"
,
"behave"
:
"check"
,
"name"
:
"checkValidEnamePrize"
}
]
}
],
"main"
:
[
{
"type"
:
"common"
,
"service"
:
"awards"
,
"function"
:
"recieveEnamePrize"
,
"params"
:
[
{
"type"
:
"var"
,
"value"
:
"context.data.id"
},
{
"type"
:
"var"
,
"value"
:
"awardInfo"
},
{
"type"
:
"var"
,
"value"
:
"session"
}
],
"return"
:
true
}
]
},
"drawLotteryPrize"
:
{
"desc"
:
"概率抽奖"
,
"decorators"
:
[
{
"type"
:
"common"
,
"name"
:
"checkParams"
,
"params"
:
[
"activityId"
,
"prizeDataType"
]
},
{
"type"
:
"common"
,
"name"
:
"registeInfos"
,
"params"
:
[
"session"
]
},
{
"type"
:
"common"
,
"name"
:
"preCheck"
,
"params"
:
[
{
"type"
:
"common"
,
"behave"
:
"check"
,
"name"
:
"checkActivityTime"
}
]
}
],
"main"
:
[
{
"type"
:
"common"
,
"service"
:
"awards"
,
"function"
:
"drawLottery"
,
"params"
:
[
{
"type"
:
"var"
,
"value"
:
"context.data.activityId"
},
{
"type"
:
"var"
,
"value"
:
"context.data.prizeDataType"
},
{
"type"
:
"var"
,
"value"
:
"userInfo"
}
],
"return"
:
true
}
]
}
},
"share"
:
{
"getShareInfo"
:
{
"desc"
:
"获取邀请信息"
,
"decorators"
:
[
{
"type"
:
"common"
,
"name"
:
"checkParams"
,
"params"
:
[
"activityId"
]
}
],
"main"
:
[
{
"type"
:
"common"
,
"service"
:
"user"
,
"function"
:
"queryDataByKey"
,
"params"
:
[
{
"value"
:
"remainTimes.invites"
},
{
"type"
:
"var"
,
"value"
:
"userInfo"
},
{
"value"
:
"rewards"
}
],
"return"
:
true
}
]
},
"doHelp"
:
{
"desc"
:
"完成分享"
,
"decorators"
:
[
{
"type"
:
"common"
,
"name"
:
"checkParams"
,
"params"
:
[
"activityId"
,
"inviteId"
]
},
{
"type"
:
"common"
,
"name"
:
"registeInfos"
,
"params"
:
[
"vipInfo"
]
},
{
"type"
:
"common"
,
"name"
:
"preCheck"
,
"params"
:
[
{
"type"
:
"common"
,
"behave"
:
"check"
,
"name"
:
"checkActivityTime"
},
{
"type"
:
"common"
,
"behave"
:
"check"
,
"name"
:
"checkInviteId"
},
{
"type"
:
"common"
,
"behave"
:
"check"
,
"name"
:
"checkNewVip"
},
{
"type"
:
"common"
,
"behave"
:
"check"
,
"name"
:
"checkHelpRecord"
}
]
}
],
"main"
:
[
{
"type"
:
"common"
,
"service"
:
"task"
,
"function"
:
"completeTask"
,
"params"
:
[
{
"value"
:
"invites"
},
{
"type"
:
"var"
,
"value"
:
"activityInfo"
},
{
"type"
:
"var"
,
"value"
:
"inviteUserInfo"
}
]
},
{
"type"
:
"common"
,
"service"
:
"stat"
,
"function"
:
"addStat"
,
"params"
:
[
{
"type"
:
"var"
,
"value"
:
"0"
},
{
"type"
:
"var"
,
"value"
:
"userInfo"
}
],
"return"
:
true
}
]
}
}
},
"custom"
:
{
...
...
v2.0/compileServer/templates/controller.njk
View file @
bd634c74
...
...
@@ -21,7 +21,8 @@ export default class {{name | capitalize}}Controller {
async {{fn}}(
context: IContext<IParams>,
{ activityInfo, userInfo{{-macro.genRegisteInfosParams(model[fn].decorators)}} }: IControllerInfos,
{{-macro.genServicesParams(model[fn].main)}}
{{-macro.genServicesParams(model[fn].main)-}},
{{-macro.genPreCheckDataParams(model[fn].decorators)-}}
) {
{{-macro.genMain(model[fn].main)}}
...
...
v2.0/compileServer/templates/macro.njk
View file @
bd634c74
...
...
@@ -58,6 +58,25 @@ import { {%for service, service_item in type_item %}{{type|capitalize}}{{service
{%- endfor -%}
{%- endmacro %}
{# 生成common preCheck返回数据 #}
{% macro genPreCheckDataParams(decorators) %}
{% set preChecks = {'checkInviteId':'inviteUserInfo','checkValidObjectPrize':'awardInfo','checkValidEnamePrize':'awardInfo'} -%}
{%- set preCheckData = [] -%}
{% for decorator in decorators -%}
{%- if decorator.type == 'common' and decorator.name== 'preCheck' -%}
{%- for param in decorator.params -%}
{%- for key, data in preChecks -%}
{%- if key === param.name%} {% set preCheckData = preCheckData.concat(data)%} {% endif %}
{%- endfor -%}
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{%- if preCheckData.length -%}
{ {{preCheckData | join(',')}} }: IPreCheckData
{% endif %}
{%- endmacro %}
{# 生成函数体 #}
{% macro genMain(mains) %}
{%- for main in mains %}
...
...
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