Commit 7a94f72d authored by qinhaitao's avatar qinhaitao

feat: 🎸 调试中奖接口

parent 47033cd2
...@@ -145,28 +145,27 @@ var AwardsController = /** @class */ (function () { ...@@ -145,28 +145,27 @@ var AwardsController = /** @class */ (function () {
var userInfo = _a.userInfo; var userInfo = _a.userInfo;
var awardSer = _b[0]; var awardSer = _b[0];
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var openId, _c, activityId, prizeType, prizesPool, prize, reduceResult, type, _id, ename, image, userNick, record, result; var openId, _c, activityId, prizeDataType, prizesPool, prize, reduceResult, type, _id, ename, image, name, userNick, record, result;
return __generator(this, function (_d) { return __generator(this, function (_d) {
switch (_d.label) { switch (_d.label) {
case 0: case 0:
openId = context.openId; openId = context.openId;
_c = context.data, activityId = _c.activityId, prizeType = _c.prizeType; _c = context.data, activityId = _c.activityId, prizeDataType = _c.prizeDataType;
return [4 /*yield*/, awardSer.getPrizeConfig({ return [4 /*yield*/, awardSer.getPrizeConfig({
activityId: activityId, activityId: activityId,
// 根据需求配置筛选条件 // 根据需求配置筛选条件
prizeType: prizeType prizeDataType: prizeDataType
}) })];
// 根据概率获取
];
case 1: case 1:
prizesPool = _d.sent(); prizesPool = _d.sent();
utils_1.logger(prizesPool);
return [4 /*yield*/, awardSer.getPrizeByProbability(prizesPool) return [4 /*yield*/, awardSer.getPrizeByProbability(prizesPool)
// 未找到奖品,降级到谢谢参与 // 未找到奖品,降级到谢谢参与
]; ];
case 2: case 2:
prize = _d.sent(); prize = _d.sent();
// 未找到奖品,降级到谢谢参与 // 未找到奖品,降级到谢谢参与
if (prize) { if (!prize) {
return [2 /*return*/, sdk_1.resultsModel.success({ return [2 /*return*/, sdk_1.resultsModel.success({
data: { data: {
type: constants_1.PRIZE_TYPE.THANKS, type: constants_1.PRIZE_TYPE.THANKS,
...@@ -184,14 +183,14 @@ var AwardsController = /** @class */ (function () { ...@@ -184,14 +183,14 @@ var AwardsController = /** @class */ (function () {
// 扣库存失败 // 扣库存失败
if (reduceResult.code) if (reduceResult.code)
return [2 /*return*/, sdk_1.resultsModel.error(reduceResult)]; 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; userNick = userInfo.userNick;
record = { record = {
openId: openId, openId: openId,
prizeId: _id, prizeId: _id,
activityId: activityId, activityId: activityId,
drawStatus: constants_1.DRAW_STATUS.WAITAWARD, drawStatus: constants_1.DRAW_STATUS.WAITAWARD,
prizeType: prizeType, prizeDataType: prizeDataType,
remark: '', remark: '',
type: type, type: type,
ename: ename, ename: ename,
...@@ -238,7 +237,7 @@ var AwardsController = /** @class */ (function () { ...@@ -238,7 +237,7 @@ var AwardsController = /** @class */ (function () {
__metadata("design:returntype", Promise) __metadata("design:returntype", Promise)
], AwardsController.prototype, "receiveEnamePrize", null); ], AwardsController.prototype, "receiveEnamePrize", null);
__decorate([ __decorate([
decorator_1.paramsCheck(['activityId', 'prizeType']), decorator_1.paramsCheck(['activityId', 'prizeDataType']),
decorator_1.activityTimeCheck, decorator_1.activityTimeCheck,
decorator_1.services([service_1.AwardsService]), decorator_1.services([service_1.AwardsService]),
__metadata("design:type", Function), __metadata("design:type", Function),
......
{"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,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n: (context: Context) => void;
export declare const recordErrorLog: (context: Context, baseInfos: IControllerInfos, errorMsg: string, stack: string) => Promise<any>; 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;
...@@ -79,7 +79,11 @@ exports.recordErrorLog = function (context, baseInfos, errorMsg, stack) { return ...@@ -79,7 +79,11 @@ exports.recordErrorLog = function (context, baseInfos, errorMsg, stack) { return
}); });
}); }; }); };
// 本地mock 增加颜色辨识度 // 本地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', "-------------------\u65E5\u5FD7----------------------------");
console.log('\x1b[36m%s\x1b[0m', JSON.stringify(message, null, 2)); console.log('\x1b[36m%s\x1b[0m', JSON.stringify(message, null, 2));
console.log('\x1b[36m%s\x1b[0m', "-------------------\u65E5\u5FD7----------------------------"); console.log('\x1b[36m%s\x1b[0m', "-------------------\u65E5\u5FD7----------------------------");
......
{"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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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;IAAC,iBAAe;SAAf,UAAe,EAAf,qBAAe,EAAf,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 \ No newline at end of file
...@@ -4,7 +4,7 @@ import { services, paramsCheck, userCheck, activityTimeCheck } from '../decorato ...@@ -4,7 +4,7 @@ import { services, paramsCheck, userCheck, activityTimeCheck } from '../decorato
import { resultsModel } from '../sdk' import { resultsModel } from '../sdk'
import { AwardsService } from '../service' import { AwardsService } from '../service'
import { PRIZE_TYPE, PRIZE_DATA_TYPE, DRAW_STATUS } from '../constants' import { PRIZE_TYPE, PRIZE_DATA_TYPE, DRAW_STATUS } from '../constants'
import { getToday } from '../utils' import { getToday, logger } from '../utils'
export default class AwardsController { export default class AwardsController {
/** /**
* 我的奖品列表 * 我的奖品列表
...@@ -73,25 +73,26 @@ export default class AwardsController { ...@@ -73,25 +73,26 @@ export default class AwardsController {
/** /**
* 概率抽奖 * 概率抽奖
*/ */
@paramsCheck(['activityId', 'prizeType']) @paramsCheck(['activityId', 'prizeDataType'])
@activityTimeCheck @activityTimeCheck
@services([AwardsService]) @services([AwardsService])
async drawLotteryPrize(context: Context, { userInfo }: IControllerInfos, [awardSer]: [AwardsService]) { async drawLotteryPrize(context: Context, { userInfo }: IControllerInfos, [awardSer]: [AwardsService]) {
const { openId } = context const { openId } = context
const { activityId, prizeType } = context.data const { activityId, prizeDataType } = context.data
// 获取奖池配置 // 获取奖池配置
const prizesPool = await awardSer.getPrizeConfig({ const prizesPool = await awardSer.getPrizeConfig({
activityId, activityId,
// 根据需求配置筛选条件 // 根据需求配置筛选条件
prizeType prizeDataType
}) })
logger(prizesPool)
// 根据概率获取 // 根据概率获取
const prize = await awardSer.getPrizeByProbability(prizesPool) const prize = await awardSer.getPrizeByProbability(prizesPool)
// 未找到奖品,降级到谢谢参与 // 未找到奖品,降级到谢谢参与
if (prize) { if (!prize) {
return resultsModel.success({ return resultsModel.success({
data: { data: {
type: PRIZE_TYPE.THANKS, type: PRIZE_TYPE.THANKS,
...@@ -110,7 +111,7 @@ export default class AwardsController { ...@@ -110,7 +111,7 @@ export default class AwardsController {
// 扣库存失败 // 扣库存失败
if ((reduceResult as ICodeType).code) return resultsModel.error(reduceResult as ICodeType) 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 const { userNick } = userInfo
let record = { let record = {
...@@ -118,7 +119,7 @@ export default class AwardsController { ...@@ -118,7 +119,7 @@ export default class AwardsController {
prizeId: _id, prizeId: _id,
activityId, activityId,
drawStatus: DRAW_STATUS.WAITAWARD, drawStatus: DRAW_STATUS.WAITAWARD,
prizeType, prizeDataType,
remark: '', remark: '',
type, type,
ename, ename,
......
...@@ -45,7 +45,7 @@ export const recordErrorLog = async ( ...@@ -45,7 +45,7 @@ export const recordErrorLog = async (
} }
// 本地mock 增加颜色辨识度 // 本地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', `-------------------日志----------------------------`)
console.log('\x1b[36m%s\x1b[0m', JSON.stringify(message, null, 2)) console.log('\x1b[36m%s\x1b[0m', JSON.stringify(message, null, 2))
console.log('\x1b[36m%s\x1b[0m', `-------------------日志----------------------------`) console.log('\x1b[36m%s\x1b[0m', `-------------------日志----------------------------`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment