Commit fee2d5a8 authored by maggie's avatar maggie

user.controller编译通过

parent b921b1cd
......@@ -30,10 +30,10 @@ export default class User {
* 获取会员信息
*/
{{-macro.genDecorator(model.getVipInfo.decorators)}}
{{-macro.genServicesDecorator(model.getVipInfo.main)}}
@services([{{-macro.genServicesDecorator(model.getVipInfo.main)}}])
async getVipInfo(
context: IContext<IVipParams>,
{ session, activityUserNick }: IControllerInfos,
{ activityInfo, userInfo{{-macro.genRegisteInfosParams(model.getVipInfo.decorators)}} }: IControllerInfos,
{{-macro.genServicesParams(model.getVipInfo.main)}}
): Promise<IResult<IVipInfo>> {
{{-macro.genMain(model.getVipInfo.main)}}
......@@ -45,7 +45,7 @@ export default class User {
* 获取排行榜
*/
{{-macro.genDecorator(model.getRankList.decorators)}}
{{-macro.genServicesDecorator(model.getRankList.main)}}
@services([{{-macro.genServicesDecorator(model.getRankList.main)}}])
async getRankList(
context: IContext<{
activityId: string
......@@ -53,7 +53,7 @@ export default class User {
timeKey: string // 排序时间的key值 如:updateScoreTime
limit: number
}>,
{ userInfo }: IControllerInfos,
{ activityInfo, userInfo{{-macro.genRegisteInfosParams(model.getRankList.decorators)}} }: IControllerInfos,
{{-macro.genServicesParams(model.getRankList.main)}}
) {
{{-macro.genMain(model.getRankList.main)}}
......
......@@ -16,11 +16,9 @@ import { {% for s, item2 in item1 %}{{s | capitalize}}Service{%- if loop.last %}
{# 生成services装饰器 #}
{% macro genServicesDecorator(mains) %}
@services([
{%- for service, main in mains|groupby("service") -%}
{{ service | capitalize }}Service{%- if loop.last %}{% else %}, {% endif %}
{%- endfor -%}
])
{%- for service, main in mains|groupby("service") -%}
{{ service | capitalize }}Service{%- if loop.last %}{% else %}, {% endif %}
{%- endfor -%}
{%- endmacro %}
{# 生成services参数 #}
......@@ -36,6 +34,17 @@ import { {% for s, item2 in item1 %}{{s | capitalize}}Service{%- if loop.last %}
]
{%- endmacro %}
{# 生成注入参数 #}
{% macro genRegisteInfosParams(decorators) %}
{%- for decorator in decorators -%}
{% if decorator.type == 'common' and decorator.name == 'registeInfos' %}
{%- for param in decorator.params -%}
{%- if loop.first %}, {% else %}{% endif %}{{ param }}{%- if loop.last %}{% else %}, {% endif %}
{%- endfor -%}
{% endif %}
{%- endfor -%}
{%- endmacro %}
{# 生成函数体 #}
{% macro genMain(mains) %}
{%- for main in mains %}
......
......@@ -32,7 +32,7 @@ export default class User {
@services([UserService])
async getVipInfo(
context: IContext<IVipParams>,
{ session, activityUserNick }: IControllerInfos,
{ activityInfo, userInfo, session }: IControllerInfos,
[userService]: [UserService]
): Promise<IResult<IVipInfo>> {
const commonUserGetshopvipResult = await userService.getShopVip(
......@@ -57,7 +57,7 @@ export default class User {
timeKey: string // 排序时间的key值 如:updateScoreTime
limit: number
}>,
{ userInfo }: IControllerInfos,
{ activityInfo, userInfo }: IControllerInfos,
[userService]: [UserService]
) {
const commonUserGetmyrankinfoResult = await userService.getMyRankInfo(
......
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