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
7a94f72d
Commit
7a94f72d
authored
Aug 27, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
🎸
调试中奖接口
parent
47033cd2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
22 deletions
+26
-22
awards.controller.js
v2.0/dist/controller/awards.controller.js
+9
-10
awards.controller.js.map
v2.0/dist/controller/awards.controller.js.map
+1
-1
logger.d.ts
v2.0/dist/utils/package/logger.d.ts
+1
-1
logger.js
v2.0/dist/utils/package/logger.js
+5
-1
logger.js.map
v2.0/dist/utils/package/logger.js.map
+1
-1
awards.controller.ts
v2.0/src/controller/awards.controller.ts
+8
-7
logger.ts
v2.0/src/utils/package/logger.ts
+1
-1
No files found.
v2.0/dist/controller/awards.controller.js
View file @
7a94f72d
...
...
@@ -145,28 +145,27 @@ var AwardsController = /** @class */ (function () {
var
userInfo
=
_a
.
userInfo
;
var
awardSer
=
_b
[
0
];
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
openId
,
_c
,
activityId
,
prize
Type
,
prizesPool
,
prize
,
reduceResult
,
type
,
_id
,
ename
,
imag
e
,
userNick
,
record
,
result
;
var
openId
,
_c
,
activityId
,
prize
DataType
,
prizesPool
,
prize
,
reduceResult
,
type
,
_id
,
ename
,
image
,
nam
e
,
userNick
,
record
,
result
;
return
__generator
(
this
,
function
(
_d
)
{
switch
(
_d
.
label
)
{
case
0
:
openId
=
context
.
openId
;
_c
=
context
.
data
,
activityId
=
_c
.
activityId
,
prize
Type
=
_c
.
prize
Type
;
_c
=
context
.
data
,
activityId
=
_c
.
activityId
,
prize
DataType
=
_c
.
prizeData
Type
;
return
[
4
/*yield*/
,
awardSer
.
getPrizeConfig
({
activityId
:
activityId
,
// 根据需求配置筛选条件
prizeType
:
prizeType
})
// 根据概率获取
];
prizeDataType
:
prizeDataType
})];
case
1
:
prizesPool
=
_d
.
sent
();
utils_1
.
logger
(
prizesPool
);
return
[
4
/*yield*/
,
awardSer
.
getPrizeByProbability
(
prizesPool
)
// 未找到奖品,降级到谢谢参与
];
case
2
:
prize
=
_d
.
sent
();
// 未找到奖品,降级到谢谢参与
if
(
prize
)
{
if
(
!
prize
)
{
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
success
({
data
:
{
type
:
constants_1
.
PRIZE_TYPE
.
THANKS
,
...
...
@@ -184,14 +183,14 @@ var AwardsController = /** @class */ (function () {
// 扣库存失败
if
(
reduceResult
.
code
)
return
[
2
/*return*/
,
sdk_1
.
resultsModel
.
error
(
reduceResult
)];
type
=
prize
.
type
,
_id
=
prize
.
_id
,
ename
=
prize
.
ename
,
image
=
prize
.
image
;
type
=
prize
.
type
,
_id
=
prize
.
_id
,
ename
=
prize
.
ename
,
image
=
prize
.
image
,
name
=
prize
.
name
;
userNick
=
userInfo
.
userNick
;
record
=
{
openId
:
openId
,
prizeId
:
_id
,
activityId
:
activityId
,
drawStatus
:
constants_1
.
DRAW_STATUS
.
WAITAWARD
,
prize
Type
:
prize
Type
,
prize
DataType
:
prizeData
Type
,
remark
:
''
,
type
:
type
,
ename
:
ename
,
...
...
@@ -238,7 +237,7 @@ var AwardsController = /** @class */ (function () {
__metadata
(
"design:returntype"
,
Promise
)
],
AwardsController
.
prototype
,
"receiveEnamePrize"
,
null
);
__decorate
([
decorator_1
.
paramsCheck
([
'activityId'
,
'prizeType'
]),
decorator_1
.
paramsCheck
([
'activityId'
,
'prize
Data
Type'
]),
decorator_1
.
activityTimeCheck
,
decorator_1
.
services
([
service_1
.
AwardsService
]),
__metadata
(
"design:type"
,
Function
),
...
...
v2.0/dist/controller/awards.controller.js.map
View file @
7a94f72d
{"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;gCACb,IAAI,MAAA;gCACJ,KAAK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GAAG,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,EAAE,WAAW,CAAC,CAAC;QACxC,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,kCAA2C;AAC3C;IAAA;IAsIA,CAAC;IArIC;;OAEG;IAIG,yCAAc,GAApB,UAAqB,OA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AAM,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,EAAE,eAAe,CAAC,CAAC;QAC5C,6BAAiB;QACjB,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;4DA+DzB;IACH,uBAAC;CAAA,AAtID,IAsIC;kBAtIoB,gBAAgB"}
\ No newline at end of file
v2.0/dist/utils/package/logger.d.ts
View file @
7a94f72d
export
declare
const
logFn
:
(
context
:
Context
)
=>
void
;
export
declare
const
recordErrorLog
:
(
context
:
Context
,
baseInfos
:
IControllerInfos
,
errorMsg
:
string
,
stack
:
string
)
=>
Promise
<
any
>
;
export
declare
const
logger
:
(
message
:
any
)
=>
void
;
export
declare
const
logger
:
(
...
message
:
any
)
=>
void
;
v2.0/dist/utils/package/logger.js
View file @
7a94f72d
...
...
@@ -79,7 +79,11 @@ exports.recordErrorLog = function (context, baseInfos, errorMsg, stack) { return
});
});
};
// 本地mock 增加颜色辨识度
exports
.
logger
=
function
(
message
)
{
exports
.
logger
=
function
()
{
var
message
=
[];
for
(
var
_i
=
0
;
_i
<
arguments
.
length
;
_i
++
)
{
message
[
_i
]
=
arguments
[
_i
];
}
console
.
log
(
'
\
x1b[36m%s
\
x1b[0m'
,
"-------------------
\
u65E5
\
u5FD7----------------------------"
);
console
.
log
(
'
\
x1b[36m%s
\
x1b[0m'
,
JSON
.
stringify
(
message
,
null
,
2
));
console
.
log
(
'
\
x1b[36m%s
\
x1b[0m'
,
"-------------------
\
u65E5
\
u5FD7----------------------------"
);
...
...
v2.0/dist/utils/package/logger.js.map
View file @
7a94f72d
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/package/logger.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,iCAAmC;AACnC,+BAA4C;AAC5C,qCAAsC;AAEzB,QAAA,KAAK,GAAG,UAAC,OAAgB;;IACpC,IAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACzC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACpB,OAAO,CAAC,GAAG,CACT,6BAAgB,OAAO,CAAC,MAAM,IAAI,EAAE,WAClC,mBAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,SAAS,0CAAE,OAAO,0CAAE,OAAO,KAAI,OAAO,CAAC,OAAO,kBAClD,CACf,CAAA;IACD,OAAO,CAAC,GAAG,CAAC,wCAAkB,IAAI,iBAAc,CAAC,CAAA;AACnD,CAAC,CAAA;AAED,SAAS;AACI,QAAA,cAAc,GAAG,UAC5B,OAAgB,EAChB,SAA2B,EAC3B,QAAgB,EAChB,KAAa;;;;;;gBAEL,MAAM,GAAK,OAAO,OAAZ,CAAY;gBAClB,UAAU,GAAK,CAAA,OAAO,CAAC,IAAI,IAAI,EAAE,CAAA,WAAvB,CAAuB;gBACjC,QAAQ,GAAK,SAAS,SAAd,CAAc;gBACtB,QAAQ,GAAK,CAAA,QAAQ,IAAI,EAAE,CAAA,SAAnB,CAAmB;gBAC7B,MAAM,GAAa,IAAI,aAAO,CAAC,OAAO,EAAE,sBAAiB,CAAC,CAAA;gBAC1D,YAAY,GAAW,CAAG,OAAO,CAAC,MAAM,IAAI,EAAE,WAClD,mBAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,SAAS,0CAAE,OAAO,0CAAE,OAAO,KAAI,OAAO,CAAC,OAAO,CAC9D,CAAA;gBACK,qBAAM,MAAM,CAAC,SAAS,CAAC;wBAC5B,MAAM,QAAA;wBACN,UAAU,YAAA;wBACV,QAAQ,UAAA;wBACR,UAAU,EAAE,KAAK;wBACjB,YAAY,cAAA;wBACZ,QAAQ,UAAA;wBACR,UAAU,EAAE,OAAO,CAAC,UAAU;wBAC9B,MAAM,EAAE,OAAO,CAAC,IAAI;wBACpB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;wBACtB,SAAS,EAAE,gBAAQ,EAAE;wBACrB,SAAS,EAAE,CAAC;qBACb,CAAC,EAAA;oBAZF,sBAAO,SAYL,EAAA;;;KACH,CAAA;AAED,iBAAiB;AACJ,QAAA,MAAM,GAAG,UAAC,OAAY;IACjC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,6DAAmD,CAAC,CAAA;IACrF,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IAClE,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,6DAAmD,CAAC,CAAA;IAErF,+DAA+D;AACjE,CAAC,CAAA"}
\ No newline at end of file
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/package/logger.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,iCAAmC;AACnC,+BAA4C;AAC5C,qCAAsC;AAEzB,QAAA,KAAK,GAAG,UAAC,OAAgB;;IACpC,IAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACzC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACpB,OAAO,CAAC,GAAG,CACT,6BAAgB,OAAO,CAAC,MAAM,IAAI,EAAE,WAClC,mBAAA,OAAO,aAAP,OAAO,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AAf,IAAe;QAAf,4BAAe;;IACpC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,6DAAmD,CAAC,CAAA;IACrF,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IAClE,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,6DAAmD,CAAC,CAAA;IAErF,+DAA+D;AACjE,CAAC,CAAA"}
\ No newline at end of file
v2.0/src/controller/awards.controller.ts
View file @
7a94f72d
...
...
@@ -4,7 +4,7 @@ import { services, paramsCheck, userCheck, activityTimeCheck } from '../decorato
import
{
resultsModel
}
from
'../sdk'
import
{
AwardsService
}
from
'../service'
import
{
PRIZE_TYPE
,
PRIZE_DATA_TYPE
,
DRAW_STATUS
}
from
'../constants'
import
{
getToday
}
from
'../utils'
import
{
getToday
,
logger
}
from
'../utils'
export
default
class
AwardsController
{
/**
* 我的奖品列表
...
...
@@ -73,25 +73,26 @@ export default class AwardsController {
/**
* 概率抽奖
*/
@
paramsCheck
([
'activityId'
,
'prizeType'
])
@
paramsCheck
([
'activityId'
,
'prize
Data
Type'
])
@
activityTimeCheck
@
services
([
AwardsService
])
async
drawLotteryPrize
(
context
:
Context
,
{
userInfo
}:
IControllerInfos
,
[
awardSer
]:
[
AwardsService
])
{
const
{
openId
}
=
context
const
{
activityId
,
prizeType
}
=
context
.
data
const
{
activityId
,
prize
Data
Type
}
=
context
.
data
// 获取奖池配置
const
prizesPool
=
await
awardSer
.
getPrizeConfig
({
activityId
,
// 根据需求配置筛选条件
prizeType
prize
Data
Type
})
logger
(
prizesPool
)
// 根据概率获取
const
prize
=
await
awardSer
.
getPrizeByProbability
(
prizesPool
)
// 未找到奖品,降级到谢谢参与
if
(
prize
)
{
if
(
!
prize
)
{
return
resultsModel
.
success
({
data
:
{
type
:
PRIZE_TYPE
.
THANKS
,
...
...
@@ -110,7 +111,7 @@ export default class AwardsController {
// 扣库存失败
if
((
reduceResult
as
ICodeType
).
code
)
return
resultsModel
.
error
(
reduceResult
as
ICodeType
)
const
{
type
,
_id
,
ename
,
image
}
=
prize
const
{
type
,
_id
,
ename
,
image
,
name
}
=
prize
const
{
userNick
}
=
userInfo
let
record
=
{
...
...
@@ -118,7 +119,7 @@ export default class AwardsController {
prizeId
:
_id
,
activityId
,
drawStatus
:
DRAW_STATUS
.
WAITAWARD
,
prizeType
,
prize
Data
Type
,
remark
:
''
,
type
,
ename
,
...
...
v2.0/src/utils/package/logger.ts
View file @
7a94f72d
...
...
@@ -45,7 +45,7 @@ export const recordErrorLog = async (
}
// 本地mock 增加颜色辨识度
export const logger = (message: any) => {
export const logger = (
...
message: any) => {
console.log('\x1b[36m%s\x1b[0m', `
-------------------
日志
----------------------------
`)
console.log('\x1b[36m%s\x1b[0m', JSON.stringify(message, null, 2))
console.log('\x1b[36m%s\x1b[0m', `
-------------------
日志
----------------------------
`)
...
...
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