Commit 716daf38 authored by qinhaitao's avatar qinhaitao

refactor: 💡 export 方式

parents e675b763 d0b32ac5
/** @format */
import commonDecorator, { services } from '../../decorator/common'
import commonUtil from '../../utils/common'
import { resultsModel } from '../../sdk'
import { AwardsService } from '../../service'
import { PRIZE_TYPE, DRAW_STATUS, CODE_TYPES } from '../../constants'
import { getToday } from '../../utils/'
import { CodeType } from 'taobao-mini-sdk/lib/utils/codetypes'
import { checkActivityTime } from '../../utils/common/check/checkActivityTime'
export interface IPrizeListParams {
activityId: string
}
export interface IReceiveOjectParams {
activityId: string
id: string
name: string
phone: string
province: string
city: string
area: string
addressDetail: string
streetName: string
}
export interface IReceiveEnameParams {
activityId: string
id: string
}
export default class AwardsController {
/**
* 我的奖品列表
*/
{%- for decorator in model.getMyPrizeList.decorators %}
@{{ decorator.type }}Decorator.{{ decorator.name }}([{% for param in decorator.params -%}'{{ param }}',{%- endfor %}])
{%- endfor %}
@services([AwardsService])
async getMyPrizeList(
context: IContext<IPrizeListParams>,
[awardSer]: [AwardsService]
): Promise<IResult<{ list: IAwards[] }>> {
const {
openId,
data: { activityId }
} = context
const { awardReceiveExpiredTime } = activityInfo
const myPrizeList = await awardSer.getAwardsInfoList(
{
openId,
activityId,
type: { $ne: PRIZE_TYPE.THANKS }
},
{
projection: {
_id: 1,
name: 1,
image: 1,
type: 1,
drawStatus: 1,
shipStatus: 1,
receiveName: 1,
phone: 1,
address: 1,
provice: 1,
city: 1,
area: 1,
remark: 1,
useUrk: 1,
shipCompany: 1,
shipNum: 1
},
sort: {
createTime: -1
}
}
)
return resultsModel.success({
list: awardSer.formateMyPrizeList(myPrizeList, awardReceiveExpiredTime)
})
}
/**
* 领取实物
*/
@checkParams(['activityId', 'id', 'name', 'phone', 'province', 'city', 'area', 'addressDetail', 'streetName'])
@services([AwardsService])
async receiveObjectPrize(
context: IContext<IReceiveOjectParams>,
{ activityInfo }: IControllerInfos,
[awardSer]: [AwardsService]
): Promise<IResult<boolean>> {
let { province, city, area, streetName, addressDetail, id, name, phone, activityId } = context.data
// 若有过期时间,且已过期
let { awardReceiveExpiredTime } = activityInfo
if (awardReceiveExpiredTime && Date.now() > awardReceiveExpiredTime) {
return resultsModel.error(CODE_TYPES.ERROR_PRIZE_EXPIRED)
}
let result = await awardSer.recieveObjectPrize(id, {
activityId,
province,
city,
area,
streetName,
addressDetail,
name,
phone
})
if ((result as CodeType).code) {
return resultsModel.error(result as CodeType)
}
return resultsModel.success(result as true)
}
/**
* 权益重新领取
*/
@checkParams(['activityId', 'id'])
@services([AwardsService])
async receiveEnamePrize(context: IContext<IReceiveEnameParams>, {}, [awardSer]: [AwardsService]) {
let { id, activityId } = context.data
let result = await awardSer.recieveEnamePrize(id, activityId)
if ((result as CodeType).code) {
return resultsModel.error(result as CodeType)
}
if ((result as IAwards).remark) {
return resultsModel.error(CODE_TYPES.SYSTEM_ERROR, (result as IAwards).remark)
}
return resultsModel.success(result)
}
/**
* 概率抽奖
*/
@checkParams(['activityId', 'prizeDataType'])
@services([AwardsService])
@preCheck([checkActivityTime])
async drawLotteryPrize(context: IContext<IParams>, { userInfo }: IControllerInfos, [awardSer]: [AwardsService]) {
const { openId } = context
const { activityId, prizeDataType } = context.data
// 获取奖池配置
const prizesPool = await awardSer.getPrizeConfig({
activityId,
// 根据需求配置筛选条件
prizeDataType
})
const thanksPrize = prizesPool.find(v => v.type === PRIZE_TYPE.THANKS) || {
type: PRIZE_TYPE.THANKS,
prizeDataType,
name: '谢谢参与'
}
// 根据概率获取
let prize = await awardSer.getPrizeByProbability(prizesPool)
// 未找到奖品,降级到谢谢参与
if (!prize) {
prize = thanksPrize
}
let reduceResult: ICodeType | number = 1
// 不是积分奖品, 检查是否扣库存
if (prize.type !== PRIZE_TYPE.CREDITS && prize.type !== PRIZE_TYPE.THANKS) {
reduceResult = await awardSer.reduceStock(prize._id)
}
// 扣库存失败降级到谢谢参与
if ((reduceResult as ICodeType)?.code || !reduceResult) {
prize = thanksPrize
}
const { type, _id, ename, image, name, useUrl } = prize
const { userNick } = userInfo
let record = {
openId,
prizeId: _id,
activityId,
drawStatus: DRAW_STATUS.WAITAWARD,
prizeDataType,
remark: '',
useUrl,
type,
ename,
name,
image,
userNick,
createDay: getToday()
}
// 奖品信息 insert c_awards表
const result = await awardSer.addAward(record)
return resultsModel.success({
id: result,
type,
name,
image
})
}
}
\ No newline at end of file
...@@ -52,9 +52,7 @@ var service_1 = require("../service"); ...@@ -52,9 +52,7 @@ var service_1 = require("../service");
var constants_1 = require("../constants"); var constants_1 = require("../constants");
var utils_1 = require("../utils/"); var utils_1 = require("../utils/");
var preCheck_1 = require("../decorator/common/preCheck"); var preCheck_1 = require("../decorator/common/preCheck");
var checkActivityTime_1 = require("../utils/common/check/checkActivityTime"); var check_1 = require("../utils/common/check/");
var checkPrizeExpired_1 = require("../utils/common/check/checkPrizeExpired");
var checkValidPrize_1 = require("../utils/common/check/checkValidPrize");
var AwardsController = /** @class */ (function () { var AwardsController = /** @class */ (function () {
function AwardsController() { function AwardsController() {
} }
...@@ -250,7 +248,7 @@ var AwardsController = /** @class */ (function () { ...@@ -250,7 +248,7 @@ var AwardsController = /** @class */ (function () {
__decorate([ __decorate([
common_1.checkParams(['activityId', 'id', 'name', 'phone', 'province', 'city', 'area', 'addressDetail', 'streetName']), common_1.checkParams(['activityId', 'id', 'name', 'phone', 'province', 'city', 'area', 'addressDetail', 'streetName']),
common_1.services([service_1.AwardsService]), common_1.services([service_1.AwardsService]),
preCheck_1.preCheck([checkPrizeExpired_1.checkPrizeExpired, checkValidPrize_1.checkValidPrize([constants_1.PRIZE_TYPE.OBJECT])]), preCheck_1.default([check_1.checkPrizeExpired]),
__metadata("design:type", Function), __metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]), __metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise) __metadata("design:returntype", Promise)
...@@ -259,7 +257,7 @@ var AwardsController = /** @class */ (function () { ...@@ -259,7 +257,7 @@ var AwardsController = /** @class */ (function () {
common_1.checkParams(['activityId', 'id']), common_1.checkParams(['activityId', 'id']),
common_1.registeInfos(['session']), common_1.registeInfos(['session']),
common_1.services([service_1.AwardsService]), common_1.services([service_1.AwardsService]),
preCheck_1.preCheck([checkPrizeExpired_1.checkPrizeExpired, checkValidPrize_1.checkValidPrize([constants_1.PRIZE_TYPE.ENAME, constants_1.PRIZE_TYPE.CREDITS])]), preCheck_1.default([check_1.checkPrizeExpired]),
__metadata("design:type", Function), __metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]), __metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise) __metadata("design:returntype", Promise)
...@@ -267,7 +265,7 @@ var AwardsController = /** @class */ (function () { ...@@ -267,7 +265,7 @@ var AwardsController = /** @class */ (function () {
__decorate([ __decorate([
common_1.checkParams(['activityId', 'prizeDataType']), common_1.checkParams(['activityId', 'prizeDataType']),
common_1.services([service_1.AwardsService]), common_1.services([service_1.AwardsService]),
preCheck_1.preCheck([checkActivityTime_1.checkActivityTime]), preCheck_1.default([check_1.checkActivityTime]),
__metadata("design:type", Function), __metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]), __metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise) __metadata("design:returntype", Promise)
......
{"version":3,"file":"awards.controller.js","sourceRoot":"","sources":["../../src/controller/awards.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,8CAAyE;AACzE,8BAAqC;AACrC,sCAA0C;AAC1C,0CAAkE;AAClE,mCAAoC;AAEpC,yDAAuD;AACvD,6EAA2E;AAC3E,6EAA2E;AAC3E,yEAAuE;AA2BvE;IAAA;IAoLA,CAAC;IAnLC;;OAEG;IAGG,yCAAc,GAApB,UACE,OAAmC,EACnC,EAAkC,EAClC,EAA2B;YADzB,YAAY,kBAAA;YACb,QAAQ,QAAA;;;;;;wBAGP,MAAM,GAEJ,OAAO,O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C,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;QAC5C,iBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;QACzB,mBAAQ,CAAC,CAAC,qCAAiB,CAAC,CAAC;;;;4DAkE7B;IACH,uBAAC;CAAA,AApLD,IAoLC;kBApLoB,gBAAgB"} {"version":3,"file":"awards.controller.js","sourceRoot":"","sources":["../../src/controller/awards.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,8CAAyE;AACzE,8BAAqC;AACrC,sCAA0C;AAC1C,0CAAkE;AAClE,mCAAoC;AAEpC,yDAAmD;AACnD,gDAA8F;AA2B9F;IAAA;IAoLA,CAAC;IAnLC;;OAEG;IAGG,yCAAc,GAApB,UACE,OAAmC,EACnC,EAAkC,EAClC,EAA2B;YADzB,YAAY,kBAAA;YACb,QAAQ,QAAA;;;;;;wBAGP,MAAM,GAEJ,OAAO,OAFH,EACE,UAAU,GAChB,OAAO,gBADS,CACT;wBAEH,uBAAuB,GAAK,YAAY,wBAAjB,CAAiB;wBAE5B,qBAAM,QAAQ,CAAC,iBAAiB,CAClD;gCACE,MAAM,QAAA;gCACN,UAAU,YAAA;gCACV,IAAI,EAAE,EAAE,GAAG,EAAE,sBAAU,CAAC,MAAM,EAAE;6BACjC,EACD;gCACE,UAAU,EAAE;oCACV,GAAG,EAAE,CAAC;oCACN,IAAI,EAAE,CAAC;oCACP,KAAK,EAAE,CAAC;oCACR,IAAI,EAAE,CAAC;oCACP,UAAU,EAAE,CAAC;oCACb,UAAU,EAAE,CAAC;oCACb,WAAW,EAAE,CAAC;oCACd,KAAK,EAAE,CAAC;oCACR,OAAO,EAAE,CAAC;oCACV,OAAO,EAAE,CAAC;oCACV,IAAI,EAAE,CAAC;oCACP,IAAI,EAAE,CAAC;oCACP,MAAM,EAAE,CAAC;oCACT,MAAM,EAAE,CAAC;oCACT,WAAW,EAAE,CAAC;oCACd,OAAO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AW,CAAC,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;QAC7G,iBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;QACzB,kBAAQ,CAAC,CAAC,yBAAiB,CAAC,CAAC;;;;8DAsB7B;IASD;QAJC,oBAAW,CAAC,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QACjC,qBAAY,CAAC,CAAC,SAAS,CAAC,CAAC;QACzB,iBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;QACzB,kBAAQ,CAAC,CAAC,yBAAiB,CAAC,CAAC;;;;6DAiB7B;IAQD;QAHC,oBAAW,CAAC,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;QAC5C,iBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;QACzB,kBAAQ,CAAC,CAAC,yBAAiB,CAAC,CAAC;;;;4DAkE7B;IACH,uBAAC;CAAA,AApLD,IAoLC;kBApLoB,gBAAgB"}
\ No newline at end of file \ No newline at end of file
...@@ -51,13 +51,10 @@ var common_2 = require("../decorator/common/"); ...@@ -51,13 +51,10 @@ var common_2 = require("../decorator/common/");
var sdk_1 = require("../sdk"); var sdk_1 = require("../sdk");
var service_1 = require("../service"); var service_1 = require("../service");
var constants_1 = require("../constants"); var constants_1 = require("../constants");
var checkActivityTime_1 = require("../utils/common/check/checkActivityTime"); var check_1 = require("../utils/common/check");
var checkInviteId_1 = require("../utils/common/check/checkInviteId");
var checkHelpRecord_1 = require("../utils/common/check/checkHelpRecord");
var checkNewVip_1 = require("../utils/common/check/checkNewVip");
var errorCode_1 = require("../errorCode"); var errorCode_1 = require("../errorCode");
var preUpdate_1 = require("../decorator/common/preUpdate"); var common_3 = require("../decorator/common");
var updateVip_1 = require("../utils/common/update/updateVip"); var update_1 = require("../utils/common/update/");
var Share = /** @class */ (function () { var Share = /** @class */ (function () {
function Share() { function Share() {
} }
...@@ -114,8 +111,8 @@ var Share = /** @class */ (function () { ...@@ -114,8 +111,8 @@ var Share = /** @class */ (function () {
common_1.checkParams(['activityId', 'inviteId']), common_1.checkParams(['activityId', 'inviteId']),
common_2.registeInfos(['vipInfo']), common_2.registeInfos(['vipInfo']),
common_2.services([service_1.TaskService, service_1.StatService]), common_2.services([service_1.TaskService, service_1.StatService]),
common_2.preCheck([checkActivityTime_1.checkActivityTime, checkInviteId_1.checkInviteId, checkNewVip_1.checkNewVip, checkHelpRecord_1.checkHelpRecord]), common_2.preCheck([check_1.checkActivityTime, check_1.checkInviteId, check_1.checkNewVip, check_1.checkHelpRecord]),
preUpdate_1.preUpdate([updateVip_1.updateVip]), common_3.preUpdate([update_1.updateVip]),
__metadata("design:type", Function), __metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]), __metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise) __metadata("design:returntype", Promise)
......
{"version":3,"file":"share.controller.js","sourceRoot":"","sources":["../../src/controller/share.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,+CAAkD;AAClD,+CAAuE;AACvE,8BAAqC;AACrC,sCAAkE;AAClE,0CAAwC;AACxC,6EAA2E;AAC3E,qEAAmE;AACnE,yEAAuE;AACvE,iEAA+D;AAC/D,0CAAyC;AACzC,2DAAyD;AACzD,8DAA4D;AAK5D;IAAA;IA8CA,CAAC;IA7CC;;OAEG;IAGG,4BAAY,GAAlB,UACE,OAAyC,EACzC,EAA8B;YAA5B,QAAQ,cAAA;;;;gBAGO,OAAO,GACpB,QAAQ,oBADY,CACZ;gBAEZ,sBAAO,kBAAY,CAAC,OAAO,CAAC;wBAC1B,OAAO,EAAE,OAAO;qBACjB,CAAC,EAAA;;;KACH;IACD;;OAEG;IAMG,sBAAM,GAAZ,UACE,OAGE,EACF,EAAwD,EACxD,EAAsD;YADpD,QAAQ,cAA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a,EAAE,mBAAW,EAAE,uBAAe,CAAC,CAAC;QAC1E,kBAAS,CAAC,CAAC,kBAAS,CAAC,CAAC;;;;uCAoBtB;IACH,YAAC;CAAA,AA9CD,IA8CC;kBA9CoB,KAAK"}
\ No newline at end of file \ No newline at end of file
...@@ -61,14 +61,10 @@ var constants_1 = require("./../constants"); ...@@ -61,14 +61,10 @@ var constants_1 = require("./../constants");
var common_1 = require("../decorator/common"); var common_1 = require("../decorator/common");
var sdk_1 = require("../sdk"); var sdk_1 = require("../sdk");
var service_1 = require("../service"); var service_1 = require("../service");
var checkActivityTime_1 = require("../utils/common/check/checkActivityTime"); var check_1 = require("../utils/common/check/");
var task_1 = require("../utils/common/task"); var task_1 = require("../utils/common/task");
var preUpdate_1 = require("../decorator/common/preUpdate"); var common_2 = require("../decorator/common");
var updateVip_1 = require("../utils/common/update/updateVip"); var update_1 = require("../utils/common/update");
var checkTaskLimit_1 = require("../utils/common/check/checkTaskLimit");
var checkExchangeCreditsTask_1 = require("../utils/common/check/checkExchangeCreditsTask");
var checkRemainTimes_1 = require("../utils/common/check/checkRemainTimes");
var updateSignTask_1 = require("../utils/common/update/updateSignTask");
var Task = /** @class */ (function () { var Task = /** @class */ (function () {
function Task() { function Task() {
} }
...@@ -170,8 +166,8 @@ var Task = /** @class */ (function () { ...@@ -170,8 +166,8 @@ var Task = /** @class */ (function () {
common_1.checkParams(['activityId']), common_1.checkParams(['activityId']),
common_1.registeInfos(['vipInfo']), common_1.registeInfos(['vipInfo']),
common_1.services([service_1.TaskService]), common_1.services([service_1.TaskService]),
common_1.preCheck([checkActivityTime_1.checkActivityTime]), common_1.preCheck([check_1.checkActivityTime]),
preUpdate_1.preUpdate([updateVip_1.updateVip, updateSignTask_1.updateSignTask]), common_2.preUpdate([update_1.updateVip, update_1.updateSignTask]),
__metadata("design:type", Function), __metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]), __metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise) __metadata("design:returntype", Promise)
...@@ -180,7 +176,7 @@ var Task = /** @class */ (function () { ...@@ -180,7 +176,7 @@ var Task = /** @class */ (function () {
common_1.checkParams(['activityId', 'taskType']), common_1.checkParams(['activityId', 'taskType']),
common_1.registeInfos(['session']), common_1.registeInfos(['session']),
common_1.services([service_1.TaskService]), common_1.services([service_1.TaskService]),
common_1.preCheck([checkActivityTime_1.checkActivityTime, checkTaskLimit_1.checkTaskLimit, checkExchangeCreditsTask_1.checkExchangeCreditsTask]), common_1.preCheck([check_1.checkActivityTime, check_1.checkTaskLimit, check_1.checkExchangeCreditsTask]),
__metadata("design:type", Function), __metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]), __metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise) __metadata("design:returntype", Promise)
...@@ -188,7 +184,7 @@ var Task = /** @class */ (function () { ...@@ -188,7 +184,7 @@ var Task = /** @class */ (function () {
__decorate([ __decorate([
common_1.checkParams(['activityId', 'taskType', 'rewardsKey']), common_1.checkParams(['activityId', 'taskType', 'rewardsKey']),
common_1.services([service_1.TaskService]), common_1.services([service_1.TaskService]),
common_1.preCheck([checkActivityTime_1.checkActivityTime, checkRemainTimes_1.checkRemainTimes]), common_1.preCheck([check_1.checkActivityTime, check_1.checkRemainTimes]),
__metadata("design:type", Function), __metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]), __metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise) __metadata("design:returntype", Promise)
......
{"version":3,"file":"task.controller.js","sourceRoot":"","sources":["../../src/controller/task.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2C;AAC3C,8CAAmF;AACnF,8BAAqC;AACrC,sCAAqD;AAErD,6EAA2E;AAC3E,6CAA2D;AAC3D,2DAAyD;AACzD,8DAA4D;AAC5D,uEAAqE;AACrE,2FAAy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iB,EAAE,wBAAgB,CAAC,CAAC;;;;kDAkB/C;IAQD;QAHC,oBAAW,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACtC,qBAAY,CAAC,CAAC,SAAS,CAAC,CAAC;QACzB,iBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;mDAoBvB;IACH,WAAC;CAAA,AA1GD,IA0GC;kBA1GoB,IAAI"}
\ No newline at end of file \ No newline at end of file
...@@ -27,7 +27,7 @@ declare const _default: { ...@@ -27,7 +27,7 @@ declare const _default: {
list: IAwards[]; list: IAwards[];
}>>; }>>;
receiveObjectPrize: (context: IContext<import("./controller/awards.controller").IReceiveOjectParams>, { activityInfo }: import("./controller/awards.controller").IReceivePrizeControllerInfos, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<boolean>>; receiveObjectPrize: (context: IContext<import("./controller/awards.controller").IReceiveOjectParams>, { activityInfo }: import("./controller/awards.controller").IReceivePrizeControllerInfos, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<boolean>>;
receiveEnamePrize: (context: IContext<import("./controller/awards.controller").IReceiveEnameParams>, { awardInfo, session }: import("./controller/awards.controller").IReceivePrizeControllerInfos, [awardSer]: [import("./service").AwardsService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<IAwards | import("taobao-mini-sdk/lib/utils/codetypes").CodeType, true>>; receiveEnamePrize: (context: IContext<import("./controller/awards.controller").IReceiveEnameParams>, { awardInfo, session }: import("./controller/awards.controller").IReceivePrizeControllerInfos, [awardSer]: [import("./service").AwardsService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<import("taobao-mini-sdk/lib/utils/codetypes").CodeType | IAwards, true>>;
doHelp: (context: IContext<{ doHelp: (context: IContext<{
activityId: string; activityId: string;
inviteId: string; inviteId: string;
......
...@@ -6,10 +6,8 @@ import { AwardsService } from '../service' ...@@ -6,10 +6,8 @@ import { AwardsService } from '../service'
import { PRIZE_TYPE, DRAW_STATUS, CODE_TYPES } from '../constants' import { PRIZE_TYPE, DRAW_STATUS, CODE_TYPES } from '../constants'
import { getToday } from '../utils/' import { getToday } from '../utils/'
import { CodeType } from 'taobao-mini-sdk/lib/utils/codetypes' import { CodeType } from 'taobao-mini-sdk/lib/utils/codetypes'
import { preCheck } from '../decorator/common/preCheck' import preCheck from '../decorator/common/preCheck'
import { checkActivityTime } from '../utils/common/check/checkActivityTime' import { checkActivityTime, checkPrizeExpired, checkValidPrize } from '../utils/common/check/'
import { checkPrizeExpired } from '../utils/common/check/checkPrizeExpired'
import { checkValidPrize } from '../utils/common/check/checkValidPrize'
export interface IPrizeListParams { export interface IPrizeListParams {
activityId: string activityId: string
...@@ -95,7 +93,7 @@ export default class AwardsController { ...@@ -95,7 +93,7 @@ export default class AwardsController {
*/ */
@checkParams(['activityId', 'id', 'name', 'phone', 'province', 'city', 'area', 'addressDetail', 'streetName']) @checkParams(['activityId', 'id', 'name', 'phone', 'province', 'city', 'area', 'addressDetail', 'streetName'])
@services([AwardsService]) @services([AwardsService])
@preCheck([checkPrizeExpired, checkValidPrize([PRIZE_TYPE.OBJECT])]) @preCheck([checkPrizeExpired])
async receiveObjectPrize( async receiveObjectPrize(
context: IContext<IReceiveOjectParams>, context: IContext<IReceiveOjectParams>,
{ activityInfo }: IReceivePrizeControllerInfos, { activityInfo }: IReceivePrizeControllerInfos,
...@@ -125,7 +123,7 @@ export default class AwardsController { ...@@ -125,7 +123,7 @@ export default class AwardsController {
@checkParams(['activityId', 'id']) @checkParams(['activityId', 'id'])
@registeInfos(['session']) @registeInfos(['session'])
@services([AwardsService]) @services([AwardsService])
@preCheck([checkPrizeExpired, checkValidPrize([PRIZE_TYPE.ENAME, PRIZE_TYPE.CREDITS])]) @preCheck([checkPrizeExpired])
async receiveEnamePrize( async receiveEnamePrize(
context: IContext<IReceiveEnameParams>, context: IContext<IReceiveEnameParams>,
{ awardInfo, session }: IReceivePrizeControllerInfos, { awardInfo, session }: IReceivePrizeControllerInfos,
......
...@@ -4,7 +4,7 @@ import { services, checkParams, registeInfos } from '../decorator/common' ...@@ -4,7 +4,7 @@ import { services, checkParams, registeInfos } from '../decorator/common'
import { resultsModel } from '../sdk' import { resultsModel } from '../sdk'
import { UserService, AccessService } from '../service' import { UserService, AccessService } from '../service'
import { noCheckUser } from '../decorator/common/noCheckUser' import { noCheckUser } from '../decorator/common'
export interface ILoginParams { export interface ILoginParams {
activityId: string activityId: string
......
...@@ -5,13 +5,10 @@ import { services, preCheck, registeInfos } from '../decorator/common/' ...@@ -5,13 +5,10 @@ import { services, preCheck, registeInfos } from '../decorator/common/'
import { resultsModel } from '../sdk' import { resultsModel } from '../sdk'
import { UserService, StatService, TaskService } from '../service' import { UserService, StatService, TaskService } from '../service'
import { STAT_TYPE } from '../constants' import { STAT_TYPE } from '../constants'
import { checkActivityTime } from '../utils/common/check/checkActivityTime' import { checkActivityTime, checkInviteId, checkHelpRecord, checkNewVip } from '../utils/common/check'
import { checkInviteId } from '../utils/common/check/checkInviteId'
import { checkHelpRecord } from '../utils/common/check/checkHelpRecord'
import { checkNewVip } from '../utils/common/check/checkNewVip'
import { CODE_TYPES } from '../errorCode' import { CODE_TYPES } from '../errorCode'
import { preUpdate } from '../decorator/common/preUpdate' import { preUpdate } from '../decorator/common'
import { updateVip } from '../utils/common/update/updateVip' import { updateVip } from '../utils/common/update/'
export interface IdoHelpInfos extends IControllerInfos { export interface IdoHelpInfos extends IControllerInfos {
inviteUserInfo: IUserInfo inviteUserInfo: IUserInfo
} }
......
...@@ -5,14 +5,10 @@ import { checkParams, services, registeInfos, preCheck } from '../decorator/comm ...@@ -5,14 +5,10 @@ import { checkParams, services, registeInfos, preCheck } from '../decorator/comm
import { resultsModel } from '../sdk' import { resultsModel } from '../sdk'
import { TaskService, BaseService } from '../service' import { TaskService, BaseService } from '../service'
import { ITaskInfo } from '../service/task.service' import { ITaskInfo } from '../service/task.service'
import { checkActivityTime } from '../utils/common/check/checkActivityTime' import { checkActivityTime, checkTaskLimit, checkExchangeCreditsTask, checkRemainTimes } from '../utils/common/check/'
import { getTotalCompleteTask } from '../utils/common/task' import { getTotalCompleteTask } from '../utils/common/task'
import { preUpdate } from '../decorator/common/preUpdate' import { preUpdate } from '../decorator/common'
import { updateVip } from '../utils/common/update/updateVip' import { updateVip, updateSignTask } from '../utils/common/update'
import { checkTaskLimit } from '../utils/common/check/checkTaskLimit'
import { checkExchangeCreditsTask } from '../utils/common/check/checkExchangeCreditsTask'
import { checkRemainTimes } from '../utils/common/check/checkRemainTimes'
import { updateSignTask } from '../utils/common/update/updateSignTask'
export default class Task { export default class Task {
/** /**
......
...@@ -3,7 +3,7 @@ import { resultsModel } from '../../sdk' ...@@ -3,7 +3,7 @@ import { resultsModel } from '../../sdk'
import { CODE_TYPES } from '../../constants' import { CODE_TYPES } from '../../constants'
import { logFn } from '../../utils' import { logFn } from '../../utils'
// 检验参数是否存在 // 检验参数是否存在
export const checkParams = (params: string[]) => { export default function checkParams(params: string[]) {
return function (target: Object, name: string, descriptor: PropertyDescriptor) { return function (target: Object, name: string, descriptor: PropertyDescriptor) {
const method = descriptor.value const method = descriptor.value
......
/** @format */ /** @format */
export * from './checkParams' import services from './services'
export * from './services' import noCatch from './noCatch'
export * from './noCatch' import checkParams from './checkParams'
export * from './registeInfos' import preCheck from './preCheck'
export * from './preCheck' import registeInfos from './registeInfos'
import noCheckUser from './noCheckUser'
import preUpdate from './preUpdate'
const common = {
services,
noCatch,
checkParams,
preCheck,
registeInfos,
noCheckUser,
preUpdate
}
export default common
export { services, noCatch, checkParams, preCheck, registeInfos, noCheckUser, preUpdate }
/** @format */ /** @format */
export const noCatch = (target: any, name: string, descriptor: PropertyDescriptor) => { export default function noCatch(target: any, name: string, descriptor: PropertyDescriptor) {
const method = descriptor.value const method = descriptor.value
descriptor.value = async function (...args: any[]) { descriptor.value = async function (...args: any[]) {
const [context, otherArgs = {}] = args const [context, otherArgs = {}] = args
......
/** @format */ /** @format */
export const noCheckUser = (target: any, name: string, descriptor: PropertyDescriptor) => { export default function noCheckUser(target: any, name: string, descriptor: PropertyDescriptor) {
const method = descriptor.value const method = descriptor.value
descriptor.value = async function (...args: any[]) { descriptor.value = async function (...args: any[]) {
const [context, otherArgs = {}] = args const [context, otherArgs = {}] = args
......
/** @format */ /** @format */
// 检验参数是否存在 // 检验参数是否存在
export const preCheck = (checks: IFunction[]) => { export default function preCheck(checks: IFunction[]) {
return function (target: Object, name: string, descriptor: PropertyDescriptor) { return function (target: Object, name: string, descriptor: PropertyDescriptor) {
const method = descriptor.value const method = descriptor.value
......
...@@ -9,7 +9,7 @@ import { formatUpdatedUserInfo } from '../../utils/common/format' ...@@ -9,7 +9,7 @@ import { formatUpdatedUserInfo } from '../../utils/common/format'
import { userInfo } from 'os' import { userInfo } from 'os'
// 检验参数是否存在 // 检验参数是否存在
export const preUpdate = (checks: IFunction[]) => { export default function preUpdate(checks: IFunction[]) {
return function (target: Object, name: string, descriptor: PropertyDescriptor) { return function (target: Object, name: string, descriptor: PropertyDescriptor) {
const method = descriptor.value const method = descriptor.value
......
...@@ -44,7 +44,7 @@ async function initBaseInfo(context: IContext<IParams>, baseInfos: ICheckControl ...@@ -44,7 +44,7 @@ async function initBaseInfo(context: IContext<IParams>, baseInfos: ICheckControl
return baseInfos return baseInfos
} }
export const registeInfos = (needInfos: IInfo[]) => { export default function registeInfos(needInfos: IInfo[]) {
return function (target: any, name: string, descriptor: PropertyDescriptor) { return function (target: any, name: string, descriptor: PropertyDescriptor) {
const method = descriptor.value const method = descriptor.value
descriptor.value = async function (...args: any[]) { descriptor.value = async function (...args: any[]) {
......
...@@ -31,7 +31,7 @@ async function formatBaseInfos(context: IContext<IParams>, baseInfos: ICheckCont ...@@ -31,7 +31,7 @@ async function formatBaseInfos(context: IContext<IParams>, baseInfos: ICheckCont
} }
// 注入服务 // 注入服务
export const services = (services: Constructor[]) => { export default function services(services: Constructor[]) {
return (target: Object, name: string, descriptor: PropertyDescriptor) => { return (target: Object, name: string, descriptor: PropertyDescriptor) => {
const method = descriptor.value const method = descriptor.value
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import { resultsModel } from '../../../sdk' import { resultsModel } from '../../../sdk'
import { CODE_TYPES } from '../../../errorCode' import { CODE_TYPES } from '../../../errorCode'
export const checkActivityTime = async (context: IContext<IParams>, { activityInfo }: IControllerInfos) => { export default async function checkActivityTime(context: IContext<IParams>, { activityInfo }: IControllerInfos) {
// 活动不存在 // 活动不存在
if (!activityInfo) { if (!activityInfo) {
return resultsModel.error(CODE_TYPES.ERROR_NO_ACTIVITY) return resultsModel.error(CODE_TYPES.ERROR_NO_ACTIVITY)
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
import { resultsModel, TBAPIS } from '../../../sdk' import { resultsModel, TBAPIS } from '../../../sdk'
import { CODE_TYPES } from '../../../errorCode' import { CODE_TYPES } from '../../../errorCode'
export const checkExchangeCreditsTask = async ( export default async function checkExchangeCreditsTask(
context: IContext<{ activityId: string; taskType: ITaskType; credits?: number }>, context: IContext<{ activityId: string; taskType: ITaskType; credits?: number }>,
{ session }: IControllerInfos { session }: IControllerInfos
) => { ) {
const { taskType, credits } = context.data const { taskType, credits } = context.data
// 不是兑换积分类型不校验 // 不是兑换积分类型不校验
......
...@@ -6,7 +6,7 @@ import { dbCount } from '../../common/db' ...@@ -6,7 +6,7 @@ import { dbCount } from '../../common/db'
import { STAT_DB_NAME } from '../../../db' import { STAT_DB_NAME } from '../../../db'
import { STAT_TYPE } from '../../../constants' import { STAT_TYPE } from '../../../constants'
export const checkHelpRecord = async (context: IContext<{ activityId: string; inviteId: string }>) => { export default async function checkHelpRecord(context: IContext<{ activityId: string; inviteId: string }>) {
const { const {
openId, openId,
data: { activityId, inviteId } data: { activityId, inviteId }
......
...@@ -5,7 +5,7 @@ import { CODE_TYPES } from '../../../errorCode' ...@@ -5,7 +5,7 @@ import { CODE_TYPES } from '../../../errorCode'
import { dbFindOne } from '../../common/db' import { dbFindOne } from '../../common/db'
import { USER_DB_NAME } from '../../../db' import { USER_DB_NAME } from '../../../db'
export const checkInviteId = async (context: IContext<{ activityId: string; inviteId: string }>) => { export default async function checkInviteId(context: IContext<{ activityId: string; inviteId: string }>) {
const { const {
openId, openId,
data: { activityId, inviteId } data: { activityId, inviteId }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import { resultsModel } from '../../../sdk' import { resultsModel } from '../../../sdk'
import { CODE_TYPES } from '../../../errorCode' import { CODE_TYPES } from '../../../errorCode'
export const checkNewVip = async (context: IContext<IParams>, { vipInfo, userInfo }: IControllerInfos) => { export default async function checkNewVip(context: IContext<IParams>, { vipInfo, userInfo }: IControllerInfos) {
if (!vipInfo) { if (!vipInfo) {
console.error(`使用checkNewVip registeInfos必须注册vipInfo`) console.error(`使用checkNewVip registeInfos必须注册vipInfo`)
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import { resultsModel } from '../../../sdk' import { resultsModel } from '../../../sdk'
import { CODE_TYPES } from '../../../errorCode' import { CODE_TYPES } from '../../../errorCode'
export const checkPrizeExpired = async (context: IContext<IParams>, { activityInfo }: IControllerInfos) => { export default async function checkPrizeExpired(context: IContext<IParams>, { activityInfo }: IControllerInfos) {
// 若有过期时间,且已过期 // 若有过期时间,且已过期
let { awardReceiveExpiredTime } = activityInfo let { awardReceiveExpiredTime } = activityInfo
if (awardReceiveExpiredTime && Date.now() > awardReceiveExpiredTime) { if (awardReceiveExpiredTime && Date.now() > awardReceiveExpiredTime) {
......
...@@ -3,7 +3,10 @@ ...@@ -3,7 +3,10 @@
import { resultsModel } from '../../../sdk' import { resultsModel } from '../../../sdk'
import { CODE_TYPES } from '../../../errorCode' import { CODE_TYPES } from '../../../errorCode'
export const checkRemainTimes = async (context: IContext<{ taskType: ITaskType }>, { userInfo }: IControllerInfos) => { export default async function checkRemainTimes(
context: IContext<{ taskType: ITaskType }>,
{ userInfo }: IControllerInfos
) {
const { taskType } = context.data const { taskType } = context.data
const { remainTimes } = userInfo const { remainTimes } = userInfo
......
...@@ -5,10 +5,10 @@ import { CODE_TYPES } from '../../../errorCode' ...@@ -5,10 +5,10 @@ import { CODE_TYPES } from '../../../errorCode'
import { getTodayCompleteTask, getTotalCompleteTask } from '../task' import { getTodayCompleteTask, getTotalCompleteTask } from '../task'
import { TASK_RATE_TYPE } from '../../../constants' import { TASK_RATE_TYPE } from '../../../constants'
export const checkTaskLimit = async ( export default async function checkTaskLimit(
context: IContext<{ activityId: string; taskType: ITaskType; itemId?: string }>, context: IContext<{ activityId: string; taskType: ITaskType; itemId?: string }>,
{ userInfo, activityInfo }: IControllerInfos { userInfo, activityInfo }: IControllerInfos
) => { ) {
const { taskType, itemId } = context.data const { taskType, itemId } = context.data
const { itemIds } = activityInfo?.tasks?.[taskType] || {} const { itemIds } = activityInfo?.tasks?.[taskType] || {}
if (!taskType) { if (!taskType) {
......
...@@ -6,7 +6,7 @@ import { DRAW_STATUS } from '../../../constants' ...@@ -6,7 +6,7 @@ import { DRAW_STATUS } from '../../../constants'
import { dbFindOne } from '../db' import { dbFindOne } from '../db'
import { AWARDS_DB_NAME } from '../../../db' import { AWARDS_DB_NAME } from '../../../db'
export const checkValidPrize = (prizeTypes: number[]) => { export default async function checkValidPrize(prizeTypes: number[]) {
return async (context: IContext<{ id: string }>, { activityInfo }: IControllerInfos) => { return async (context: IContext<{ id: string }>, { activityInfo }: IControllerInfos) => {
const { id } = context.data const { id } = context.data
let awardInfo = await dbFindOne<IAwards>(context, AWARDS_DB_NAME, { let awardInfo = await dbFindOne<IAwards>(context, AWARDS_DB_NAME, {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import { resultsModel } from '../../../sdk' import { resultsModel } from '../../../sdk'
import { CODE_TYPES } from '../../../errorCode' import { CODE_TYPES } from '../../../errorCode'
export const checkVip = async (context: IContext<IParams>, { vipInfo }: IControllerInfos) => { export default async function checkVip(context: IContext<IParams>, { vipInfo }: IControllerInfos) {
if (!vipInfo) { if (!vipInfo) {
console.error(`使用checkVip registeInfos必须注册vipInfo`) console.error(`使用checkVip registeInfos必须注册vipInfo`)
} }
......
/** @format */
import checkActivityTime from './checkActivityTime'
import checkExchangeCreditsTask from './checkExchangeCreditsTask'
import checkHelpRecord from './checkHelpRecord'
import checkInviteId from './checkInviteId'
import checkNewVip from './checkNewVip'
import checkPrizeExpired from './checkPrizeExpired'
import checkRemainTimes from './checkRemainTimes'
import checkTaskLimit from './checkTaskLimit'
import checkValidPrize from './checkValidPrize'
import checkVip from './checkVip'
const check = {
checkActivityTime,
checkExchangeCreditsTask,
checkHelpRecord,
checkInviteId,
checkNewVip,
checkPrizeExpired,
checkRemainTimes,
checkTaskLimit,
checkValidPrize,
checkVip
}
export default check
export {
checkActivityTime,
checkExchangeCreditsTask,
checkHelpRecord,
checkInviteId,
checkNewVip,
checkPrizeExpired,
checkRemainTimes,
checkTaskLimit,
checkValidPrize,
checkVip
}
/** @format */
import updateVip from './updateVip'
import updateSignTask from './updateSignTask'
const update = {
updateVip,
updateSignTask
}
export default update
export { updateVip, updateSignTask }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import { getToday } from '../getToday' import { getToday } from '../getToday'
import { getTodayCompleteTask } from '../task' import { getTodayCompleteTask } from '../task'
export async function updateSignTask( export default async function updateSignTask(
context: IContext<IParams>, context: IContext<IParams>,
{ userInfo, activityInfo }: IControllerInfos { userInfo, activityInfo }: IControllerInfos
): Promise<IPreUpdateQuery> { ): Promise<IPreUpdateQuery> {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { getToday } from '../getToday' import { getToday } from '../getToday'
import { isNewVip, setNewVipUserData } from '../userUpdate' import { isNewVip, setNewVipUserData } from '../userUpdate'
export async function updateVip( export default async function updateVip(
context: IContext<IParams>, context: IContext<IParams>,
{ vipInfo, userInfo, activityInfo }: IControllerInfos { vipInfo, userInfo, activityInfo }: IControllerInfos
): Promise<IPreUpdateQuery> { ): Promise<IPreUpdateQuery> {
......
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