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
98efd01e
Commit
98efd01e
authored
Nov 17, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
🎸
初始化设置
parent
a2bdbe9b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
7 deletions
+23
-7
test2.controller.ts
v2.0/src/controller/custom/test2.controller.ts
+1
-1
checkParams.ts
v2.0/src/decorator/common/checkParams.ts
+4
-3
awards.service.ts
v2.0/src/service/common/awards.service.ts
+1
-0
user.service.ts
v2.0/src/service/common/user.service.ts
+17
-3
No files found.
v2.0/src/controller/custom/test2.controller.ts
View file @
98efd01e
...
...
@@ -25,7 +25,7 @@ export default class Test2Controller {
* 统计数据
*/
@
checkParams
([
'activityId'
,
'startDay'
,
'endDay'
])
@
preUpdate
([
updateVip
(
1
,
2
)
,
updateSignTask
,
updateOrderGoods
])
@
preUpdate
([
updateVip
,
updateSignTask
,
updateOrderGoods
])
@
services
([
CommonStatService
])
async
test2getStats
(
context
:
IContext
<
IParams
>
,
...
...
v2.0/src/decorator/common/checkParams.ts
View file @
98efd01e
...
...
@@ -20,9 +20,10 @@ export default function checkParams(params: string[]): IFunction {
descriptor
.
value
=
function
(...
args
:
any
[])
{
const
[
context
,
otherArgs
=
{},
services
=
[],
preCheckData
=
{}]
=
args
const
dataKeys
=
Object
.
keys
(
context
.
data
).
filter
(
v
=>
!
v
.
endsWith
(
'?'
))
for
(
let
i
=
0
;
i
<
params
.
length
;
i
++
)
{
const
param
=
params
[
i
]
const
dataKeys
=
Object
.
keys
(
context
.
data
)
const
requiredParams
=
params
.
filter
(
v
=>
!
v
.
endsWith
(
'?'
))
for
(
let
i
=
0
;
i
<
requiredParams
.
length
;
i
++
)
{
const
param
=
requiredParams
[
i
]
if
(
!
dataKeys
.
includes
(
param
)
||
context
.
data
?.[
param
]
===
''
)
{
logFn
(
context
)
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少
${
param
}
参数`
)
...
...
v2.0/src/service/common/awards.service.ts
View file @
98efd01e
...
...
@@ -99,6 +99,7 @@ export default class AwardsService extends UserService {
)
return
{
expiredTime
:
activityInfo
.
awardReceiveExpiredTime
,
list
:
this
.
formatMyPrizeList
(
myPrizeList
,
activityInfo
.
awardReceiveExpiredTime
)
}
}
...
...
v2.0/src/service/common/user.service.ts
View file @
98efd01e
...
...
@@ -71,10 +71,14 @@ class UserService extends BaseService {
inviteId
,
userNick
,
openId
,
gameTimes
:
0
,
totalScore
:
0
,
maxScore
:
0
,
// 待领取次数初始化, 根据需自定义添加
remainTimes
:
{
follow
:
isFollow
?
follow
.
value
:
0
,
member
:
vipInfo
.
isVip
?
member
.
value
:
0
member
:
vipInfo
.
isVip
?
member
.
value
:
0
,
...
initRemainTimes
},
member
:
{
flag
:
!!
vipInfo
.
isVip
...
...
@@ -93,6 +97,16 @@ class UserService extends BaseService {
updateTime
:
Date
.
now
()
}
function
initRemainTimes
(
tasks
:
ITasks
)
{
let
remainTimes
=
{}
as
IRemainTimesInfo
Object
.
keys
(
tasks
).
forEach
(
task
=>
{
if
(
task
!==
'follow'
&&
task
!==
'member'
)
{
remainTimes
[
task
]
=
0
}
})
return
remainTimes
}
// 初始化 如果已关注添加任务记录
if
(
isFollow
)
{
user
.
taskInfo
[
today
].
follow
=
[{
createTime
:
Date
.
now
()
}]
...
...
@@ -161,7 +175,7 @@ class UserService extends BaseService {
}
// 获取排名列表
async
getRank
(
sortValueKey
:
string
,
sortTimeKey
:
string
,
limit
:
number
=
200
)
{
async
getRank
(
sortValueKey
=
'totalScore'
,
sortTimeKey
=
'updateScoreTime'
,
limit
=
200
)
{
let
{
activityId
}
=
this
.
context
.
data
//获取排名
let
list
=
await
this
.
userdao
.
find
<
IUserInfo
>
(
...
...
@@ -197,7 +211,7 @@ class UserService extends BaseService {
* @return {number} 排行
* @memberof UserService
*/
async
getMyRankInfo
(
sortValueKey
:
string
,
sortTimeKey
:
string
,
userInfo
:
IUserInfo
)
{
async
getMyRankInfo
(
sortValueKey
=
'totalScore'
,
sortTimeKey
=
'updateScoreTime'
,
userInfo
:
IUserInfo
)
{
let
{
activityId
}
=
this
.
context
.
data
const
{
openId
}
=
this
.
context
const
userValue
=
userInfo
[
sortValueKey
]
...
...
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