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
e0f83695
Commit
e0f83695
authored
Nov 17, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf:
⚡
️ 接口优化
parent
3ab1ec49
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
107 additions
and
100 deletions
+107
-100
config.json
v2.0/compileServer/config.json
+1
-11
gulpfile.js
v2.0/compileServer/gulpfile.js
+2
-1
base.controller.ts
v2.0/src/controller/common/base.controller.ts
+2
-6
login.controller.ts
v2.0/src/controller/common/login.controller.ts
+2
-6
share.controller.ts
v2.0/src/controller/common/share.controller.ts
+8
-8
stat.controller.ts
v2.0/src/controller/common/stat.controller.ts
+13
-9
task.controller.ts
v2.0/src/controller/common/task.controller.ts
+22
-15
user.controller.ts
v2.0/src/controller/common/user.controller.ts
+13
-9
test1.controller.ts
v2.0/src/controller/custom/test1.controller.ts
+13
-9
test2.controller.ts
v2.0/src/controller/custom/test2.controller.ts
+15
-11
game.controller.ts
v2.0/src/controller/game.controller.ts
+3
-1
index.ts
v2.0/src/decorator/custom/index.ts
+1
-3
game.service.ts
v2.0/src/service/common/game.service.ts
+9
-2
index.ts
v2.0/src/service/custom/index.ts
+1
-3
index.ts
v2.0/src/utils/custom/index.ts
+2
-6
No files found.
v2.0/compileServer/config.json
View file @
e0f83695
...
@@ -167,12 +167,6 @@
...
@@ -167,12 +167,6 @@
"type"
:
"common"
,
"type"
:
"common"
,
"behave"
:
"check"
,
"behave"
:
"check"
,
"name"
:
"checkExchangeCreditsTask"
"name"
:
"checkExchangeCreditsTask"
},
{
"type"
:
"common"
,
"behave"
:
"check"
,
"name"
:
"checkUserInfo"
,
"params"
:
3
}
}
]
]
}
}
...
@@ -787,11 +781,7 @@
...
@@ -787,11 +781,7 @@
{
{
"type"
:
"common"
,
"type"
:
"common"
,
"behave"
:
"update"
,
"behave"
:
"update"
,
"name"
:
"updateVip"
,
"name"
:
"updateVip"
"params"
:
[
"1"
,
"2"
]
},
},
{
{
"type"
:
"common"
,
"type"
:
"common"
,
...
...
v2.0/compileServer/gulpfile.js
View file @
e0f83695
...
@@ -51,6 +51,7 @@ gulp.task('build', function () {
...
@@ -51,6 +51,7 @@ gulp.task('build', function () {
return
codeGenerate
.
run
(
gulp
,
nunjucksRender
,
rename
,
nunjucksRenderConfig
)
return
codeGenerate
.
run
(
gulp
,
nunjucksRender
,
rename
,
nunjucksRenderConfig
)
})
})
console
.
log
(
nunjucksRenderConfig
.
ServerFullPath
+
'/**/*.ts'
)
gulp
.
task
(
'format'
,
()
=>
{
gulp
.
task
(
'format'
,
()
=>
{
return
gulp
return
gulp
.
src
(
nunjucksRenderConfig
.
ServerFullPath
+
'/**/*.ts'
)
.
src
(
nunjucksRenderConfig
.
ServerFullPath
+
'/**/*.ts'
)
...
@@ -58,4 +59,4 @@ gulp.task('format', () => {
...
@@ -58,4 +59,4 @@ gulp.task('format', () => {
.
pipe
(
gulp
.
dest
(
nunjucksRenderConfig
.
ServerFullPath
+
'/'
))
.
pipe
(
gulp
.
dest
(
nunjucksRenderConfig
.
ServerFullPath
+
'/'
))
})
})
gulp
.
task
(
'code'
,
gulp
.
series
(
'build'
))
gulp
.
task
(
'code'
,
gulp
.
series
(
'build'
,
'format'
))
v2.0/src/controller/common/base.controller.ts
View file @
e0f83695
/** @format */
/** @format */
import
{
services
,
checkParams
,
noCheckUser
}
from
'../../decorator/common'
import
{
services
,
checkParams
,
noCheckUser
}
from
'../../decorator/common'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonBaseService
}
from
'../../service/common'
import
{
CommonBaseService
}
from
'../../service/common'
export
default
class
BaseController
{
export
default
class
BaseController
{
/**
/**
* 活动基本信息
* 活动基本信息
...
@@ -18,7 +14,7 @@ export default class BaseController {
...
@@ -18,7 +14,7 @@ export default class BaseController {
async
getActivityBaseInfoById
(
async
getActivityBaseInfoById
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonBaseService
]:
[
CommonBaseService
]
,
[
commonBaseService
]:
[
CommonBaseService
]
)
{
)
{
const
commonBaseGetBaseInfoResult1
=
await
commonBaseService
.
getBaseInfo
(
context
.
data
.
activityId
)
const
commonBaseGetBaseInfoResult1
=
await
commonBaseService
.
getBaseInfo
(
context
.
data
.
activityId
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
...
v2.0/src/controller/common/login.controller.ts
View file @
e0f83695
/** @format */
/** @format */
import
{
services
,
checkParams
,
noCheckUser
,
registeInfos
}
from
'../../decorator/common'
import
{
services
,
checkParams
,
noCheckUser
,
registeInfos
}
from
'../../decorator/common'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonUserService
,
CommonAccessService
}
from
'../../service/common'
import
{
CommonUserService
,
CommonAccessService
}
from
'../../service/common'
export
default
class
LoginController
{
export
default
class
LoginController
{
/**
/**
* 登录接口, 初始化/更新用户信息
* 登录接口, 初始化/更新用户信息
...
@@ -19,7 +15,7 @@ export default class LoginController {
...
@@ -19,7 +15,7 @@ export default class LoginController {
async
login
(
async
login
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
,
vipInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
,
vipInfo
}:
IControllerInfos
,
[
commonUserService
,
commonAccessService
]:
[
CommonUserService
,
CommonAccessService
]
,
[
commonUserService
,
commonAccessService
]:
[
CommonUserService
,
CommonAccessService
]
)
{
)
{
const
commonUserDoLoginResult1
=
await
commonUserService
.
doLogin
(
userInfo
,
vipInfo
,
activityInfo
)
const
commonUserDoLoginResult1
=
await
commonUserService
.
doLogin
(
userInfo
,
vipInfo
,
activityInfo
)
const
commonAccessAddAccessResult2
=
await
commonAccessService
.
addAccess
(
commonUserDoLoginResult1
,
vipInfo
)
const
commonAccessAddAccessResult2
=
await
commonAccessService
.
addAccess
(
commonUserDoLoginResult1
,
vipInfo
)
...
...
v2.0/src/controller/common/share.controller.ts
View file @
e0f83695
/** @format */
/** @format */
import
{
services
,
checkParams
,
registeInfos
,
preCheck
}
from
'../../decorator/common'
import
{
services
,
checkParams
,
registeInfos
,
preCheck
}
from
'../../decorator/common'
import
{
checkActivityTime
,
checkInviteId
,
checkNewVip
,
checkHelpRecord
}
from
'../../utils/common/check'
import
{
checkActivityTime
,
checkInviteId
,
checkNewVip
,
checkHelpRecord
}
from
'../../utils/common/check'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonUserService
,
CommonTaskService
,
CommonStatService
}
from
'../../service/common'
import
{
CommonUserService
,
CommonTaskService
,
CommonStatService
}
from
'../../service/common'
export
default
class
ShareController
{
export
default
class
ShareController
{
/**
/**
* 获取邀请信息
* 获取邀请信息
...
@@ -18,9 +14,13 @@ export default class ShareController {
...
@@ -18,9 +14,13 @@ export default class ShareController {
async
getShareInfo
(
async
getShareInfo
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonUserService
]:
[
CommonUserService
]
,
[
commonUserService
]:
[
CommonUserService
]
)
{
)
{
const
commonUserQueryDataByKeyResult1
=
await
commonUserService
.
queryDataByKey
(
'remainTimes.invites'
,
userInfo
,
'rewards'
)
const
commonUserQueryDataByKeyResult1
=
await
commonUserService
.
queryDataByKey
(
'remainTimes.invites'
,
userInfo
,
'rewards'
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
commonUserQueryDataByKeyResult1
...
commonUserQueryDataByKeyResult1
})
})
...
...
v2.0/src/controller/common/stat.controller.ts
View file @
e0f83695
/** @format */
/** @format */
import
{
services
,
checkParams
}
from
'../../decorator/common'
import
{
services
,
checkParams
}
from
'../../decorator/common'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonStatService
}
from
'../../service/common'
import
{
CommonStatService
}
from
'../../service/common'
export
default
class
StatController
{
export
default
class
StatController
{
/**
/**
* 增加埋点记录
* 增加埋点记录
...
@@ -17,7 +13,7 @@ export default class StatController {
...
@@ -17,7 +13,7 @@ export default class StatController {
async
addStat
(
async
addStat
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonStatService
]:
[
CommonStatService
]
,
[
commonStatService
]:
[
CommonStatService
]
)
{
)
{
const
commonStatAddStatResult1
=
await
commonStatService
.
addStat
(
context
.
data
.
type
,
userInfo
)
const
commonStatAddStatResult1
=
await
commonStatService
.
addStat
(
context
.
data
.
type
,
userInfo
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
@@ -32,10 +28,18 @@ export default class StatController {
...
@@ -32,10 +28,18 @@ export default class StatController {
async
getStats
(
async
getStats
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonStatService
]:
[
CommonStatService
]
,
[
commonStatService
]:
[
CommonStatService
]
)
{
)
{
const
commonStatGetStatsResult1
=
await
commonStatService
.
getStats
(
context
.
data
.
activityId
,
context
.
data
.
startDay
,
context
.
data
.
endDay
)
const
commonStatGetStatsResult1
=
await
commonStatService
.
getStats
(
const
commonStatBuildExcelResult2
=
await
commonStatService
.
buildExcel
(
context
.
data
.
startDay
,
context
.
data
.
endDay
,
commonStatGetStatsResult1
)
context
.
data
.
activityId
,
context
.
data
.
startDay
,
context
.
data
.
endDay
)
const
commonStatBuildExcelResult2
=
await
commonStatService
.
buildExcel
(
context
.
data
.
startDay
,
context
.
data
.
endDay
,
commonStatGetStatsResult1
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
commonStatBuildExcelResult2
...
commonStatBuildExcelResult2
})
})
...
...
v2.0/src/controller/common/task.controller.ts
View file @
e0f83695
/** @format */
/** @format */
import
{
services
,
checkParams
,
registeInfos
,
preCheck
,
preUpdate
}
from
'../../decorator/common'
import
{
services
,
checkParams
,
registeInfos
,
preCheck
,
preUpdate
}
from
'../../decorator/common'
import
{
checkActivityTime
,
checkTaskLimit
,
checkExchangeCreditsTask
,
checkUserInfo
,
checkRemainTimes
}
from
'../../utils/common/check'
import
{
checkActivityTime
,
checkTaskLimit
,
checkExchangeCreditsTask
,
checkRemainTimes
}
from
'../../utils/common/check'
import
{
updateVip
,
updateSignTask
,
updateOrderGoods
}
from
'../../utils/common/update'
import
{
updateVip
,
updateSignTask
,
updateOrderGoods
}
from
'../../utils/common/update'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonTaskService
,
CommonBaseService
}
from
'../../service/common'
import
{
CommonTaskService
,
CommonBaseService
}
from
'../../service/common'
export
default
class
TaskController
{
export
default
class
TaskController
{
/**
/**
* 任务列表
* 任务列表
...
@@ -22,7 +18,7 @@ export default class TaskController {
...
@@ -22,7 +18,7 @@ export default class TaskController {
async
getTaskList
(
async
getTaskList
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
,
vipInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
,
vipInfo
}:
IControllerInfos
,
[
commonTaskService
]:
[
CommonTaskService
]
,
[
commonTaskService
]:
[
CommonTaskService
]
)
{
)
{
const
commonTaskInitTaskListResult1
=
await
commonTaskService
.
initTaskList
(
userInfo
,
activityInfo
)
const
commonTaskInitTaskListResult1
=
await
commonTaskService
.
initTaskList
(
userInfo
,
activityInfo
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
@@ -35,13 +31,17 @@ export default class TaskController {
...
@@ -35,13 +31,17 @@ export default class TaskController {
@
checkParams
([
'activityId'
,
'taskType'
])
@
checkParams
([
'activityId'
,
'taskType'
])
@
registeInfos
([
'session'
])
@
registeInfos
([
'session'
])
@
services
([
CommonTaskService
])
@
services
([
CommonTaskService
])
@
preCheck
([
checkActivityTime
,
checkTaskLimit
,
checkExchangeCreditsTask
,
checkUserInfo
()
])
@
preCheck
([
checkActivityTime
,
checkTaskLimit
,
checkExchangeCreditsTask
])
async
doCompleteTask
(
async
doCompleteTask
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
,
session
}:
IControllerInfos
,
{
activityInfo
,
userInfo
,
session
}:
IControllerInfos
,
[
commonTaskService
]:
[
CommonTaskService
]
,
[
commonTaskService
]:
[
CommonTaskService
]
)
{
)
{
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
({
...
commonTaskCompleteTaskResult1
...
commonTaskCompleteTaskResult1
})
})
...
@@ -55,9 +55,13 @@ export default class TaskController {
...
@@ -55,9 +55,13 @@ export default class TaskController {
async
receiveTaskRewards
(
async
receiveTaskRewards
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonTaskService
]:
[
CommonTaskService
]
,
[
commonTaskService
]:
[
CommonTaskService
]
)
{
)
{
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
({
...
commonTaskReceiveTaskRewardsResult1
...
commonTaskReceiveTaskRewardsResult1
})
})
...
@@ -71,10 +75,13 @@ export default class TaskController {
...
@@ -71,10 +75,13 @@ export default class TaskController {
async
getCollectGoodsList
(
async
getCollectGoodsList
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
,
session
}:
IControllerInfos
,
{
activityInfo
,
userInfo
,
session
}:
IControllerInfos
,
[
commonBaseService
,
commonTaskService
]:
[
CommonBaseService
,
CommonTaskService
]
,
[
commonBaseService
,
commonTaskService
]:
[
CommonBaseService
,
CommonTaskService
]
)
{
)
{
const
commonBaseGetItemListByIdsResult1
=
await
commonBaseService
.
getItemListByIds
(
context
.
data
.
itemIds
,
session
)
const
commonBaseGetItemListByIdsResult1
=
await
commonBaseService
.
getItemListByIds
(
context
.
data
.
itemIds
,
session
)
const
commonTaskGetItemListWithCollectStatusResult2
=
await
commonTaskService
.
getItemListWithCollectStatus
(
commonBaseGetItemListByIdsResult1
,
userInfo
)
const
commonTaskGetItemListWithCollectStatusResult2
=
await
commonTaskService
.
getItemListWithCollectStatus
(
commonBaseGetItemListByIdsResult1
,
userInfo
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
commonTaskGetItemListWithCollectStatusResult2
...
commonTaskGetItemListWithCollectStatusResult2
})
})
...
...
v2.0/src/controller/common/user.controller.ts
View file @
e0f83695
/** @format */
/** @format */
import
{
services
,
checkParams
}
from
'../../decorator/common'
import
{
services
,
checkParams
}
from
'../../decorator/common'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonUserService
}
from
'../../service/common'
import
{
CommonUserService
}
from
'../../service/common'
export
default
class
UserController
{
export
default
class
UserController
{
/**
/**
* 获取会员信息
* 获取会员信息
...
@@ -17,7 +13,7 @@ export default class UserController {
...
@@ -17,7 +13,7 @@ export default class UserController {
async
getVipInfo
(
async
getVipInfo
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonUserService
]:
[
CommonUserService
]
,
[
commonUserService
]:
[
CommonUserService
]
)
{
)
{
const
commonUserGetShopVipResult1
=
await
commonUserService
.
getShopVip
(
context
,
activityInfo
)
const
commonUserGetShopVipResult1
=
await
commonUserService
.
getShopVip
(
context
,
activityInfo
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
@@ -32,10 +28,18 @@ export default class UserController {
...
@@ -32,10 +28,18 @@ export default class UserController {
async
getRankList
(
async
getRankList
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonUserService
]:
[
CommonUserService
]
,
[
commonUserService
]:
[
CommonUserService
]
)
{
)
{
const
commonUserGetMyRankInfoResult1
=
await
commonUserService
.
getMyRankInfo
(
context
.
data
.
key
,
context
.
data
.
timeKey
,
userInfo
)
const
commonUserGetMyRankInfoResult1
=
await
commonUserService
.
getMyRankInfo
(
const
commonUserGetRankResult2
=
await
commonUserService
.
getRank
(
context
.
data
.
key
,
context
.
data
.
timeKey
,
context
.
data
.
limit
)
context
.
data
.
key
,
context
.
data
.
timeKey
,
userInfo
)
const
commonUserGetRankResult2
=
await
commonUserService
.
getRank
(
context
.
data
.
key
,
context
.
data
.
timeKey
,
context
.
data
.
limit
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
commonUserGetMyRankInfoResult1
,
...
commonUserGetMyRankInfoResult1
,
...
commonUserGetRankResult2
...
commonUserGetRankResult2
...
...
v2.0/src/controller/custom/test1.controller.ts
View file @
e0f83695
/** @format */
/** @format */
import
{
services
,
checkParams
}
from
'../../decorator/common'
import
{
services
,
checkParams
}
from
'../../decorator/common'
import
{
test1
}
from
'../../decorator/custom'
import
{
test1
}
from
'../../decorator/custom'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonStatService
}
from
'../../service/common'
import
{
CommonStatService
}
from
'../../service/common'
import
{
CustomTestService
}
from
'../../service/custom'
import
{
CustomTestService
}
from
'../../service/custom'
export
default
class
Test1Controller
{
export
default
class
Test1Controller
{
/**
/**
* 增加埋点记录
* 增加埋点记录
...
@@ -20,7 +16,7 @@ export default class Test1Controller {
...
@@ -20,7 +16,7 @@ export default class Test1Controller {
async
testAddStat
(
async
testAddStat
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonStatService
,
customTestService
]:
[
CommonStatService
,
CustomTestService
]
,
[
commonStatService
,
customTestService
]:
[
CommonStatService
,
CustomTestService
]
)
{
)
{
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
()
...
@@ -37,10 +33,18 @@ export default class Test1Controller {
...
@@ -37,10 +33,18 @@ export default class Test1Controller {
async
testGetStats
(
async
testGetStats
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonStatService
]:
[
CommonStatService
]
,
[
commonStatService
]:
[
CommonStatService
]
)
{
)
{
const
commonStatGetStatsResult1
=
await
commonStatService
.
getStats
(
context
.
data
.
activityId
,
context
.
data
.
startDay
,
context
.
data
.
endDay
)
const
commonStatGetStatsResult1
=
await
commonStatService
.
getStats
(
const
commonStatBuildExcelResult2
=
await
commonStatService
.
buildExcel
(
context
.
data
.
startDay
,
context
.
data
.
endDay
,
commonStatGetStatsResult1
)
context
.
data
.
activityId
,
context
.
data
.
startDay
,
context
.
data
.
endDay
)
const
commonStatBuildExcelResult2
=
await
commonStatService
.
buildExcel
(
context
.
data
.
startDay
,
context
.
data
.
endDay
,
commonStatGetStatsResult1
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
commonStatBuildExcelResult2
...
commonStatBuildExcelResult2
})
})
...
...
v2.0/src/controller/custom/test2.controller.ts
View file @
e0f83695
/** @format */
/** @format */
import
{
services
,
checkParams
,
preUpdate
}
from
'../../decorator/common'
import
{
services
,
checkParams
,
preUpdate
}
from
'../../decorator/common'
import
{
updateVip
,
updateSignTask
,
updateOrderGoods
}
from
'../../utils/common/update'
import
{
updateVip
,
updateSignTask
,
updateOrderGoods
}
from
'../../utils/common/update'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonStatService
}
from
'../../service/common'
import
{
CommonStatService
}
from
'../../service/common'
export
default
class
Test2Controller
{
export
default
class
Test2Controller
{
/**
/**
* 增加埋点记录
* 增加埋点记录
...
@@ -18,7 +14,7 @@ export default class Test2Controller {
...
@@ -18,7 +14,7 @@ export default class Test2Controller {
async
test2addStat
(
async
test2addStat
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonStatService
]:
[
CommonStatService
]
,
[
commonStatService
]:
[
CommonStatService
]
)
{
)
{
const
commonStatAddStatResult1
=
await
commonStatService
.
addStat
(
context
.
data
.
type
,
userInfo
)
const
commonStatAddStatResult1
=
await
commonStatService
.
addStat
(
context
.
data
.
type
,
userInfo
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
@@ -30,14 +26,22 @@ export default class Test2Controller {
...
@@ -30,14 +26,22 @@ export default class Test2Controller {
*/
*/
@
checkParams
([
'activityId'
,
'startDay'
,
'endDay'
])
@
checkParams
([
'activityId'
,
'startDay'
,
'endDay'
])
@
services
([
CommonStatService
])
@
services
([
CommonStatService
])
@
preUpdate
([
updateVip
(
1
,
2
)
,
updateSignTask
,
updateOrderGoods
])
@
preUpdate
([
updateVip
,
updateSignTask
,
updateOrderGoods
])
async
test2getStats
(
async
test2getStats
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonStatService
]:
[
CommonStatService
]
,
[
commonStatService
]:
[
CommonStatService
]
)
{
)
{
const
commonStatGetStatsResult1
=
await
commonStatService
.
getStats
(
context
.
data
.
activityId
,
context
.
data
.
startDay
,
context
.
data
.
endDay
)
const
commonStatGetStatsResult1
=
await
commonStatService
.
getStats
(
const
commonStatBuildExcelResult2
=
await
commonStatService
.
buildExcel
(
context
.
data
.
startDay
,
context
.
data
.
endDay
,
commonStatGetStatsResult1
)
context
.
data
.
activityId
,
context
.
data
.
startDay
,
context
.
data
.
endDay
)
const
commonStatBuildExcelResult2
=
await
commonStatService
.
buildExcel
(
context
.
data
.
startDay
,
context
.
data
.
endDay
,
commonStatGetStatsResult1
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
commonStatBuildExcelResult2
...
commonStatBuildExcelResult2
})
})
...
...
v2.0/src/controller/game.controller.ts
View file @
e0f83695
...
@@ -55,7 +55,9 @@ export default class Game {
...
@@ -55,7 +55,9 @@ export default class Game {
[
gameService
]:
[
CommonGameService
]
[
gameService
]:
[
CommonGameService
]
)
{
)
{
const
{
id
,
score
}
=
context
.
data
const
{
id
,
score
}
=
context
.
data
const
result
=
await
gameService
.
submitGame
(
id
,
score
,
userInfo
,
joinInfo
)
const
rankKey
=
'totalScore'
const
rankTime
=
'updateScoreTime'
const
result
=
await
gameService
.
submitGame
(
id
,
score
,
rankKey
,
rankTime
,
userInfo
,
joinInfo
)
return
resultsModel
.
success
(
result
)
return
resultsModel
.
success
(
result
)
}
}
...
...
v2.0/src/decorator/custom/index.ts
View file @
e0f83695
...
@@ -8,6 +8,4 @@ const custom = {
...
@@ -8,6 +8,4 @@ const custom = {
export
default
custom
export
default
custom
export
{
export
{
test1
}
test1
}
v2.0/src/service/common/game.service.ts
View file @
e0f83695
...
@@ -42,12 +42,19 @@ export default class GameService extends UserService {
...
@@ -42,12 +42,19 @@ export default class GameService extends UserService {
return
{
id
}
return
{
id
}
}
}
async
submitGame
(
id
:
string
,
score
:
number
,
userInfo
:
IUserInfo
,
joinInfo
:
IJoinRecord
)
{
async
submitGame
(
id
:
string
,
score
:
number
,
rankKey
:
string
,
rankTime
:
string
,
userInfo
:
IUserInfo
,
joinInfo
:
IJoinRecord
)
{
const
{
duration
}
=
await
this
.
updateJoinRecord
(
id
,
score
,
userInfo
,
joinInfo
)
const
{
duration
}
=
await
this
.
updateJoinRecord
(
id
,
score
,
userInfo
,
joinInfo
)
const
{
maxScore
,
totalScore
}
=
await
this
.
updateUserScore
(
score
,
userInfo
)
const
{
maxScore
,
totalScore
}
=
await
this
.
updateUserScore
(
score
,
userInfo
)
const
myRankInfo
=
await
this
.
getMyRankInfo
(
'maxScore'
,
'updateScoreTime'
,
userInfo
)
const
myRankInfo
=
await
this
.
getMyRankInfo
(
rankKey
,
rankTime
,
userInfo
)
const
{
gameTimes
,
avatar
,
userNick
}
=
userInfo
const
{
gameTimes
,
avatar
,
userNick
}
=
userInfo
...
...
v2.0/src/service/custom/index.ts
View file @
e0f83695
...
@@ -7,6 +7,4 @@ const custom = {
...
@@ -7,6 +7,4 @@ const custom = {
export
default
custom
export
default
custom
export
{
export
{
CustomTestService
}
CustomTestService
}
v2.0/src/utils/custom/index.ts
View file @
e0f83695
/** @format */
/** @format */
const
custom
=
{}
const
custom
=
{
}
export
default
custom
export
default
custom
export
{
export
{}
}
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