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
1df4d685
Commit
1df4d685
authored
May 21, 2021
by
gongguan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
游戏记录增加是否是vip的信息;加inviteId的信息;提交分数接口防并发的判断字段status
parent
e8902da6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
game.controller.ts
v2.0/src/controller/game.controller.ts
+4
-3
game.service.ts
v2.0/src/service/common/game.service.ts
+7
-3
joinRecord.d.ts
v2.0/src/typings/joinRecord.d.ts
+3
-0
No files found.
v2.0/src/controller/game.controller.ts
View file @
1df4d685
/** @format */
import
{
services
,
checkParams
,
preCheck
,
preUpdate
}
from
'../decorator/common'
import
{
services
,
checkParams
,
preCheck
,
preUpdate
,
registeInfos
}
from
'../decorator/common'
import
{
resultsModel
}
from
'../sdk'
import
{
CommonUserService
,
CommonGameService
}
from
'../service/common'
import
{
...
...
@@ -38,15 +38,16 @@ export default class Game {
}
@
checkParams
([
'activityId'
])
@
registeInfos
([
'vipInfo'
])
@
services
([
CommonGameService
])
@
preCheck
([
checkActivityTime
,
checkVip
,
checkGameTimes
(
3
)])
@
preUpdate
([
reduceGameTimes
(
3
)])
async
startGame
(
context
:
IContext
<
IParams
>
,
{
userInfo
,
activityInfo
}:
IControllerInfos
,
{
userInfo
,
activityInfo
,
vipInfo
}:
IControllerInfos
,
[
gameService
]:
[
CommonGameService
]
)
{
const
joinResult
=
await
gameService
.
addJoinRecord
(
userInfo
)
const
joinResult
=
await
gameService
.
addJoinRecord
(
userInfo
,
vipInfo
)
return
resultsModel
.
success
({
...
joinResult
...
...
v2.0/src/service/common/game.service.ts
View file @
1df4d685
...
...
@@ -18,12 +18,13 @@ export default class GameService extends UserService {
this
.
joindao
=
new
BaseDao
(
context
,
JOIN_DB_NAME
)
}
async
addJoinRecord
(
userInfo
:
IUserInfo
)
{
async
addJoinRecord
(
userInfo
:
IUserInfo
,
vipInfo
:
IVipInfo
)
{
const
{
openId
,
data
:
{
activityId
}
data
:
{
activityId
,
inviteId
}
}
=
this
.
context
const
{
userNick
,
avatar
}
=
userInfo
const
{
isVip
}
=
vipInfo
const
now
=
Date
.
now
()
const
today
=
getToday
()
const
record
:
IJoinRecord
=
{
...
...
@@ -34,7 +35,10 @@ export default class GameService extends UserService {
createTime
:
now
,
updateTime
:
now
,
score
:
0
,
createDay
:
today
createDay
:
today
,
inviteId
,
isVip
,
status
:
1
}
const
id
=
await
this
.
joindao
.
insertOne
(
record
)
...
...
v2.0/src/typings/joinRecord.d.ts
View file @
1df4d685
...
...
@@ -12,4 +12,7 @@ interface IJoinRecord {
createDay
:
string
duration
?:
number
submitTime
?:
number
inviteId
?:
string
isVip
?:
boolean
status
?:
number
}
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