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
b0b39561
Commit
b0b39561
authored
Nov 10, 2020
by
maggie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改service编译方式
parent
59323d0c
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
91 additions
and
105 deletions
+91
-105
config.json
v2.0/compileServer/config.json
+3
-3
generate.js
v2.0/compileServer/generate.js
+5
-2
controller.export.njk
v2.0/compileServer/templates/controller.export.njk
+4
-2
controller.njk
v2.0/compileServer/templates/controller.njk
+3
-3
macro.njk
v2.0/compileServer/templates/macro.njk
+6
-4
service.export.njk
v2.0/compileServer/templates/service.export.njk
+5
-5
stat.controller.ts
v2.0/src/controller/common/stat.controller.ts
+7
-7
task.controller.ts
v2.0/src/controller/common/task.controller.ts
+11
-11
user.controller.ts
v2.0/src/controller/common/user.controller.ts
+6
-6
test1.controller.ts
v2.0/src/controller/custom/test1.controller.ts
+8
-6
test2.controller.ts
v2.0/src/controller/custom/test2.controller.ts
+6
-6
index.ts
v2.0/src/index.ts
+22
-45
index.ts
v2.0/src/service/custom/index.ts
+5
-5
No files found.
v2.0/compileServer/config.json
View file @
b0b39561
...
@@ -268,7 +268,7 @@
...
@@ -268,7 +268,7 @@
"service"
:
"task"
,
"service"
:
"task"
,
"function"
:
"getItemListWithCollectStatus"
,
"function"
:
"getItemListWithCollectStatus"
,
"params"
:
[
"params"
:
[
{
"type"
:
"var"
,
"value"
:
"commonBaseGet
itemlistbyi
dsResult1"
},
{
"type"
:
"var"
,
"value"
:
"commonBaseGet
ItemListByI
dsResult1"
},
{
"type"
:
"var"
,
"value"
:
"userInfo"
}
{
"type"
:
"var"
,
"value"
:
"userInfo"
}
],
],
"return"
:
true
"return"
:
true
...
@@ -333,7 +333,7 @@
...
@@ -333,7 +333,7 @@
"params"
:
[
"params"
:
[
{
"type"
:
"var"
,
"value"
:
"context.data.startDay"
},
{
"type"
:
"var"
,
"value"
:
"context.data.startDay"
},
{
"type"
:
"var"
,
"value"
:
"context.data.endDay"
},
{
"type"
:
"var"
,
"value"
:
"context.data.endDay"
},
{
"type"
:
"var"
,
"value"
:
"commonStatGet
s
tatsResult1"
}
{
"type"
:
"var"
,
"value"
:
"commonStatGet
S
tatsResult1"
}
],
],
"return"
:
true
"return"
:
true
}
}
...
@@ -415,7 +415,7 @@
...
@@ -415,7 +415,7 @@
"params"
:
[
"params"
:
[
{
"type"
:
"var"
,
"value"
:
"context.data.startDay"
},
{
"type"
:
"var"
,
"value"
:
"context.data.startDay"
},
{
"type"
:
"var"
,
"value"
:
"context.data.endDay"
},
{
"type"
:
"var"
,
"value"
:
"context.data.endDay"
},
{
"type"
:
"var"
,
"value"
:
"commonStatGet
s
tatsResult1"
}
{
"type"
:
"var"
,
"value"
:
"commonStatGet
S
tatsResult1"
}
],
],
"return"
:
true
"return"
:
true
}
}
...
...
v2.0/compileServer/generate.js
View file @
b0b39561
...
@@ -6,11 +6,14 @@ const serverTemplatePath = 'templates'
...
@@ -6,11 +6,14 @@ const serverTemplatePath = 'templates'
const
controllerImport
=
(
controller
=
{})
=>
{
const
controllerImport
=
(
controller
=
{})
=>
{
const
result
=
{
const
result
=
{
service
:
{}
service
s
:
{}
}
}
for
(
let
fn
in
controller
)
{
for
(
let
fn
in
controller
)
{
for
(
let
main
of
controller
[
fn
].
main
)
{
for
(
let
main
of
controller
[
fn
].
main
)
{
result
.
service
[
main
.
service
]
=
true
if
(
!
result
.
services
[
main
.
type
])
{
result
.
services
[
main
.
type
]
=
{}
}
result
.
services
[
main
.
type
][
main
.
service
]
=
true
}
}
}
}
console
.
log
(
result
)
console
.
log
(
result
)
...
...
v2.0/compileServer/templates/controller.export.njk
View file @
b0b39561
...
@@ -12,6 +12,8 @@ export default {
...
@@ -12,6 +12,8 @@ export default {
{{type}}{{controller | capitalize}}{{function | capitalize}}: {{type | capitalize}}{{controller | capitalize}}ControllerInstance.{{function}}
{{type}}{{controller | capitalize}}{{function | capitalize}}: {{type | capitalize}}{{controller | capitalize}}ControllerInstance.{{function}}
{%-if loop.last-%}{%else%},{%-endif-%}
{%-if loop.last-%}{%else%},{%-endif-%}
{%- endfor -%}
{%- endfor -%}
{%-if loop.last-%}{%else%},{%-endif-%}
{%- endfor -%}
{%- endfor -%}
{%-if loop.last-%}{%else%},{%-endif-%}
{%- endfor %}
{%- endfor %}
}
}
v2.0/compileServer/templates/controller.njk
View file @
b0b39561
...
@@ -6,10 +6,10 @@ import commonUtilCheck from '../../utils/common/check'
...
@@ -6,10 +6,10 @@ import commonUtilCheck from '../../utils/common/check'
import commonUtilUpdate from '../../utils/common/update'
import commonUtilUpdate from '../../utils/common/update'
import customDecorator from '../../decorator/custom'
import customDecorator from '../../decorator/custom'
import customUtil from '../../utils/custom'
import customUtil from '../../utils/custom'
import commonService from '../../service/common'
{#
import commonService from '../../service/common'
import customService from '../../service/custom'
import customService from '../../service/custom'
#}
import { resultsModel } from '../../sdk'
import { resultsModel } from '../../sdk'
{
# {{-macro.genControllerService(service)-}} #
}
{
{-macro.genControllerService(services)-}
}
export default class {{name | capitalize}}Controller {
export default class {{name | capitalize}}Controller {
{%- for fn, item in model %}
{%- for fn, item in model %}
...
...
v2.0/compileServer/templates/macro.njk
View file @
b0b39561
{# 生成控制器引用的服务 #}
{# 生成控制器引用的服务 #}
{% macro genControllerService(service)%}
{% macro genControllerService(services)%}
import { {% for key, item in service %}{{key | capitalize}}Service{%- if loop.last %}{% else %}, {% endif %}{%- endfor %} } from '../../service'
{% for type, type_item in services %}
import { {%for service, service_item in type_item %}{{type|capitalize}}{{service|capitalize}}Service{%- if loop.last %}{% else %}, {% endif %}{% endfor %} } from '../../service/{{type}}'
{% endfor%}
{% endmacro %}
{% endmacro %}
{# 生成装饰器 #}
{# 生成装饰器 #}
...
@@ -20,7 +22,7 @@ import { {% for key, item in service %}{{key | capitalize}}Service{%- if loop.la
...
@@ -20,7 +22,7 @@ import { {% for key, item in service %}{{key | capitalize}}Service{%- if loop.la
{% macro genServicesDecorator(mains) %}
{% macro genServicesDecorator(mains) %}
{%- for type, type_item in mains | groupByTypeAndService -%}
{%- for type, type_item in mains | groupByTypeAndService -%}
{%- for service, service_item in type_item -%}
{%- for service, service_item in type_item -%}
{{type
}}Service.
{{service|capitalize}}Service{%- if loop.last %}{% else %}, {% endif %}
{{type
|capitalize}}
{{service|capitalize}}Service{%- if loop.last %}{% else %}, {% endif %}
{%- endfor -%}
{%- endfor -%}
{%- if loop.last %}{% else %}, {% endif %}
{%- if loop.last %}{% else %}, {% endif %}
{%- endfor -%}
{%- endfor -%}
...
@@ -38,7 +40,7 @@ import { {% for key, item in service %}{{key | capitalize}}Service{%- if loop.la
...
@@ -38,7 +40,7 @@ import { {% for key, item in service %}{{key | capitalize}}Service{%- if loop.la
]: [
]: [
{%- for type, type_item in mains | groupByTypeAndService -%}
{%- for type, type_item in mains | groupByTypeAndService -%}
{%- for service, service_item in type_item -%}
{%- for service, service_item in type_item -%}
{{type
}}Service.
{{service|capitalize}}Service{%- if loop.last %}{% else %}, {% endif %}
{{type
|capitalize}}
{{service|capitalize}}Service{%- if loop.last %}{% else %}, {% endif %}
{%- endfor -%}
{%- endfor -%}
{%- if loop.last %}{% else %}, {% endif %}
{%- if loop.last %}{% else %}, {% endif %}
{%- endfor -%}
{%- endfor -%}
...
...
v2.0/compileServer/templates/service.export.njk
View file @
b0b39561
/** @format */
/** @format */
{%- for service, service_item in services %}
{%- for service, service_item in services %}
import {{ service | capitalize }}Service from './{{ service }}.service'
import
Custom
{{ service | capitalize }}Service from './{{ service }}.service'
{%- endfor %}
{%- endfor %}
const c
ommon
= {
const c
ustom
= {
{%- for service, service_item in services %}
{%- for service, service_item in services %}
{{ service | capitalize }}Service{% if loop.last %}{%else%},{% endif %}
Custom
{{ service | capitalize }}Service{% if loop.last %}{%else%},{% endif %}
{%- endfor %}
{%- endfor %}
}
}
export default c
ommon
export default c
ustom
export {
export {
{%- for service, service_item in services %}
{%- for service, service_item in services %}
{{ service | capitalize }}Service{% if loop.last %}{%else%},{% endif %}
Custom
{{ service | capitalize }}Service{% if loop.last %}{%else%},{% endif %}
{%- endfor %}
{%- endfor %}
}
}
v2.0/src/controller/common/stat.controller.ts
View file @
b0b39561
...
@@ -4,21 +4,21 @@ import commonUtilCheck from '../../utils/common/check'
...
@@ -4,21 +4,21 @@ import commonUtilCheck from '../../utils/common/check'
import
commonUtilUpdate
from
'../../utils/common/update'
import
commonUtilUpdate
from
'../../utils/common/update'
import
customDecorator
from
'../../decorator/custom'
import
customDecorator
from
'../../decorator/custom'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
commonService
from
'../../service/common'
import
customService
from
'../../service/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonStatService
}
from
'../../service/common'
export
default
class
StatController
{
export
default
class
StatController
{
/**
/**
* 增加埋点记录
* 增加埋点记录
*/
*/
@
commonDecorator
.
checkParams
([
'activityId'
,
'type'
])
@
commonDecorator
.
checkParams
([
'activityId'
,
'type'
])
@
services
([
commonService
.
StatService
])
@
services
([
Common
StatService
])
async
addStat
(
async
addStat
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonStatService
]:
[
commonService
.
StatService
]
[
commonStatService
]:
[
Common
StatService
]
)
{
)
{
const
commonStatAddStatResult1
=
await
commonStatService
.
addStat
(
context
.
data
.
type
,
userInfo
)
const
commonStatAddStatResult1
=
await
commonStatService
.
addStat
(
context
.
data
.
type
,
userInfo
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
@@ -29,14 +29,14 @@ export default class StatController {
...
@@ -29,14 +29,14 @@ export default class StatController {
* 统计数据
* 统计数据
*/
*/
@
commonDecorator
.
checkParams
([
'activityId'
,
'startDay'
,
'endDay'
])
@
commonDecorator
.
checkParams
([
'activityId'
,
'startDay'
,
'endDay'
])
@
services
([
commonService
.
StatService
])
@
services
([
Common
StatService
])
async
getStats
(
async
getStats
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonStatService
]:
[
commonService
.
StatService
]
[
commonStatService
]:
[
Common
StatService
]
)
{
)
{
const
commonStatGetStatsResult1
=
await
commonStatService
.
getStats
(
context
.
data
.
activityId
,
context
.
data
.
startDay
,
context
.
data
.
endDay
)
const
commonStatGetStatsResult1
=
await
commonStatService
.
getStats
(
context
.
data
.
activityId
,
context
.
data
.
startDay
,
context
.
data
.
endDay
)
const
commonStatBuildExcelResult2
=
await
commonStatService
.
buildExcel
(
context
.
data
.
startDay
,
context
.
data
.
endDay
,
commonStatGet
s
tatsResult1
)
const
commonStatBuildExcelResult2
=
await
commonStatService
.
buildExcel
(
context
.
data
.
startDay
,
context
.
data
.
endDay
,
commonStatGet
S
tatsResult1
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
commonStatBuildExcelResult2
...
commonStatBuildExcelResult2
})
})
...
...
v2.0/src/controller/common/task.controller.ts
View file @
b0b39561
...
@@ -4,10 +4,10 @@ import commonUtilCheck from '../../utils/common/check'
...
@@ -4,10 +4,10 @@ import commonUtilCheck from '../../utils/common/check'
import
commonUtilUpdate
from
'../../utils/common/update'
import
commonUtilUpdate
from
'../../utils/common/update'
import
customDecorator
from
'../../decorator/custom'
import
customDecorator
from
'../../decorator/custom'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
commonService
from
'../../service/common'
import
customService
from
'../../service/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonTaskService
,
CommonBaseService
}
from
'../../service/common'
export
default
class
TaskController
{
export
default
class
TaskController
{
/**
/**
...
@@ -17,11 +17,11 @@ export default class TaskController {
...
@@ -17,11 +17,11 @@ export default class TaskController {
@
commonDecorator
.
registeInfos
([
'vipInfo'
])
@
commonDecorator
.
registeInfos
([
'vipInfo'
])
@
commonDecorator
.
preCheck
([
commonUtilCheck
.
checkActivityTime
])
@
commonDecorator
.
preCheck
([
commonUtilCheck
.
checkActivityTime
])
@
commonDecorator
.
preUpdate
([
commonUtilUpdate
.
updateVip
,
commonUtilUpdate
.
updateSignTask
,
commonUtilUpdate
.
updateOrderGoods
])
@
commonDecorator
.
preUpdate
([
commonUtilUpdate
.
updateVip
,
commonUtilUpdate
.
updateSignTask
,
commonUtilUpdate
.
updateOrderGoods
])
@
services
([
commonService
.
TaskService
])
@
services
([
Common
TaskService
])
async
getTaskList
(
async
getTaskList
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
,
vipInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
,
vipInfo
}:
IControllerInfos
,
[
commonTaskService
]:
[
commonService
.
TaskService
]
[
commonTaskService
]:
[
Common
TaskService
]
)
{
)
{
const
commonTaskInitTaskResult1
=
await
commonTaskService
.
initTask
(
activityInfo
,
userInfo
)
const
commonTaskInitTaskResult1
=
await
commonTaskService
.
initTask
(
activityInfo
,
userInfo
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
@@ -34,11 +34,11 @@ export default class TaskController {
...
@@ -34,11 +34,11 @@ export default class TaskController {
@
commonDecorator
.
checkParams
([
'activityId'
,
'taskType'
])
@
commonDecorator
.
checkParams
([
'activityId'
,
'taskType'
])
@
commonDecorator
.
registeInfos
([
'session'
])
@
commonDecorator
.
registeInfos
([
'session'
])
@
commonDecorator
.
preCheck
([
commonUtilCheck
.
checkActivityTime
,
commonUtilCheck
.
checkTaskLimit
,
commonUtilCheck
.
checkExchangeCreditsTask
])
@
commonDecorator
.
preCheck
([
commonUtilCheck
.
checkActivityTime
,
commonUtilCheck
.
checkTaskLimit
,
commonUtilCheck
.
checkExchangeCreditsTask
])
@
services
([
commonService
.
TaskService
])
@
services
([
Common
TaskService
])
async
doCompleteTask
(
async
doCompleteTask
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
,
session
}:
IControllerInfos
,
{
activityInfo
,
userInfo
,
session
}:
IControllerInfos
,
[
commonTaskService
]:
[
commonService
.
TaskService
]
[
commonTaskService
]:
[
Common
TaskService
]
)
{
)
{
const
commonTaskCompleteTaskResult1
=
await
commonTaskService
.
completeTask
(
context
.
data
.
taskType
,
activityInfo
,
userInfo
)
const
commonTaskCompleteTaskResult1
=
await
commonTaskService
.
completeTask
(
context
.
data
.
taskType
,
activityInfo
,
userInfo
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
@@ -50,11 +50,11 @@ export default class TaskController {
...
@@ -50,11 +50,11 @@ export default class TaskController {
*/
*/
@
commonDecorator
.
checkParams
([
'activityId'
,
'taskType'
,
'rewardsKey'
])
@
commonDecorator
.
checkParams
([
'activityId'
,
'taskType'
,
'rewardsKey'
])
@
commonDecorator
.
preCheck
([
commonUtilCheck
.
checkActivityTime
,
commonUtilCheck
.
checkRemainTimes
])
@
commonDecorator
.
preCheck
([
commonUtilCheck
.
checkActivityTime
,
commonUtilCheck
.
checkRemainTimes
])
@
services
([
commonService
.
TaskService
])
@
services
([
Common
TaskService
])
async
receiveTaskRewards
(
async
receiveTaskRewards
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonTaskService
]:
[
commonService
.
TaskService
]
[
commonTaskService
]:
[
Common
TaskService
]
)
{
)
{
const
commonTaskReceiveTaskRewardsResult1
=
await
commonTaskService
.
receiveTaskRewards
(
context
.
data
.
taskType
,
context
.
data
.
rewardsKey
,
userInfo
)
const
commonTaskReceiveTaskRewardsResult1
=
await
commonTaskService
.
receiveTaskRewards
(
context
.
data
.
taskType
,
context
.
data
.
rewardsKey
,
userInfo
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
@@ -66,14 +66,14 @@ export default class TaskController {
...
@@ -66,14 +66,14 @@ export default class TaskController {
*/
*/
@
commonDecorator
.
checkParams
([
'activityId'
,
'itemIds'
])
@
commonDecorator
.
checkParams
([
'activityId'
,
'itemIds'
])
@
commonDecorator
.
registeInfos
([
'session'
])
@
commonDecorator
.
registeInfos
([
'session'
])
@
services
([
commonService
.
BaseService
,
commonService
.
TaskService
])
@
services
([
CommonBaseService
,
Common
TaskService
])
async
getCollectGoodsList
(
async
getCollectGoodsList
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
,
session
}:
IControllerInfos
,
{
activityInfo
,
userInfo
,
session
}:
IControllerInfos
,
[
commonBaseService
,
commonTaskService
]:
[
commonService
.
BaseService
,
commonService
.
TaskService
]
[
commonBaseService
,
commonTaskService
]:
[
CommonBaseService
,
Common
TaskService
]
)
{
)
{
const
commonBaseGetItemListByIdsResult1
=
await
commonBaseService
.
getItemListByIds
(
context
.
data
.
itemIds
,
session
)
const
commonBaseGetItemListByIdsResult1
=
await
commonBaseService
.
getItemListByIds
(
context
.
data
.
itemIds
,
session
)
const
commonTaskGetItemListWithCollectStatusResult2
=
await
commonTaskService
.
getItemListWithCollectStatus
(
commonBaseGet
itemlistbyi
dsResult1
,
userInfo
)
const
commonTaskGetItemListWithCollectStatusResult2
=
await
commonTaskService
.
getItemListWithCollectStatus
(
commonBaseGet
ItemListByI
dsResult1
,
userInfo
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
commonTaskGetItemListWithCollectStatusResult2
...
commonTaskGetItemListWithCollectStatusResult2
})
})
...
...
v2.0/src/controller/common/user.controller.ts
View file @
b0b39561
...
@@ -4,10 +4,10 @@ import commonUtilCheck from '../../utils/common/check'
...
@@ -4,10 +4,10 @@ import commonUtilCheck from '../../utils/common/check'
import
commonUtilUpdate
from
'../../utils/common/update'
import
commonUtilUpdate
from
'../../utils/common/update'
import
customDecorator
from
'../../decorator/custom'
import
customDecorator
from
'../../decorator/custom'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
commonService
from
'../../service/common'
import
customService
from
'../../service/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonUserService
}
from
'../../service/common'
export
default
class
UserController
{
export
default
class
UserController
{
/**
/**
...
@@ -15,11 +15,11 @@ export default class UserController {
...
@@ -15,11 +15,11 @@ export default class UserController {
*/
*/
@
commonDecorator
.
checkParams
([
'activityId'
])
@
commonDecorator
.
checkParams
([
'activityId'
])
@
commonDecorator
.
registeInfos
([
'session'
])
@
commonDecorator
.
registeInfos
([
'session'
])
@
services
([
commonService
.
UserService
])
@
services
([
Common
UserService
])
async
getVipInfo
(
async
getVipInfo
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
,
session
}:
IControllerInfos
,
{
activityInfo
,
userInfo
,
session
}:
IControllerInfos
,
[
commonUserService
]:
[
commonService
.
UserService
]
[
commonUserService
]:
[
Common
UserService
]
)
{
)
{
const
commonUserGetShopVipResult1
=
await
commonUserService
.
getShopVip
(
context
,
session
)
const
commonUserGetShopVipResult1
=
await
commonUserService
.
getShopVip
(
context
,
session
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
@@ -30,11 +30,11 @@ export default class UserController {
...
@@ -30,11 +30,11 @@ export default class UserController {
* 获取排行榜
* 获取排行榜
*/
*/
@
commonDecorator
.
checkParams
([
'activityId'
,
'key'
,
'timeKey'
,
'limit'
])
@
commonDecorator
.
checkParams
([
'activityId'
,
'key'
,
'timeKey'
,
'limit'
])
@
services
([
commonService
.
UserService
])
@
services
([
Common
UserService
])
async
getRankList
(
async
getRankList
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonUserService
]:
[
commonService
.
UserService
]
[
commonUserService
]:
[
Common
UserService
]
)
{
)
{
const
commonUserGetMyRankInfoResult1
=
await
commonUserService
.
getMyRankInfo
(
context
.
data
.
key
,
context
.
data
.
timeKey
,
userInfo
)
const
commonUserGetMyRankInfoResult1
=
await
commonUserService
.
getMyRankInfo
(
context
.
data
.
key
,
context
.
data
.
timeKey
,
userInfo
)
const
commonUserGetRankResult2
=
await
commonUserService
.
getRank
(
context
.
data
.
key
,
context
.
data
.
timeKey
,
context
.
data
.
limit
)
const
commonUserGetRankResult2
=
await
commonUserService
.
getRank
(
context
.
data
.
key
,
context
.
data
.
timeKey
,
context
.
data
.
limit
)
...
...
v2.0/src/controller/custom/test1.controller.ts
View file @
b0b39561
...
@@ -4,10 +4,12 @@ import commonUtilCheck from '../../utils/common/check'
...
@@ -4,10 +4,12 @@ import commonUtilCheck from '../../utils/common/check'
import
commonUtilUpdate
from
'../../utils/common/update'
import
commonUtilUpdate
from
'../../utils/common/update'
import
customDecorator
from
'../../decorator/custom'
import
customDecorator
from
'../../decorator/custom'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
commonService
from
'../../service/common'
import
customService
from
'../../service/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonStatService
}
from
'../../service/common'
import
{
CustomTestService
}
from
'../../service/custom'
export
default
class
Test1Controller
{
export
default
class
Test1Controller
{
/**
/**
...
@@ -15,11 +17,11 @@ export default class Test1Controller {
...
@@ -15,11 +17,11 @@ export default class Test1Controller {
*/
*/
@
commonDecorator
.
checkParams
([
'activityId'
,
'type'
])
@
commonDecorator
.
checkParams
([
'activityId'
,
'type'
])
@
customDecorator
.
test1
([
'tt'
])
@
customDecorator
.
test1
([
'tt'
])
@
services
([
commonService
.
StatService
,
customService
.
TestService
])
@
services
([
CommonStatService
,
Custom
TestService
])
async
addStat
(
async
addStat
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonStatService
,
customTestService
]:
[
commonService
.
StatService
,
customService
.
TestService
]
[
commonStatService
,
customTestService
]:
[
CommonStatService
,
Custom
TestService
]
)
{
)
{
const
commonStatAddStatResult1
=
await
commonStatService
.
addStat
(
context
.
data
.
type
,
userInfo
)
const
commonStatAddStatResult1
=
await
commonStatService
.
addStat
(
context
.
data
.
type
,
userInfo
)
const
customTestTest1Result2
=
await
customTestService
.
test1
()
const
customTestTest1Result2
=
await
customTestService
.
test1
()
...
@@ -32,11 +34,11 @@ export default class Test1Controller {
...
@@ -32,11 +34,11 @@ export default class Test1Controller {
* 统计数据
* 统计数据
*/
*/
@
commonDecorator
.
checkParams
([
'activityId'
,
'startDay'
,
'endDay'
])
@
commonDecorator
.
checkParams
([
'activityId'
,
'startDay'
,
'endDay'
])
@
services
([
commonService
.
StatService
])
@
services
([
Common
StatService
])
async
getStats
(
async
getStats
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonStatService
]:
[
commonService
.
StatService
]
[
commonStatService
]:
[
Common
StatService
]
)
{
)
{
const
commonStatGetStatsResult1
=
await
commonStatService
.
getStats
(
context
.
data
.
activityId
,
context
.
data
.
startDay
,
context
.
data
.
endDay
)
const
commonStatGetStatsResult1
=
await
commonStatService
.
getStats
(
context
.
data
.
activityId
,
context
.
data
.
startDay
,
context
.
data
.
endDay
)
const
commonStatBuildExcelResult2
=
await
commonStatService
.
buildExcel
(
context
.
data
.
startDay
,
context
.
data
.
endDay
,
commonStatGetStatsResult1
)
const
commonStatBuildExcelResult2
=
await
commonStatService
.
buildExcel
(
context
.
data
.
startDay
,
context
.
data
.
endDay
,
commonStatGetStatsResult1
)
...
...
v2.0/src/controller/custom/test2.controller.ts
View file @
b0b39561
...
@@ -4,21 +4,21 @@ import commonUtilCheck from '../../utils/common/check'
...
@@ -4,21 +4,21 @@ import commonUtilCheck from '../../utils/common/check'
import
commonUtilUpdate
from
'../../utils/common/update'
import
commonUtilUpdate
from
'../../utils/common/update'
import
customDecorator
from
'../../decorator/custom'
import
customDecorator
from
'../../decorator/custom'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
commonService
from
'../../service/common'
import
customService
from
'../../service/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonStatService
}
from
'../../service/common'
export
default
class
Test2Controller
{
export
default
class
Test2Controller
{
/**
/**
* 增加埋点记录
* 增加埋点记录
*/
*/
@
commonDecorator
.
checkParams
([
'activityId'
,
'type'
])
@
commonDecorator
.
checkParams
([
'activityId'
,
'type'
])
@
services
([
commonService
.
StatService
])
@
services
([
Common
StatService
])
async
addStat
(
async
addStat
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonStatService
]:
[
commonService
.
StatService
]
[
commonStatService
]:
[
Common
StatService
]
)
{
)
{
const
commonStatAddStatResult1
=
await
commonStatService
.
addStat
(
context
.
data
.
type
,
userInfo
)
const
commonStatAddStatResult1
=
await
commonStatService
.
addStat
(
context
.
data
.
type
,
userInfo
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
@@ -29,11 +29,11 @@ export default class Test2Controller {
...
@@ -29,11 +29,11 @@ export default class Test2Controller {
* 统计数据
* 统计数据
*/
*/
@
commonDecorator
.
checkParams
([
'activityId'
,
'startDay'
,
'endDay'
])
@
commonDecorator
.
checkParams
([
'activityId'
,
'startDay'
,
'endDay'
])
@
services
([
commonService
.
StatService
])
@
services
([
Common
StatService
])
async
getStats
(
async
getStats
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonStatService
]:
[
commonService
.
StatService
]
[
commonStatService
]:
[
Common
StatService
]
)
{
)
{
const
commonStatGetStatsResult1
=
await
commonStatService
.
getStats
(
context
.
data
.
activityId
,
context
.
data
.
startDay
,
context
.
data
.
endDay
)
const
commonStatGetStatsResult1
=
await
commonStatService
.
getStats
(
context
.
data
.
activityId
,
context
.
data
.
startDay
,
context
.
data
.
endDay
)
const
commonStatBuildExcelResult2
=
await
commonStatService
.
buildExcel
(
context
.
data
.
startDay
,
context
.
data
.
endDay
,
commonStatGetstatsResult1
)
const
commonStatBuildExcelResult2
=
await
commonStatService
.
buildExcel
(
context
.
data
.
startDay
,
context
.
data
.
endDay
,
commonStatGetstatsResult1
)
...
...
v2.0/src/index.ts
View file @
b0b39561
/** @format */
import
UserController
from
'./controller/user.controller'
import
CommonUserController
from
'./controller/common/user.controller'
import
TaskController
from
'./controller/task.controller'
const
CommonUserControllerInstance
=
new
CommonUserController
()
import
BaseController
from
'./controller/base.controller'
import
CommonTaskController
from
'./controller/common/task.controller'
import
AwardsController
from
'./controller/awards.controller'
const
CommonTaskControllerInstance
=
new
CommonTaskController
()
import
ShareController
from
'./controller/share.controller'
import
CommonStatController
from
'./controller/common/stat.controller'
import
StatController
from
'./controller/stat.controller'
const
CommonStatControllerInstance
=
new
CommonStatController
()
import
LoginController
from
'./controller/login.controller'
import
CustomTest1Controller
from
'./controller/custom/test1.controller'
import
GameController
from
'./controller/game.controller'
const
CustomTest1ControllerInstance
=
new
CustomTest1Controller
()
import
CustomTest2Controller
from
'./controller/custom/test2.controller'
const
{
getVipInfo
,
getRankList
}
=
new
UserController
()
const
CustomTest2ControllerInstance
=
new
CustomTest2Controller
()
const
{
login
}
=
new
LoginController
()
const
{
getGameInfo
,
startGame
,
submitGame
}
=
new
GameController
()
const
{
getTaskList
,
receiveTaskRewards
,
doCompleteTask
,
getCollectGoodsList
// 获取收藏商品列表,包含收藏状态
}
=
new
TaskController
()
const
{
getActivityBaseInfoById
,
getItemListByItemIds
}
=
new
BaseController
()
const
{
getMyPrizeList
,
receiveObjectPrize
,
receiveEnamePrize
,
drawLotteryPrize
}
=
new
AwardsController
()
const
{
doHelp
}
=
new
ShareController
()
const
{
getStats
,
addStat
}
=
new
StatController
()
export
default
{
export
default
{
login
,
commonUserGetvipinfo
:
CommonUserControllerInstance
.
getVipInfo
,
getVipInfo
,
commonUserGetranklist
:
CommonUserControllerInstance
.
getRankList
,
getTaskList
,
commonTaskGettasklist
:
CommonTaskControllerInstance
.
getTaskList
,
doCompleteTask
,
commonTaskDocompletetask
:
CommonTaskControllerInstance
.
doCompleteTask
,
receiveTaskRewards
,
commonTaskReceivetaskrewards
:
CommonTaskControllerInstance
.
receiveTaskRewards
,
getActivityBaseInfoById
,
commonTaskGetcollectgoodslist
:
CommonTaskControllerInstance
.
getCollectGoodsList
,
getMyPrizeList
,
commonStatAddstat
:
CommonStatControllerInstance
.
addStat
,
receiveObjectPrize
,
commonStatGetstats
:
CommonStatControllerInstance
.
getStats
,
receiveEnamePrize
,
customTest1Addstat
:
CustomTest1ControllerInstance
.
addStat
,
doHelp
,
customTest1Getstats
:
CustomTest1ControllerInstance
.
getStats
,
getStats
,
customTest2Addstat
:
CustomTest2ControllerInstance
.
addStat
,
addStat
,
customTest2Getstats
:
CustomTest2ControllerInstance
.
getStats
getRankList
,
// 游戏类
getGameInfo
,
startGame
,
submitGame
}
}
v2.0/src/service/custom/index.ts
View file @
b0b39561
/** @format */
/** @format */
import
TestService
from
'./test.service'
import
Custom
TestService
from
'./test.service'
const
c
ommon
=
{
const
c
ustom
=
{
TestService
Custom
TestService
}
}
export
default
c
ommon
export
default
c
ustom
export
{
export
{
TestService
Custom
TestService
}
}
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