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
0bf31793
Commit
0bf31793
authored
Jan 29, 2021
by
maggie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
排行榜开奖
parent
3ea93a86
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
123 additions
and
71 deletions
+123
-71
config.json
v2.0/compileServer/config.json
+31
-0
constants.ts
v2.0/src/constants.ts
+0
-1
awards.controller.ts
v2.0/src/controller/awards.controller.ts
+8
-12
awards.controller.ts
v2.0/src/controller/common/awards.controller.ts
+24
-2
index.ts
v2.0/src/index.ts
+1
-0
awards.service.ts
v2.0/src/service/common/awards.service.ts
+57
-52
activityConfig.d.ts
v2.0/src/typings/activityConfig.d.ts
+1
-2
awards.d.ts
v2.0/src/typings/awards.d.ts
+1
-2
No files found.
v2.0/compileServer/config.json
View file @
0bf31793
...
@@ -559,6 +559,37 @@
...
@@ -559,6 +559,37 @@
"return"
:
true
"return"
:
true
}
}
]
]
},
"endOfActivityRewards"
:
{
"desc"
:
"排行榜开奖"
,
"decorators"
:
[
{
"type"
:
"common"
,
"name"
:
"noCheckUser"
}
],
"main"
:
[
{
"type"
:
"common"
,
"service"
:
"base"
,
"function"
:
"getNeedRewardsActivityList"
,
"params"
:
[],
"return"
:
false
},
{
"type"
:
"common"
,
"service"
:
"awards"
,
"function"
:
"openPrize"
,
"params"
:
[
{
"type"
:
"var"
,
"value"
:
"commonBaseGetNeedRewardsActivityListResult1"
},
{
"type"
:
"var"
,
"value"
:
1
},
{
"value"
:
"sortKey"
},
{
"value"
:
"sortTimeKey"
},
{
"type"
:
"var"
,
"value"
:
200
}
],
"return"
:
true
}
]
}
}
},
},
"share"
:
{
"share"
:
{
...
...
v2.0/src/constants.ts
View file @
0bf31793
...
@@ -109,7 +109,6 @@ export enum STAT_TYPE {
...
@@ -109,7 +109,6 @@ export enum STAT_TYPE {
INITE_SUCCESS
INITE_SUCCESS
}
}
// 每次参与消耗次数
// 每次参与消耗次数
export
const
JOIN_NEED_TIMES
=
1
export
const
JOIN_NEED_TIMES
=
1
...
...
v2.0/src/controller/awards.controller.ts
View file @
0bf31793
...
@@ -103,19 +103,15 @@ export default class AwardsController {
...
@@ -103,19 +103,15 @@ export default class AwardsController {
[
commonBaseService
,
commonAwardsService
]:
[
CommonBaseService
,
CommonAwardsService
]
[
commonBaseService
,
commonAwardsService
]:
[
CommonBaseService
,
CommonAwardsService
]
)
{
)
{
const
activityList
=
await
commonBaseService
.
getNeedRewardsActivityList
()
const
activityList
=
await
commonBaseService
.
getNeedRewardsActivityList
()
const
fail
=
[]
const
openResult
=
await
commonAwardsService
.
openPrize
(
const
success
=
[]
activityList
,
for
(
let
activity
of
activityList
)
{
PRIZE_DATA_TYPE
.
RANKING
,
const
res
=
await
commonAwardsService
.
openPrize
(
activity
,
PRIZE_DATA_TYPE
.
RANKING
,
'sortKey'
,
'sortTimeKey'
,
200
)
'sortKey'
,
if
(
res
)
{
'sortTimeKey'
,
success
.
push
(
activity
.
_id
)
200
}
else
{
)
fail
.
push
(
activity
.
_id
)
}
}
return
resultsModel
.
success
({
return
resultsModel
.
success
({
fail
,
...
openResult
success
})
})
}
}
}
}
v2.0/src/controller/common/awards.controller.ts
View file @
0bf31793
/** @format */
/** @format */
import
{
services
,
checkParams
,
preCheck
,
registeInfos
}
from
'../../decorator/common'
import
{
services
,
checkParams
,
preCheck
,
registeInfos
,
noCheckUser
}
from
'../../decorator/common'
import
{
import
{
checkPrizeExpired
,
checkPrizeExpired
,
checkValidObjectPrize
,
checkValidObjectPrize
,
...
@@ -8,7 +8,7 @@ import {
...
@@ -8,7 +8,7 @@ import {
}
from
'../../utils/common/check'
}
from
'../../utils/common/check'
import
customUtil
from
'../../utils/custom'
import
customUtil
from
'../../utils/custom'
import
{
resultsModel
}
from
'../../sdk'
import
{
resultsModel
}
from
'../../sdk'
import
{
CommonAwardsService
}
from
'../../service/common'
import
{
CommonAwardsService
,
CommonBaseService
}
from
'../../service/common'
export
default
class
AwardsController
{
export
default
class
AwardsController
{
/**
/**
...
@@ -86,4 +86,26 @@ export default class AwardsController {
...
@@ -86,4 +86,26 @@ export default class AwardsController {
...
commonAwardsDrawLotteryResult1
...
commonAwardsDrawLotteryResult1
})
})
}
}
/**
* 排行榜开奖
*/
@
noCheckUser
@
services
([
CommonBaseService
,
CommonAwardsService
])
async
endOfActivityRewards
(
context
:
IContext
<
IParams
>
,
{
activityInfo
,
userInfo
}:
IControllerInfos
,
[
commonBaseService
,
commonAwardsService
]:
[
CommonBaseService
,
CommonAwardsService
]
)
{
const
commonBaseGetNeedRewardsActivityListResult1
=
await
commonBaseService
.
getNeedRewardsActivityList
()
const
commonAwardsOpenPrizeResult2
=
await
commonAwardsService
.
openPrize
(
commonBaseGetNeedRewardsActivityListResult1
,
1
,
'sortKey'
,
'sortTimeKey'
,
200
)
return
resultsModel
.
success
({
...
commonAwardsOpenPrizeResult2
})
}
}
}
v2.0/src/index.ts
View file @
0bf31793
...
@@ -33,6 +33,7 @@ export default {
...
@@ -33,6 +33,7 @@ export default {
receiveObjectPrize
:
CommonAwardsControllerInstance
.
receiveObjectPrize
,
receiveObjectPrize
:
CommonAwardsControllerInstance
.
receiveObjectPrize
,
receiveEnamePrize
:
CommonAwardsControllerInstance
.
receiveEnamePrize
,
receiveEnamePrize
:
CommonAwardsControllerInstance
.
receiveEnamePrize
,
drawLotteryPrize
:
CommonAwardsControllerInstance
.
drawLotteryPrize
,
drawLotteryPrize
:
CommonAwardsControllerInstance
.
drawLotteryPrize
,
endOfActivityRewards
:
CommonAwardsControllerInstance
.
endOfActivityRewards
,
getShareInfo
:
CommonShareControllerInstance
.
getShareInfo
,
getShareInfo
:
CommonShareControllerInstance
.
getShareInfo
,
doHelp
:
CommonShareControllerInstance
.
doHelp
,
doHelp
:
CommonShareControllerInstance
.
doHelp
,
testAddStat
:
CustomTest1ControllerInstance
.
testAddStat
,
testAddStat
:
CustomTest1ControllerInstance
.
testAddStat
,
...
...
v2.0/src/service/common/awards.service.ts
View file @
0bf31793
...
@@ -325,60 +325,65 @@ export default class AwardsService extends UserService {
...
@@ -325,60 +325,65 @@ export default class AwardsService extends UserService {
* @param sortTimeKey
* @param sortTimeKey
* @param limit
* @param limit
*/
*/
async
openPrize
(
activityInfo
,
prizeDataType
,
sortKey
:
string
,
sortTimeKey
:
string
,
limit
?:
number
)
{
async
openPrize
(
activityList
,
prizeDataType
,
sortKey
:
string
,
sortTimeKey
:
string
,
limit
?:
number
)
{
const
{
_id
}
=
activityInfo
const
fail
=
[]
await
this
.
activitydao
.
update
({
_id
},
{
$set
:
{
openPrizeStatus
:
ACTIVITY_OPEN_PRIZE_STATUS
.
OPENING
}
})
const
success
=
[]
const
prizeConfigList
=
await
this
.
getPrizeConfig
({
for
(
let
activityInfo
of
activityList
)
{
activityId
:
_id
,
const
{
_id
}
=
activityInfo
prizeDataType
await
this
.
activitydao
.
update
({
_id
},
{
$set
:
{
openPrizeStatus
:
ACTIVITY_OPEN_PRIZE_STATUS
.
OPENING
}
})
})
const
prizeConfigList
=
await
this
.
getPrizeConfig
({
const
userList
=
await
this
.
userdao
.
find
<
IUserInfo
>
(
activityId
:
_id
,
{
prizeDataType
activityId
:
_id
})
},
const
userList
=
await
this
.
userdao
.
find
<
IUserInfo
>
(
{
{
sort
:
{
[
sortKey
]:
-
1
,
[
sortTimeKey
]:
1
},
activityId
:
_id
limit
:
limit
||
100
},
}
{
)
sort
:
{
[
sortKey
]:
-
1
,
[
sortTimeKey
]:
1
},
const
prizeList
=
[]
limit
:
limit
||
100
prizeConfigList
.
forEach
(
prizeConfig
=>
{
}
const
{
rank
,
_id
:
prizeId
,
type
,
name
,
image
,
credits
}
=
prizeConfig
)
let
[
min
,
max
]
=
rank
.
split
(
'-'
)
const
prizeList
=
[]
if
(
!
max
)
max
=
min
prizeConfigList
.
forEach
(
prizeConfig
=>
{
for
(
let
i
=
+
min
-
1
;
i
<
+
max
+
1
;
i
++
)
{
const
{
rank
,
_id
:
prizeId
,
type
,
name
,
image
,
credits
}
=
prizeConfig
if
(
userList
[
i
])
{
let
[
min
,
max
]
=
rank
.
split
(
'-'
)
const
{
openId
,
userNick
}
=
userList
[
i
]
if
(
!
max
)
max
=
min
prizeList
.
push
({
for
(
let
i
=
+
min
-
1
;
i
<
+
max
+
1
;
i
++
)
{
openId
,
if
(
userList
[
i
])
{
prizeId
,
const
{
openId
,
userNick
}
=
userList
[
i
]
activityId
:
_id
,
prizeList
.
push
({
drawStatus
:
DRAW_STATUS
.
WAITAWARD
,
openId
,
prizeDataType
,
prizeId
,
remark
:
''
,
activityId
:
_id
,
credits
:
+
credits
,
drawStatus
:
DRAW_STATUS
.
WAITAWARD
,
type
,
prizeDataType
,
name
,
remark
:
''
,
image
,
credits
:
+
credits
,
userNick
,
type
,
createDay
:
getToday
(),
name
,
shipStatus
:
type
===
PRIZE_TYPE
.
OBJECT
?
SHIP_STATUS
.
NO_ADDRESS
:
''
,
image
,
createTime
:
Date
.
now
(),
userNick
,
updateTime
:
Date
.
now
()
createDay
:
getToday
(),
})
shipStatus
:
type
===
PRIZE_TYPE
.
OBJECT
?
SHIP_STATUS
.
NO_ADDRESS
:
''
,
createTime
:
Date
.
now
(),
updateTime
:
Date
.
now
()
})
}
}
}
})
let
result
=
null
if
(
prizeList
.
length
)
{
result
=
await
this
.
awardsdao
.
insertMany
(
prizeList
)
}
if
(
result
)
{
await
this
.
activitydao
.
update
({
_id
},
{
$set
:
{
openPrizeStatus
:
ACTIVITY_OPEN_PRIZE_STATUS
.
SUCCESS
}
})
success
.
push
(
_id
)
}
else
{
await
this
.
activitydao
.
update
({
_id
},
{
$set
:
{
openPrizeStatus
:
ACTIVITY_OPEN_PRIZE_STATUS
.
FAIL
}
})
fail
.
push
(
_id
)
}
}
})
let
result
=
null
if
(
prizeList
.
length
)
{
result
=
await
this
.
awardsdao
.
insertMany
(
prizeList
)
}
if
(
result
)
{
await
this
.
activitydao
.
update
({
_id
},
{
$set
:
{
openPrizeStatus
:
ACTIVITY_OPEN_PRIZE_STATUS
.
SUCCESS
}
})
return
true
}
else
{
await
this
.
activitydao
.
update
({
_id
},
{
$set
:
{
openPrizeStatus
:
ACTIVITY_OPEN_PRIZE_STATUS
.
FAIL
}
})
return
false
}
}
return
{
success
,
fail
}
}
}
}
}
v2.0/src/typings/activityConfig.d.ts
View file @
0bf31793
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
type
IActivityInfo
=
ICommonActivityInfo
&
ICustomActivityInfo
type
IActivityInfo
=
ICommonActivityInfo
&
ICustomActivityInfo
interface
ICustomActivityInfo
{
interface
ICustomActivityInfo
{}
}
interface
ICommonActivityInfo
{
interface
ICommonActivityInfo
{
_id
?:
string
_id
?:
string
id
?:
string
id
?:
string
...
...
v2.0/src/typings/awards.d.ts
View file @
0bf31793
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
type
IAwards
=
ICommonAwards
&
ICustomAwards
type
IAwards
=
ICommonAwards
&
ICustomAwards
interface
ICustomAwards
{
interface
ICustomAwards
{}
}
interface
ICommonAwards
{
interface
ICommonAwards
{
_id
?:
string
_id
?:
string
id
?:
string
id
?:
string
...
...
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