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 */
/** @format */
import
{
services
,
checkParams
,
preCheck
,
preUpdate
}
from
'../decorator/common'
import
{
services
,
checkParams
,
preCheck
,
preUpdate
,
registeInfos
}
from
'../decorator/common'
import
{
resultsModel
}
from
'../sdk'
import
{
resultsModel
}
from
'../sdk'
import
{
CommonUserService
,
CommonGameService
}
from
'../service/common'
import
{
CommonUserService
,
CommonGameService
}
from
'../service/common'
import
{
import
{
...
@@ -38,15 +38,16 @@ export default class Game {
...
@@ -38,15 +38,16 @@ export default class Game {
}
}
@
checkParams
([
'activityId'
])
@
checkParams
([
'activityId'
])
@
registeInfos
([
'vipInfo'
])
@
services
([
CommonGameService
])
@
services
([
CommonGameService
])
@
preCheck
([
checkActivityTime
,
checkVip
,
checkGameTimes
(
3
)])
@
preCheck
([
checkActivityTime
,
checkVip
,
checkGameTimes
(
3
)])
@
preUpdate
([
reduceGameTimes
(
3
)])
@
preUpdate
([
reduceGameTimes
(
3
)])
async
startGame
(
async
startGame
(
context
:
IContext
<
IParams
>
,
context
:
IContext
<
IParams
>
,
{
userInfo
,
activityInfo
}:
IControllerInfos
,
{
userInfo
,
activityInfo
,
vipInfo
}:
IControllerInfos
,
[
gameService
]:
[
CommonGameService
]
[
gameService
]:
[
CommonGameService
]
)
{
)
{
const
joinResult
=
await
gameService
.
addJoinRecord
(
userInfo
)
const
joinResult
=
await
gameService
.
addJoinRecord
(
userInfo
,
vipInfo
)
return
resultsModel
.
success
({
return
resultsModel
.
success
({
...
joinResult
...
joinResult
...
...
v2.0/src/service/common/game.service.ts
View file @
1df4d685
...
@@ -18,12 +18,13 @@ export default class GameService extends UserService {
...
@@ -18,12 +18,13 @@ export default class GameService extends UserService {
this
.
joindao
=
new
BaseDao
(
context
,
JOIN_DB_NAME
)
this
.
joindao
=
new
BaseDao
(
context
,
JOIN_DB_NAME
)
}
}
async
addJoinRecord
(
userInfo
:
IUserInfo
)
{
async
addJoinRecord
(
userInfo
:
IUserInfo
,
vipInfo
:
IVipInfo
)
{
const
{
const
{
openId
,
openId
,
data
:
{
activityId
}
data
:
{
activityId
,
inviteId
}
}
=
this
.
context
}
=
this
.
context
const
{
userNick
,
avatar
}
=
userInfo
const
{
userNick
,
avatar
}
=
userInfo
const
{
isVip
}
=
vipInfo
const
now
=
Date
.
now
()
const
now
=
Date
.
now
()
const
today
=
getToday
()
const
today
=
getToday
()
const
record
:
IJoinRecord
=
{
const
record
:
IJoinRecord
=
{
...
@@ -34,7 +35,10 @@ export default class GameService extends UserService {
...
@@ -34,7 +35,10 @@ export default class GameService extends UserService {
createTime
:
now
,
createTime
:
now
,
updateTime
:
now
,
updateTime
:
now
,
score
:
0
,
score
:
0
,
createDay
:
today
createDay
:
today
,
inviteId
,
isVip
,
status
:
1
}
}
const
id
=
await
this
.
joindao
.
insertOne
(
record
)
const
id
=
await
this
.
joindao
.
insertOne
(
record
)
...
...
v2.0/src/typings/joinRecord.d.ts
View file @
1df4d685
...
@@ -12,4 +12,7 @@ interface IJoinRecord {
...
@@ -12,4 +12,7 @@ interface IJoinRecord {
createDay
:
string
createDay
:
string
duration
?:
number
duration
?:
number
submitTime
?:
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