Commit b31d858e authored by qinhaitao's avatar qinhaitao

feat: 🎸 perf

parent 46d532cb
...@@ -33,7 +33,7 @@ export default class AwardsController { ...@@ -33,7 +33,7 @@ export default class AwardsController {
/** /**
* 权益重新领取 * 权益重新领取
*/ */
receiveEnamePrize(context: IContext<IReceiveEnameParams>, {}: {}, [awardSer]: [AwardsService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | number[] | object[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<CodeType | IAwards, true>>; receiveEnamePrize(context: IContext<IReceiveEnameParams>, {}: {}, [awardSer]: [AwardsService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | object[] | number[] | string[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<CodeType | IAwards, true>>;
/** /**
* 概率抽奖 * 概率抽奖
*/ */
......
...@@ -54,6 +54,8 @@ var utils_1 = require("../utils"); ...@@ -54,6 +54,8 @@ var utils_1 = require("../utils");
var service_1 = require("../service"); var service_1 = require("../service");
var registeInfos_1 = require("../decorator/registeInfos"); var registeInfos_1 = require("../decorator/registeInfos");
var constants_2 = require("../constants"); var constants_2 = require("../constants");
var checkActivityTime_1 = require("../utils/check/checkActivityTime");
var preCheck_1 = require("../decorator/preCheck");
var Share = /** @class */ (function () { var Share = /** @class */ (function () {
function Share() { function Share() {
} }
...@@ -160,9 +162,8 @@ var Share = /** @class */ (function () { ...@@ -160,9 +162,8 @@ var Share = /** @class */ (function () {
], Share.prototype, "getShareInfo", null); ], Share.prototype, "getShareInfo", null);
__decorate([ __decorate([
check_1.paramsCheck(['activityId', 'inviteId']), check_1.paramsCheck(['activityId', 'inviteId']),
check_1.activityTimeCheck,
check_1.userCheck({ intercept: true }),
registeInfos_1.registeInfos(['userInfo', 'vipInfo', 'activityInfo']), registeInfos_1.registeInfos(['userInfo', 'vipInfo', 'activityInfo']),
preCheck_1.preCheck([checkActivityTime_1.checkActivityTime]),
services_1.services([service_1.UserService, service_1.TaskService, service_1.StatService, service_1.AccessService]), services_1.services([service_1.UserService, service_1.TaskService, service_1.StatService, service_1.AccessService]),
__metadata("design:type", Function), __metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]), __metadata("design:paramtypes", [Object, Object, Array]),
......
{"version":3,"file":"share.controller.js","sourceRoot":"","sources":["../../src/controller/share.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2C;AAC3C,4CAA8E;AAC9E,kDAAgD;AAEhD,8BAAqC;AACrC,kCAAmE;AACnE,sCAAiF;AACjF,0DAAwD;AACxD,0CAAwC;AAExC;IAAA;IAqGA,CAAC;IApGC;;OAEG;IAKG,4BAAY,GAAlB,UACE,OAEE,EACF,EAA8B;YAA5B,QAAQ,cAAA;;;;gBAOO,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,EAAqD,EACrD,EAA+F;YAD7F,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA;YAChC,WAAW,QAAA,EAAE,WAAW,QAAA,EAAE,WAAW,QAAA;;;;;;;wBAEhC,KAA2B,OAAO,CAAC,IAAI,EAArC,QAAQ,cAAA,EAAE,UAAU,gBAAA,CAAiB;wBACrC,MAAM,GAAK,OAAO,OAAZ,CAAY;wBAE1B,IAAI,MAAM,KAAK,QAAQ;4BAAE,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,oBAAoB,CAAC,EAAA;wBAEjD,qBAAM,WAAW,CAAC,mBAAmB,CAAC,QAAQ,CAAC;4BAEjF,iCAAiC;0BAFgD;;wBAA3E,cAAc,GAAc,SAA+C;wBAEjF,iCAAiC;wBACjC,IAAI,CAAC,cAAc;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,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC1C,mBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;6CAkBvB;IAQD;QAJC,mBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACvC,2BAAY,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QACrD,mBAAQ,CAAC,CAAC,qCAAiB,CAAC,CAAC;QAC7B,mBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,EAAE,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;uCAmEhE;IACH,YAAC;CAAA,AApGD,IAoGC;kBApGoB,KAAK"}
\ No newline at end of file \ No newline at end of file
...@@ -18,5 +18,5 @@ export default class StatController { ...@@ -18,5 +18,5 @@ export default class StatController {
/** /**
* 统计数据 * 统计数据
*/ */
getStats(context: IContext<IGetStatsParams>): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | number[] | object[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any, true>>; getStats(context: IContext<IGetStatsParams>): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | object[] | number[] | string[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any, true>>;
} }
...@@ -17,12 +17,12 @@ declare const _default: { ...@@ -17,12 +17,12 @@ declare const _default: {
list: IAwards[]; list: IAwards[];
}>>; }>>;
receiveObjectPrize: (context: IContext<import("./controller/awards.controller").IReceiveOjectParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<boolean>>; receiveObjectPrize: (context: IContext<import("./controller/awards.controller").IReceiveOjectParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<boolean>>;
receiveEnamePrize: (context: IContext<import("./controller/awards.controller").IReceiveEnameParams>, {}: {}, [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>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | object[] | number[] | string[], 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;
}>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, taskService, statService]: [import("./service/user.service").default, import("./service").TaskService, import("./service").StatService, import("./service").AccessService]) => Promise<IResult<boolean>>; }>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, taskService, statService]: [import("./service/user.service").default, import("./service").TaskService, import("./service").StatService, import("./service").AccessService]) => Promise<IResult<boolean>>;
getStats: (context: IContext<import("./controller/stat.controller").IGetStatsParams>) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any, true>>; getStats: (context: IContext<import("./controller/stat.controller").IGetStatsParams>) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | object[] | number[] | string[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any, true>>;
addStat: (context: IContext<import("./controller/stat.controller").IAddStatsParams>, { userInfo }: IControllerInfos, [statService]: [import("./service").StatService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<boolean, true>>; addStat: (context: IContext<import("./controller/stat.controller").IAddStatsParams>, { userInfo }: IControllerInfos, [statService]: [import("./service").StatService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<boolean, true>>;
getRankList: (context: IContext<{ getRankList: (context: IContext<{
activityId: string; activityId: string;
......
This diff is collapsed.
...@@ -9,6 +9,8 @@ import { getToday, setNewVipUserData, checkNewVip } from '../utils' ...@@ -9,6 +9,8 @@ import { getToday, setNewVipUserData, checkNewVip } from '../utils'
import { UserService, AccessService, TaskService, StatService } from '../service' import { UserService, AccessService, TaskService, StatService } from '../service'
import { registeInfos } from '../decorator/registeInfos' import { registeInfos } from '../decorator/registeInfos'
import { STAT_TYPE } from '../constants' import { STAT_TYPE } from '../constants'
import { checkActivityTime } from '../utils/check/checkActivityTime'
import { preCheck } from '../decorator/preCheck'
export default class Share { export default class Share {
/** /**
...@@ -40,9 +42,8 @@ export default class Share { ...@@ -40,9 +42,8 @@ export default class Share {
* 完成分享 * 完成分享
*/ */
@paramsCheck(['activityId', 'inviteId']) @paramsCheck(['activityId', 'inviteId'])
@activityTimeCheck
@userCheck({ intercept: true })
@registeInfos(['userInfo', 'vipInfo', 'activityInfo']) @registeInfos(['userInfo', 'vipInfo', 'activityInfo'])
@preCheck([checkActivityTime])
@services([UserService, TaskService, StatService, AccessService]) @services([UserService, TaskService, StatService, AccessService])
async doHelp( async doHelp(
context: IContext<{ context: IContext<{
......
/** @format */
// 检验参数是否存在
export const preCheck = (checks: any[]) => {
return function (target: Object, name: string, descriptor: PropertyDescriptor) {
const method = descriptor.value
descriptor.value = async function (...args: any[]) {
let [context, otherArgs = {}] = args
const dataKeys = Object.keys(context.data)
for (let i = 0; i < checks.length; i++) {
const checkFn = checks[i]
const result = await checkFn.apply(target, [context, { ...otherArgs }])
otherArgs = { ...otherArgs, ...result }
}
return method.apply(target, [context, { ...otherArgs }])
}
}
}
src
├─constants.ts
├─db.ts
├─errorCode.ts
├─index.ts
├─sdk.ts
├─vipMock.ts
├─utils
| ├─index.ts
| ├─package
| | ├─exportHandlers.ts
| | ├─format.ts
| | ├─getSession.ts
| | ├─getToday.ts
| | ├─getUserOrderlist.ts
| | ├─helper.ts
| | ├─lockUpdate.ts
| | ├─logger.ts
| | ├─rand.ts
| | ├─sendTBAward.ts
| | ├─task.ts
| | ├─userUpdate.ts
| | └vip.ts
| ├─custom
| ├─common
| ├─check
| | ├─checkActivityTime.ts
| | └checkTaskLimit.ts
├─typings
| ├─activityConfig.d.ts
| ├─awards.d.ts
| ├─dao.d.ts
| ├─index.d.ts
| ├─item.d.ts
| ├─prizeConfig.d.ts
| ├─resultModel.d.ts
| ├─seller.d.ts
| └user.d.ts
├─test
├─service
| ├─access.service.ts
| ├─awards.service.ts
| ├─base.service.ts
| ├─index.ts
| ├─stat.service.ts
| ├─task.service.ts
| ├─user.service.ts
| ├─custom
| ├─common
├─decorator
| ├─check.ts
| ├─index.ts
| ├─noCatch.ts
| ├─preCheck.ts
| ├─registeInfos.ts
| ├─services.ts
| ├─custom
| ├─common
├─controller
| ├─awards.controller.ts
| ├─base.controller.ts
| ├─share.controller.ts
| ├─stat.controller.ts
| ├─task.controller.ts
| ├─user.controller.ts
| ├─custom
| ├─common
├─config
| ├─index.ts
| ├─online.ts
| └test.ts
├─check
\ No newline at end of file
...@@ -27,18 +27,6 @@ type ITaskType = ...@@ -27,18 +27,6 @@ type ITaskType =
| 'invites' | 'invites'
type ITasks = { [key in ITaskType]: ITaskConfig } type ITasks = { [key in ITaskType]: ITaskConfig }
// interface ITasks {
// // follow?: ITaskConfig
// // member?: ITaskConfig
// // sign?: ITaskConfig
// // exchangeCredits?: ITaskConfig
// // browseGoods?: ITaskConfig
// // orderGoods?: ITaskConfig
// // collectGoods?: ITaskConfig
// // jumpLink?: ITaskConfig
// // invites?: ITaskConfig
// [key in ITaskType]: ITaskConfig
// }
interface ITaskConfig { interface ITaskConfig {
title?: string // 任务标题 title?: string // 任务标题
...@@ -49,28 +37,3 @@ interface ITaskConfig { ...@@ -49,28 +37,3 @@ interface ITaskConfig {
itemIds?: string // 任务商品 itemIds?: string // 任务商品
checked?: boolean // 是否选中(B端需勾选时) checked?: boolean // 是否选中(B端需勾选时)
} }
interface IActivityPrize {
_id?: string
id?: string
activityId?: string
ename?: string
prizeDataType: number
type: number
image?: string
name: string
probability?: string | number
properiodto?: number
properiodfrom?: number
lockStatus?: number
switchStock?: number
rank?: string | number
credits?: string | number
useUrl?: string
stock?: number
useStock?: number
openId?: string
deleteStatus?: number
createTime?: number
updateTime?: number
}
/** @format */
interface IActivityPrize {
_id?: string
id?: string
activityId?: string
ename?: string
prizeDataType: number
type: number
image?: string
name: string
probability?: string | number
properiodto?: number
properiodfrom?: number
lockStatus?: number
switchStock?: number
rank?: string | number
credits?: string | number
useUrl?: string
stock?: number
useStock?: number
openId?: string
deleteStatus?: number
createTime?: number
updateTime?: number
}
/** @format */
export const checkActivityTime = async () => {}
/** @format */
export const checkTaskLimit = (taskType: ITaskType) => {
return async function (context: IContext<IParams>, { activityInfo, userInfo }: IControllerInfos) {
const {
tasks: {
[taskType]: { value, taskRateType, times }
}
} = activityInfo
const {} = userInfo
}
}
/**
* 根据任务类型获取任务完成情况
*
* @param {IUserInfo} userInfo
* @param {string} taskType
* @returns {array}
* @memberof TaskService
*/
export getCompleteTaskByUserTaskInfo(
taskType: string,
userInfo: IUserInfo
): {
completeTimes: number
taskInfo: ITaskDetail[]
} {
const { taskInfo = {} } = userInfo
let targetTaskList = []
Object.keys(taskInfo).forEach(day => {
if (taskInfo[day]?.[taskType]) {
const dayTaskInfo = Array.isArray(taskInfo[day]?.[taskType])
? taskInfo[day]?.[taskType]
: [taskInfo[day]?.[taskType]]
targetTaskList = [...targetTaskList, ...dayTaskInfo]
}
})
return {
completeTimes: targetTaskList?.length || 0,
taskInfo: targetTaskList
}
}
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"lib": [ "lib": [
"es6", "dom", "es7" "es6", "dom", "es7"
], ],
"typeRoots": ["./node_modules/@types/", "./src/typings/"], "typeRoots": ["./node_modules/@types/", "./src/typings/", "./src/typings/common/"],
"outDir": "./dist", "outDir": "./dist",
"sourceMap": true, "sourceMap": true,
"module": "commonjs", "module": "commonjs",
......
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