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
ecebb46c
Commit
ecebb46c
authored
Aug 27, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
🎸
抽奖接口暴露prizeDatatype参数
parent
ee157e51
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
awards.controller.js
v2.0/dist/controller/awards.controller.js
+13
-13
awards.controller.js.map
v2.0/dist/controller/awards.controller.js.map
+1
-1
awards.controller.ts
v2.0/src/controller/awards.controller.ts
+5
-5
No files found.
v2.0/dist/controller/awards.controller.js
View file @
ecebb46c
...
...
@@ -145,26 +145,26 @@ var AwardsController = /** @class */ (function () {
var
userInfo
=
_a
.
userInfo
;
var
awardSer
=
_b
[
0
];
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
openId
,
activityId
,
prizesPool
,
prize
,
reduceResult
,
type
,
_id
,
ename
,
image
,
userNick
,
record
,
result
;
return
__generator
(
this
,
function
(
_
c
)
{
switch
(
_
c
.
label
)
{
var
openId
,
_c
,
activityId
,
prizeDataType
,
prizesPool
,
prize
,
reduceResult
,
type
,
_id
,
ename
,
image
,
userNick
,
record
,
result
;
return
__generator
(
this
,
function
(
_
d
)
{
switch
(
_
d
.
label
)
{
case
0
:
openId
=
context
.
openId
;
activityId
=
context
.
data
.
activityId
;
_c
=
context
.
data
,
activityId
=
_c
.
activityId
,
prizeDataType
=
_c
.
prizeDataType
;
return
[
4
/*yield*/
,
awardSer
.
getPrizeConfig
({
activityId
:
activityId
activityId
:
activityId
,
// 根据需求配置筛选条件
// prizeDataType: PRIZE_DATA_TYPE.PROBABILITY
prizeDataType
:
prizeDataType
})
// 根据概率获取
];
case
1
:
prizesPool
=
_
c
.
sent
();
prizesPool
=
_
d
.
sent
();
return
[
4
/*yield*/
,
awardSer
.
getPrizeByProbability
(
prizesPool
)
// 未找到奖品,降级到谢谢参与
];
case
2
:
prize
=
_
c
.
sent
();
prize
=
_
d
.
sent
();
// 未找到奖品,降级到谢谢参与
if
(
prize
)
{
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
success
({
...
...
@@ -178,8 +178,8 @@ var AwardsController = /** @class */ (function () {
if
(
!
(
prize
.
type
!==
constants_1
.
PRIZE_TYPE
.
CREDITS
))
return
[
3
/*break*/
,
4
];
return
[
4
/*yield*/
,
awardSer
.
reduceStock
(
prize
.
_id
)];
case
3
:
reduceResult
=
_
c
.
sent
();
_
c
.
label
=
4
;
reduceResult
=
_
d
.
sent
();
_
d
.
label
=
4
;
case
4
:
// 扣库存失败
if
(
reduceResult
.
code
)
...
...
@@ -191,7 +191,7 @@ var AwardsController = /** @class */ (function () {
prizeId
:
_id
,
activityId
:
activityId
,
drawStatus
:
constants_1
.
DRAW_STATUS
.
WAITAWARD
,
//
prizeDataType,
prizeDataType
:
prizeDataType
,
remark
:
''
,
type
:
type
,
ename
:
ename
,
...
...
@@ -202,7 +202,7 @@ var AwardsController = /** @class */ (function () {
};
return
[
4
/*yield*/
,
awardSer
.
addAward
(
record
)];
case
5
:
result
=
_
c
.
sent
();
result
=
_
d
.
sent
();
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
success
({
id
:
result
,
type
:
type
,
...
...
@@ -238,7 +238,7 @@ var AwardsController = /** @class */ (function () {
__metadata
(
"design:returntype"
,
Promise
)
],
AwardsController
.
prototype
,
"receiveEnamePrize"
,
null
);
__decorate
([
decorator_1
.
paramsCheck
([
'activityId'
]),
decorator_1
.
paramsCheck
([
'activityId'
,
'prizeDataType'
]),
decorator_1
.
activityTimeCheck
,
decorator_1
.
services
([
service_1
.
AwardsService
]),
__metadata
(
"design:type"
,
Function
),
...
...
v2.0/dist/controller/awards.controller.js.map
View file @
ecebb46c
{"version":3,"file":"awards.controller.js","sourceRoot":"","sources":["../../src/controller/awards.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,0CAAkF;AAClF,8BAAqC;AACrC,sCAA0C;AAC1C,0CAAuE;AACvE,kCAAmC;AACnC;IAAA;IAqIA,CAAC;IApIC;;OAEG;IAIG,yCAAc,GAApB,UAAqB,OAAgB,EAAE,EAAE,EAAE,EAA2B;YAA1B,QAAQ,QAAA;;;;;;wBAEhD,MAAM,GAEJ,OAAO,OAFH,EACE,UAAU,GAChB,OAAO,gBADS,CACT;wBACE,qBAAM,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,QAAA,EAAE,UAAU,YAAA,EAAE,CAAC,EAAA;;wBAA9D,MAAM,GAAG,SAAqD;wBAClE,sBAAO,kBAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAA;;;;KACpC;IAED;;OAEG;IAIG,6CAAkB,GAAxB,UAAyB,OAAgB,EAAE,EAAE,EAAE,EAA2B;YAA1B,QAAQ,QAAA;;;;;;wBAClD,KAAwE,OAAO,CAAC,IAAI,EAAlF,QAAQ,cAAA,EAAE,IAAI,UAAA,EAAE,IAAI,UAAA,EAAE,aAAa,mBAAA,EAAE,GAAG,SAAA,EAAE,IAAI,UAAA,EAAE,KAAK,WAAA,EAAE,UAAU,gBAAA,CAAiB;wBAE3E,qBAAM,QAAQ,CAAC,kBAAkB,CAAC,GAAG,EAAE;gCAClD,UAAU,YAAA;gCACV,QAAQ,UAAA;gCACR,IAAI,MAAA;gCACJ,IAAI,MAAA;gCACJ,aAAa,eAAA;gC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AG,SAA+B;wBAE9C,sBAAO,kBAAY,CAAC,OAAO,CAAC;gCAC1B,EAAE,EAAE,MAAM;gCACV,IAAI,MAAA;gCACJ,IAAI,MAAA;gCACJ,KAAK,OAAA;6BACN,CAAC,EAAA;;;;KACH;IA7HD;QAHC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;0DAQzB;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;QAChG,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;8DAmBzB;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAClC,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;6DAgBzB;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,6BAAiB;QACjB,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;4DA8DzB;IACH,uBAAC;CAAA,AArID,IAqIC;kBArIoB,gBAAgB"}
\ No newline at end of file
{"version":3,"file":"awards.controller.js","sourceRoot":"","sources":["../../src/controller/awards.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,0CAAkF;AAClF,8BAAqC;AACrC,sCAA0C;AAC1C,0CAAuE;AACvE,kCAAmC;AACnC;IAAA;IAqIA,CAAC;IApIC;;OAEG;IAIG,yCAAc,GAApB,UAAqB,OAAgB,EAAE,EAA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QAChG,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;8DAmBzB;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAClC,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;6DAgBzB;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;QAC5C,6BAAiB;QACjB,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;4DA8DzB;IACH,uBAAC;CAAA,AArID,IAqIC;kBArIoB,gBAAgB"}
\ No newline at end of file
v2.0/src/controller/awards.controller.ts
View file @
ecebb46c
...
...
@@ -73,18 +73,18 @@ export default class AwardsController {
/**
* 概率抽奖
*/
@
paramsCheck
([
'activityId'
])
@
paramsCheck
([
'activityId'
,
'prizeDataType'
])
@
activityTimeCheck
@
services
([
AwardsService
])
async
drawLotteryPrize
(
context
:
Context
,
{
userInfo
}:
IControllerInfos
,
[
awardSer
]:
[
AwardsService
])
{
const
{
openId
}
=
context
const
{
activityId
}
=
context
.
data
const
{
activityId
,
prizeDataType
}
=
context
.
data
// 获取奖池配置
const
prizesPool
=
await
awardSer
.
getPrizeConfig
({
activityId
activityId
,
// 根据需求配置筛选条件
// prizeDataType: PRIZE_DATA_TYPE.PROBABILITY
prizeDataType
})
// 根据概率获取
...
...
@@ -118,7 +118,7 @@ export default class AwardsController {
prizeId
:
_id
,
activityId
,
drawStatus
:
DRAW_STATUS
.
WAITAWARD
,
//
prizeDataType,
prizeDataType
,
remark
:
''
,
type
,
ename
,
...
...
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