Commit fee2d5a8 authored by maggie's avatar maggie

user.controller编译通过

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