Commit 29ebade8 authored by qinhaitao's avatar qinhaitao

feat: 🎸 任务优化

parent 0e1d8117
......@@ -88,7 +88,7 @@ var Share = /** @class */ (function () {
switch (_c.label) {
case 0:
openId = context.openId;
return [4 /*yield*/, taskService.completeTask('invites', inviteUserInfo, activityInfo, {
return [4 /*yield*/, taskService.completeTask('invites', activityInfo, inviteUserInfo, {
openId: openId
})];
case 1:
......
{"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,qDAAmD;AACnD,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,cAAA,EAAE,YAAY,kBAAA,EAAE,cAAc,oBAAA;YACvC,WAAW,QAAA,EAAE,WAAW,QAAA;;;;;;wBAEjB,MAAM,GAAK,OAAO,OAAZ,CAAY;wBAEX,qBAAM,WAAW,CAAC,YAAY,CAAC,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE;gCACrF,MAAM,QAAA;6BACP,CAAC,EAAA;;wBAFI,MAAM,GAAG,SAEb;wBAEF,IAAI,CAAC,MAAM;4BAAE,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,YAAY,EAAE,OAAO,CAAC,EAAA;wBAExE,qBAAM,WAAW,CAAC,OAAO,CAAC,qBAAS,CAAC,aAAa,EAAE,QAAQ,CAAC,EAAA;;wBAA5D,SAA4D,CAAA;wBAE5D,sBAAO,kBAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAA;;;;KAClC;IAvCD;QAFC,oBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,iBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;6CAYvB;IASD;QALC,oBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACvC,qBAAY,CAAC,CAAC,SAAS,CAAC,CAAC;QACzB,iBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,CAAC,CAAC;QACpC,iBAAQ,CAAC,CAAC,qCAAiB,EAAE,6BAAa,EAAE,yBAAW,EAAE,iCAAe,CAAC,CAAC;QAC1E,eAAM,CAAC,CAAC,qBAAS,CAAC,CAAC;;;;uCAoBnB;IACH,YAAC;CAAA,AA9CD,IA8CC;kBA9CoB,KAAK"}
\ No newline at end of file
{"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,qDAAmD;AACnD,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,cAAA,EAAE,YAAY,kBAAA,EAAE,cAAc,oBAAA;YACvC,WAAW,QAAA,EAAE,WAAW,QAAA;;;;;;wBAEjB,MAAM,GAAK,OAAO,OAAZ,CAAY;wBAEX,qBAAM,WAAW,CAAC,YAAY,CAAC,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE;gCACrF,MAAM,QAAA;6BACP,CAAC,EAAA;;wBAFI,MAAM,GAAG,SAEb;wBAEF,IAAI,CAAC,MAAM;4BAAE,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,YAAY,EAAE,OAAO,CAAC,EAAA;wBAExE,qBAAM,WAAW,CAAC,OAAO,CAAC,qBAAS,CAAC,aAAa,EAAE,QAAQ,CAAC,EAAA;;wBAA5D,SAA4D,CAAA;wBAE5D,sBAAO,kBAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAA;;;;KAClC;IAvCD;QAFC,oBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,iBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;6CAYvB;IASD;QALC,oBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACvC,qBAAY,CAAC,CAAC,SAAS,CAAC,CAAC;QACzB,iBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,CAAC,CAAC;QACpC,iBAAQ,CAAC,CAAC,qCAAiB,EAAE,6BAAa,EAAE,yBAAW,EAAE,iCAAe,CAAC,CAAC;QAC1E,eAAM,CAAC,CAAC,qBAAS,CAAC,CAAC;;;;uCAoBnB;IACH,YAAC;CAAA,AA9CD,IA8CC;kBA9CoB,KAAK"}
\ No newline at end of file
......@@ -7,29 +7,19 @@ export default class Task {
*/
getTaskList(context: IContext<{
activityId: string;
}>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [taskService]: [TaskService]): Promise<IResult<ITaskInfo[]>>;
/**
* 完成关注店铺任务
*/
doFollowTask(context: IContext<{
activityId: string;
}>, { userInfo, activityInfo }: IControllerInfos, [TaskService]: [TaskService]): Promise<IResult<boolean>>;
}>, { userInfo, activityInfo }: IControllerInfos, [taskService]: [TaskService]): Promise<IResult<ITaskInfo[]>>;
/**
* 积分兑换次数
*/
doExchangeCreditsTask(context: IContext<IParams>, { userInfo, activityInfo, session }: IControllerInfos, [taskService]: [TaskService]): Promise<IResult<boolean>>;
/**
* 浏览商品
*/
doBrowseGoodsTask(context: IContext<IParams>, { userInfo, activityInfo }: IControllerInfos, [taskService]: [TaskService]): Promise<IResult<boolean>>;
/**
* 收藏商品
*/
doCollectGoodsTask(context: IContext<IParams>, { userInfo, activityInfo }: IControllerInfos, [taskService]: [TaskService]): Promise<IResult<boolean>>;
/**
* 浏览链接
* 完成任务
*/
doJumpLinkTask(context: IContext<IParams>, { userInfo, activityInfo }: IControllerInfos, [taskService]: [TaskService]): Promise<IResult<boolean>>;
doCompleteTask(context: IContext<{
activityId: string;
taskType: ITaskType;
itemId?: string;
}>, { userInfo, activityInfo }: IControllerInfos, [taskService]: [TaskService]): Promise<IResult<boolean>>;
/**
* 领取任务奖励
*/
......
......@@ -63,6 +63,9 @@ var sdk_1 = require("../sdk");
var service_1 = require("../service");
var checkActivityTime_1 = require("../utils/common/check/checkActivityTime");
var task_1 = require("../utils/common/task");
var update_1 = require("../decorator/common/update");
var updateVip_1 = require("../utils/common/update/updateVip");
var checkTaskLimit_1 = require("../utils/common/check/checkTaskLimit");
var Task = /** @class */ (function () {
function Task() {
}
......@@ -70,66 +73,21 @@ var Task = /** @class */ (function () {
* 任务列表
*/
Task.prototype.getTaskList = function (context, _a, _b) {
var userInfo = _a.userInfo, vipInfo = _a.vipInfo, activityInfo = _a.activityInfo;
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var tasks, startTime, updatedUserInfo;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
tasks = activityInfo.tasks, startTime = activityInfo.startTime;
return [4 /*yield*/, taskService.updateTasks(userInfo._id,
// 需要查询更新的任务
[
taskService.updateVipTask(userInfo, vipInfo, tasks)
// taskService.updateSignTask(userInfo, tasks),
// await taskService.updateOrderGoodsTask(userInfo, tasks, startTime, session)
], userInfo)];
case 1:
updatedUserInfo = _c.sent();
if (!updatedUserInfo)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.SYSTEM_ERROR, '更新任务列表失败')
// 返回对应的任务时, B端b_activity_config tasks 需配置对应的任务
];
// 返回对应的任务时, B端b_activity_config tasks 需配置对应的任务
return [2 /*return*/, sdk_1.resultsModel.success([
taskService.initTask('member', '加入会员', tasks, updatedUserInfo),
taskService.initTask('follow', '关注店铺', tasks, updatedUserInfo)
// taskService.initTask('sign', '签到', tasks, updatedUserInfo),
// taskService.initTask('orderGoods', '购买商品', tasks, updatedUserInfo),
// taskService.initTask('browseGoods', '浏览商品', tasks, updatedUserInfo),
// taskService.initTask('collectGoods', '收藏商品', tasks, updatedUserInfo),
// taskService.initTask('jumpLink', '浏览页面', tasks, updatedUserInfo),
// taskService.initTask('invites', '邀请好友', tasks, updatedUserInfo),
// taskService.initTask('exchangeCredits', '积分兑换', tasks, updatedUserInfo)
])];
}
});
});
};
/**
* 完成关注店铺任务
*/
Task.prototype.doFollowTask = function (context, _a, _b) {
var userInfo = _a.userInfo, activityInfo = _a.activityInfo;
var TaskService = _b[0];
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var follow, flag, newFollow, hasFollowed, result;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
follow = userInfo.follow;
flag = follow.flag, newFollow = follow.newFollow;
hasFollowed = flag || newFollow;
if (hasFollowed)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_COMPLETE)
// 更新状态
];
return [4 /*yield*/, TaskService.updateFollowTask(userInfo, activityInfo)];
case 1:
result = _c.sent();
return [2 /*return*/, result ? sdk_1.resultsModel.success(true) : sdk_1.resultsModel.error(constants_1.CODE_TYPES.SYSTEM_ERROR)];
}
return [2 /*return*/, sdk_1.resultsModel.success([
taskService.initTask('member', '加入会员', activityInfo, userInfo),
taskService.initTask('follow', '关注店铺', activityInfo, userInfo)
// taskService.initTask('sign', '签到', activityInfo, userInfo),
// taskService.initTask('orderGoods', '购买商品', activityInfo, userInfo),
// taskService.initTask('browseGoods', '浏览商品', activityInfo, userInfo),
// taskService.initTask('collectGoods', '收藏商品', activityInfo, userInfo),
// taskService.initTask('jumpLink', '浏览页面', activityInfo, userInfo),
// taskService.initTask('invites', '邀请好友', activityInfo, userInfo)
// taskService.initTask('exchangeCredits', '积分兑换', activityInfo, updatedUserInfo)
])];
});
});
};
......@@ -174,7 +132,7 @@ var Task = /** @class */ (function () {
// 更新user表
];
// 更新user表
return [4 /*yield*/, taskService.updateUserTaskRecord(taskType, value, userInfo)];
return [4 /*yield*/, taskService.completeTask(taskType, activityInfo, userInfo)];
case 3:
// 更新user表
_d.sent();
......@@ -184,114 +142,21 @@ var Task = /** @class */ (function () {
});
};
/**
* 浏览商品
*/
Task.prototype.doBrowseGoodsTask = function (context, _a, _b) {
var userInfo = _a.userInfo, activityInfo = _a.activityInfo;
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var taskType, itemId, _c, taskRateType, times, itemIds, value, itemIdArray, _d, todayTaskInfo, todayCompleteTimes, hasCompleteToday;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
taskType = 'browseGoods';
itemId = context.data.itemId;
_c = activityInfo.tasks.browseGoods, taskRateType = _c.taskRateType, times = _c.times, itemIds = _c.itemIds, value = _c.value;
itemIdArray = Array.isArray(itemIds) ? itemIds : itemIds.split(',').map(function (v) { return +v; });
// B端配置商品ids不匹配正确
if (!itemIdArray.includes(+itemId))
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '商品id不匹配')];
_d = task_1.getTodayCompleteTask('browseGoods', userInfo), todayTaskInfo = _d.todayTaskInfo, todayCompleteTimes = _d.todayCompleteTimes;
hasCompleteToday = todayTaskInfo.some(function (v) { return v.itemId === itemId; }) && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY;
// 今日任务已经完成
if (hasCompleteToday) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '今日该浏览商品任务已完成')];
}
// 次数超限
if (times && times === todayCompleteTimes && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_LIMIT)];
}
// 更新user表
return [4 /*yield*/, taskService.updateUserTaskRecord(taskType, value, userInfo, {
itemId: itemId
})];
case 1:
// 更新user表
_e.sent();
return [2 /*return*/, sdk_1.resultsModel.success(true)];
}
});
});
};
/**
* 收藏商品
* 完成任务
*/
Task.prototype.doCollectGoodsTask = function (context, _a, _b) {
Task.prototype.doCompleteTask = function (context, _a, _b) {
var userInfo = _a.userInfo, activityInfo = _a.activityInfo;
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var taskType, itemId, _c, taskRateType, times, itemIds, value, itemIdArray, _d, todayTaskInfo, todayCompleteTimes, hasCompleteToday;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
taskType = 'collectGoods';
itemId = context.data.itemId;
_c = activityInfo.tasks.collectGoods, taskRateType = _c.taskRateType, times = _c.times, itemIds = _c.itemIds, value = _c.value;
itemIdArray = Array.isArray(itemIds) ? itemIds : itemIds.split(',').map(function (v) { return +v; });
// B端配置商品ids不匹配正确
if (!itemIdArray.includes(+itemId))
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '商品id不匹配')];
_d = task_1.getTodayCompleteTask(taskType, userInfo), todayTaskInfo = _d.todayTaskInfo, todayCompleteTimes = _d.todayCompleteTimes;
hasCompleteToday = todayTaskInfo.filter(function (v) { return v.itemId === itemId; }).length && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY;
// 今日任务已经完成
if (hasCompleteToday) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '今日该收藏商品任务已完成')];
}
// 次数超限
if (times && times === todayCompleteTimes && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_LIMIT)];
}
// 更新user表
return [4 /*yield*/, taskService.updateUserTaskRecord(taskType, value, userInfo, {
itemId: itemId
})];
case 1:
// 更新user表
_e.sent();
return [2 /*return*/, sdk_1.resultsModel.success(true)];
}
});
});
};
/**
* 浏览链接
*/
Task.prototype.doJumpLinkTask = function (context, _a, _b) {
var userInfo = _a.userInfo, activityInfo = _a.activityInfo;
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var taskType, _c, taskRateType, times, value, link, todayCompleteTimes, hasCompleteToday;
var _c, taskType, itemId, result;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
taskType = 'jumpLink';
_c = activityInfo.tasks.jumpLink, taskRateType = _c.taskRateType, times = _c.times, value = _c.value, link = _c.link;
todayCompleteTimes = task_1.getTodayCompleteTask(taskType, userInfo).todayCompleteTimes;
hasCompleteToday = times && todayCompleteTimes === times && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY;
// 今日任务已经完成
if (hasCompleteToday) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '今日跳转链接任务已完成')];
}
// 次数超限
if (times && times === todayCompleteTimes && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_LIMIT)];
}
// 更新user表
return [4 /*yield*/, taskService.updateUserTaskRecord(taskType, value, userInfo)];
_c = context.data, taskType = _c.taskType, itemId = _c.itemId;
return [4 /*yield*/, taskService.completeTask(taskType, activityInfo, userInfo, { itemId: itemId })];
case 1:
// 更新user表
_d.sent();
return [2 /*return*/, sdk_1.resultsModel.success(true)];
result = _d.sent();
return [2 /*return*/, result ? sdk_1.resultsModel.success(true) : sdk_1.resultsModel.error(constants_1.CODE_TYPES.SYSTEM_ERROR, '任务完成失败')];
}
});
});
......@@ -347,7 +212,7 @@ var Task = /** @class */ (function () {
return [4 /*yield*/, baseService.getItemListByIds(itemIds, session)];
case 1:
list = _c.sent();
taskInfo = task_1.getCompleteTaskByUserTaskInfo('collectGoods', userInfo).taskInfo;
taskInfo = task_1.getTotalCompleteTask('collectGoods', userInfo).taskInfo;
listWithCollectStatus = list.map(function (v) {
return __assign(__assign({}, v), {
// 完成列表是否含有itemId
......@@ -363,18 +228,11 @@ var Task = /** @class */ (function () {
common_1.registeInfos(['vipInfo']),
common_1.services([service_1.TaskService]),
common_1.preCheck([checkActivityTime_1.checkActivityTime]),
update_1.update([updateVip_1.updateVip]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "getTaskList", null);
__decorate([
common_1.checkParams(['activityId']),
common_1.services([service_1.TaskService]),
common_1.preCheck([checkActivityTime_1.checkActivityTime]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "doFollowTask", null);
__decorate([
common_1.checkParams(['activityId', 'credits']),
common_1.registeInfos(['session']),
......@@ -385,29 +243,13 @@ var Task = /** @class */ (function () {
__metadata("design:returntype", Promise)
], Task.prototype, "doExchangeCreditsTask", null);
__decorate([
common_1.checkParams(['activityId', 'itemId']),
common_1.services([service_1.TaskService]),
common_1.preCheck([checkActivityTime_1.checkActivityTime]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "doBrowseGoodsTask", null);
__decorate([
common_1.checkParams(['activityId', 'itemId']),
common_1.services([service_1.TaskService]),
common_1.preCheck([checkActivityTime_1.checkActivityTime]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "doCollectGoodsTask", null);
__decorate([
common_1.checkParams(['activityId']),
common_1.checkParams(['activityId', 'taskType']),
common_1.services([service_1.TaskService]),
common_1.preCheck([checkActivityTime_1.checkActivityTime]),
common_1.preCheck([checkActivityTime_1.checkActivityTime, checkTaskLimit_1.checkTaskLimit]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "doJumpLinkTask", null);
], Task.prototype, "doCompleteTask", null);
__decorate([
common_1.checkParams(['activityId', 'taskType']),
common_1.services([service_1.TaskService]),
......
{"version":3,"file":"task.controller.js","sourceRoot":"","sources":["../../src/controller/task.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2D;AAC3D,8CAAmF;AAEnF,8BAA6C;AAC7C,sCAAqD;AAErD,6EAA2E;AAC3E,6CAA0F;AAE1F;IAAA;IAsTA,CAAC;IArTC;;OAEG;IAKG,0BAAW,GAAjB,UACE,OAAyC,EACzC,EAAqD,EACrD,EAA4B;YAD1B,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA;YAChC,WAAW,QAAA;;;;;;wBAEJ,KAAK,GAAgB,YAAY,MAA5B,EAAE,SAAS,GAAK,YAAY,UAAjB,CAAiB;wBAGnB,qBAAM,WAAW,CAAC,WAAW,CACjD,QAAQ,CAAC,GAAG;4BACZ,YAAY;4BACZ;gCACE,WAAW,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC;gCACnD,+CAA+C;gCAC/C,8EAA8E;6BAC/E,EACD,QAAQ,CACT,EAAA;;wBATG,eAAe,GAAG,SASrB;wBAED,IAAI,CAAC,eAAe;4BAAE,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,YAAY,EA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AY,EAAE,QAAQ,CAAC,CAAC;QACrC,iBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;QACvB,iBAAQ,CAAC,CAAC,qCAAiB,CAAC,CAAC;;;;iDAsC7B;IAQD;QAHC,oBAAW,CAAC,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACrC,iBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;QACvB,iBAAQ,CAAC,CAAC,qCAAiB,CAAC,CAAC;;;;kDAuC7B;IAQD;QAHC,oBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,iBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;QACvB,iBAAQ,CAAC,CAAC,qCAAiB,CAAC,CAAC;;;;8CA+B7B;IAQD;QAHC,oBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACvC,iBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;QACvB,iBAAQ,CAAC,CAAC,qCAAiB,CAAC,CAAC;;;;kDA8B7B;IAQD;QAHC,oBAAW,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACtC,qBAAY,CAAC,CAAC,SAAS,CAAC,CAAC;QACzB,iBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,CAAC,CAAC;;;;mDAoBpC;IACH,WAAC;CAAA,AAtTD,IAsTC;kBAtToB,IAAI"}
\ No newline at end of file
{"version":3,"file":"task.controller.js","sourceRoot":"","sources":["../../src/controller/task.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2D;AAC3D,8CAAmF;AACnF,8BAA6C;AAC7C,sCAAqD;AAErD,6EAA2E;AAC3E,6CAAiF;AACjF,qDAAmD;AACnD,8DAA4D;AAC5D,uEAAqE;AAErE;IAAA;IAmKA,CAAC;IAlKC;;OAEG;IAMG,0BAAW,GAAjB,UACE,OAAyC,EACzC,EAA4C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of file
......@@ -6,7 +6,12 @@ declare const _default: {
getVipInfo: (context: IContext<import("./controller/user.controller").IVipParams>, { session, activityUserNick }: IControllerInfos) => Promise<IResult<IVipInfo>>;
getTaskList: (context: IContext<{
activityId: string;
}>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [taskService]: [import("./service").TaskService]) => Promise<IResult<import("./service/task.service").ITaskInfo[]>>;
}>, { userInfo, activityInfo }: IControllerInfos, [taskService]: [import("./service").TaskService]) => Promise<IResult<import("./service/task.service").ITaskInfo[]>>;
doCompleteTask: (context: IContext<{
activityId: string;
taskType: ITaskType;
itemId?: string;
}>, { userInfo, activityInfo }: IControllerInfos, [taskService]: [import("./service").TaskService]) => Promise<IResult<boolean>>;
receiveTaskRewards: (context: IContext<IParams>, { userInfo }: IControllerInfos, [taskService]: [import("./service").TaskService]) => Promise<IResult<{
rewards: number;
}>>;
......@@ -17,12 +22,12 @@ declare const _default: {
list: IAwards[];
}>>;
receiveObjectPrize: (context: IContext<import("./controller/awards.controller").IReceiveOjectParams>, { activityInfo }: IControllerInfos, [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<import("taobao-mini-sdk/lib/utils/codetypes").CodeType | IAwards, 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 | string[] | number[] | object[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<import("taobao-mini-sdk/lib/utils/codetypes").CodeType | IAwards, true>>;
doHelp: (context: IContext<{
activityId: string;
inviteId: string;
}>, { userInfo, activityInfo, inviteUserInfo }: import("./controller/share.controller").IdoHelpInfos, [taskService, statService]: [import("./service").TaskService, import("./service").StatService]) => 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 | string[] | number[] | object[], 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>>;
getRankList: (context: IContext<{
activityId: string;
......
......@@ -11,8 +11,8 @@ var stat_controller_1 = require("./controller/stat.controller");
var login_controller_1 = require("./controller/login.controller");
var _a = new user_controller_1.default(), getVipInfo = _a.getVipInfo, getRankList = _a.getRankList;
var login = new login_controller_1.default().login;
var _b = new task_controller_1.default(), getTaskList = _b.getTaskList, receiveTaskRewards = _b.receiveTaskRewards, getCollectGoodsList = _b.getCollectGoodsList, // 获取收藏商品列表,包含收藏状态
doFollowTask = _b.doFollowTask, doJumpLinkTask = _b.doJumpLinkTask, doBrowseGoodsTask = _b.doBrowseGoodsTask, doCollectGoodsTask = _b.doCollectGoodsTask, doExchangeCreditsTask = _b.doExchangeCreditsTask;
var _b = new task_controller_1.default(), getTaskList = _b.getTaskList, receiveTaskRewards = _b.receiveTaskRewards, doCompleteTask = _b.doCompleteTask, getCollectGoodsList = _b.getCollectGoodsList, // 获取收藏商品列表,包含收藏状态
doExchangeCreditsTask = _b.doExchangeCreditsTask;
var _c = new base_controller_1.default(), getActivityBaseInfoById = _c.getActivityBaseInfoById, getItemListByItemIds = _c.getItemListByItemIds;
var _d = new awards_controller_1.default(), getMyPrizeList = _d.getMyPrizeList, receiveObjectPrize = _d.receiveObjectPrize, receiveEnamePrize = _d.receiveEnamePrize, drawLotteryPrize = _d.drawLotteryPrize;
var doHelp = new share_controller_1.default().doHelp;
......@@ -21,6 +21,7 @@ exports.default = {
login: login,
getVipInfo: getVipInfo,
getTaskList: getTaskList,
doCompleteTask: doCompleteTask,
receiveTaskRewards: receiveTaskRewards,
getActivityBaseInfoById: getActivityBaseInfoById,
getMyPrizeList: getMyPrizeList,
......
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,2CAA2C;AAC3C,gEAAyD;AACzD,gEAAyD;AACzD,gEAAyD;AACzD,oEAA6D;AAC7D,kEAA2D;AAC3D,gEAAyD;AACzD,kEAA2D;AAErD,IAAA,KAA8B,IAAI,yBAAc,EAAE,EAAhD,UAAU,gBAAA,EAAE,WAAW,iBAAyB,CAAA;AAChD,IAAA,KAAK,GAAK,IAAI,0BAAe,EAAE,MAA1B,CAA0B;AAEjC,IAAA,KASF,IAAI,yBAAc,EAAE,EARtB,WAAW,iBAAA,EACX,kBAAkB,wBAAA,EAClB,mBAAmB,yBAAA,EAAE,kBAAkB;AACvC,YAAY,kBAAA,EACZ,cAAc,oBAAA,EACd,iBAAiB,uBAAA,EACjB,kBAAkB,wBAAA,EAClB,qBAAqB,2BACC,CAAA;AAElB,IAAA,KAAoD,IAAI,yBAAc,EAAE,EAAtE,uBAAuB,6BAAA,EAAE,oBAAoB,0BAAyB,CAAA;AAExE,IAAA,KAA8E,IAAI,2BAAgB,EAAE,EAAlG,cAAc,oBAAA,EAAE,kBAAkB,wBAAA,EAAE,iBAAiB,uBAAA,EAAE,gBAAgB,sBAA2B,CAAA;AAElG,IAAA,MAAM,GAAK,IAAI,0BAAe,EAAE,OAA1B,CAA0B;AAElC,IAAA,KAAwB,IAAI,yBAAc,EAAE,EAA1C,QAAQ,cAAA,EAAE,OAAO,aAAyB,CAAA;AAElD,kBAAe;IACb,KAAK,OAAA;IACL,UAAU,YAAA;IACV,WAAW,aAAA;IACX,kBAAkB,oBAAA;IAClB,uBAAuB,yBAAA;IACvB,cAAc,gBAAA;IACd,kBAAkB,oBAAA;IAClB,iBAAiB,mBAAA;IACjB,MAAM,QAAA;IACN,QAAQ,UAAA;IACR,OAAO,SAAA;IACP,WAAW,aAAA;CACZ,CAAA"}
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,2CAA2C;AAC3C,gEAAyD;AACzD,gEAAyD;AACzD,gEAAyD;AACzD,oEAA6D;AAC7D,kEAA2D;AAC3D,gEAAyD;AACzD,kEAA2D;AAErD,IAAA,KAA8B,IAAI,yBAAc,EAAE,EAAhD,UAAU,gBAAA,EAAE,WAAW,iBAAyB,CAAA;AAChD,IAAA,KAAK,GAAK,IAAI,0BAAe,EAAE,MAA1B,CAA0B;AAEjC,IAAA,KAMF,IAAI,yBAAc,EAAE,EALtB,WAAW,iBAAA,EACX,kBAAkB,wBAAA,EAClB,cAAc,oBAAA,EACd,mBAAmB,yBAAA,EAAE,kBAAkB;AACvC,qBAAqB,2BACC,CAAA;AAElB,IAAA,KAAoD,IAAI,yBAAc,EAAE,EAAtE,uBAAuB,6BAAA,EAAE,oBAAoB,0BAAyB,CAAA;AAExE,IAAA,KAA8E,IAAI,2BAAgB,EAAE,EAAlG,cAAc,oBAAA,EAAE,kBAAkB,wBAAA,EAAE,iBAAiB,uBAAA,EAAE,gBAAgB,sBAA2B,CAAA;AAElG,IAAA,MAAM,GAAK,IAAI,0BAAe,EAAE,OAA1B,CAA0B;AAElC,IAAA,KAAwB,IAAI,yBAAc,EAAE,EAA1C,QAAQ,cAAA,EAAE,OAAO,aAAyB,CAAA;AAElD,kBAAe;IACb,KAAK,OAAA;IACL,UAAU,YAAA;IACV,WAAW,aAAA;IACX,cAAc,gBAAA;IACd,kBAAkB,oBAAA;IAClB,uBAAuB,yBAAA;IACvB,cAAc,gBAAA;IACd,kBAAkB,oBAAA;IAClB,iBAAiB,mBAAA;IACjB,MAAM,QAAA;IACN,QAAQ,UAAA;IACR,OAAO,SAAA;IACP,WAAW,aAAA;CACZ,CAAA"}
\ No newline at end of file
......@@ -24,18 +24,23 @@ export default class TaskService extends UserService {
*
* @param {ITaskType} taskType 任务类型
* @param {string} title 任务标题
* @param {ITasks} tasks 任务配置
* @param {IActivityInfo} activityInfo 任务配置
* @param {IUserInfo} userInfo 用户信息
* @return {ITaskInfo} {ITaskInfo} 任务信息
* @memberof TaskService
*/
initTask(taskType: ITaskType, title: string, tasks: ITasks, userInfo: IUserInfo): ITaskInfo;
completeTask(taskType: ITaskType, userInfo: IUserInfo, activityInfo: IActivityInfo, customRecord?: object): Promise<number>;
updateVipTask(userInfo: IUserInfo, vipInfo: IVipInfo, tasks: ITasks): {
$set: {};
$inc: {};
$push: {};
};
initTask(taskType: ITaskType, title: string, activityInfo: IActivityInfo, userInfo: IUserInfo): ITaskInfo;
/**
*根据任务类型更新任务待领取次数和任务记录
*
* @param {string} taskType
* @param {number} activityInfo
* @param {IActivityInfo} userInfo
* @param {object} [customRecord]
* @returns {boolean}
* @memberof TaskService
*/
completeTask(taskType: ITaskType, activityInfo: IActivityInfo, userInfo: IUserInfo, customRecord?: object): Promise<number>;
updateOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks, activityStartTime: number, session?: string): Promise<{}>;
updateSignTask(userInfo: IUserInfo, tasks: ITasks): {
$inc: {
......@@ -50,38 +55,6 @@ export default class TaskService extends UserService {
$inc?: undefined;
$push?: undefined;
};
/**
*更新关注店铺任务状态
*
* @param {IUserInfo} userInfo
* @param {IActivityInfo} activityInfo
* @returns
* @memberof TaskService
*/
updateFollowTask(userInfo: IUserInfo, activityInfo: IActivityInfo): Promise<number>;
/**
*
* 根据用户和任务完成情况,设置任务状态
*
* @param {IUserInfo} useInfo
* @param {string} taskType
* @param {number} taskRateType
* @param {number} [limitTimesEverday] 每天限制次数 任务频率为每天的时候必填
* @return {taskTatus} 1未完成 2 待领取 3 已完成
* @memberof TaskService
*/
setTaskStatus(useInfo: IUserInfo, taskType: string, taskRateType: number, limitTimesEveryday?: number): number;
/**
*根据任务类型更新任务待领取次数和任务记录
*
* @param {string} taskType
* @param {number} rewards
* @param {IUserInfo} userInfo
* @param {object} [customRecord]
* @returns {boolean}
* @memberof TaskService
*/
updateUserTaskRecord(taskType: string, rewards: number, userInfo: IUserInfo, customRecord?: object): Promise<boolean>;
/**
*
* 更新user表中,任务相关字段
......
......@@ -87,16 +87,17 @@ var TaskService = /** @class */ (function (_super) {
*
* @param {ITaskType} taskType 任务类型
* @param {string} title 任务标题
* @param {ITasks} tasks 任务配置
* @param {IActivityInfo} activityInfo 任务配置
* @param {IUserInfo} userInfo 用户信息
* @return {ITaskInfo} {ITaskInfo} 任务信息
* @memberof TaskService
*/
TaskService.prototype.initTask = function (taskType, title, tasks, userInfo) {
var _a = tasks, _b = taskType, _c = _a[_b], value = _c.value, _d = _c.itemIds, itemIds = _d === void 0 ? '' : _d, taskRateType = _c.taskRateType, _e = _c.times, times = _e === void 0 ? 1 : _e, _f = _c.link, link = _f === void 0 ? '' : _f;
TaskService.prototype.initTask = function (taskType, title, activityInfo, userInfo) {
var _a;
var _b = ((_a = activityInfo === null || activityInfo === void 0 ? void 0 : activityInfo.tasks) === null || _a === void 0 ? void 0 : _a[taskType]) || {}, value = _b.value, _c = _b.itemIds, itemIds = _c === void 0 ? '' : _c, taskRateType = _b.taskRateType, _d = _b.times, times = _d === void 0 ? 1 : _d, _e = _b.link, link = _e === void 0 ? '' : _e;
var remainTimes = userInfo.remainTimes;
var todayCompleteTimes = task_1.getTodayCompleteTask(taskType, userInfo).todayCompleteTimes;
var completeTimes = task_1.getCompleteTaskByUserTaskInfo(taskType, userInfo).completeTimes;
var completeTimes = task_1.getTotalCompleteTask(taskType, userInfo).completeTimes;
return {
taskType: taskType,
title: title,
......@@ -107,57 +108,44 @@ var TaskService = /** @class */ (function (_super) {
url: taskType === 'member' ? utils_1.generateVipUrl(utils_1.formatVipCbUrl(this.context)) : link,
todayCompleteTimes: todayCompleteTimes,
completeTimes: completeTimes,
status: this.setTaskStatus(userInfo, taskType, taskRateType, times),
waitReceive: remainTimes[taskType]
status: task_1.setTaskStatus(userInfo, taskType, taskRateType, times),
waitReceive: remainTimes === null || remainTimes === void 0 ? void 0 : remainTimes[taskType]
};
};
TaskService.prototype.completeTask = function (taskType, userInfo, activityInfo, customRecord) {
/**
*根据任务类型更新任务待领取次数和任务记录
*
* @param {string} taskType
* @param {number} activityInfo
* @param {IActivityInfo} userInfo
* @param {object} [customRecord]
* @returns {boolean}
* @memberof TaskService
*/
TaskService.prototype.completeTask = function (taskType, activityInfo, userInfo, customRecord) {
var _a, _b;
if (customRecord === void 0) { customRecord = {}; }
return __awaiter(this, void 0, void 0, function () {
var today, rewards;
var _c;
return __generator(this, function (_d) {
switch (_d.label) {
var _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
today = utils_1.getToday();
rewards = ((_b = (_a = activityInfo === null || activityInfo === void 0 ? void 0 : activityInfo.tasks) === null || _a === void 0 ? void 0 : _a[taskType]) === null || _b === void 0 ? void 0 : _b.value) || 0;
return [4 /*yield*/, this.updateUser(userInfo._id, {
$inc: {
'remainTimes.invites': rewards
},
$push: (_c = {},
_c["taskInfo." + today + "." + taskType] = __assign(__assign({}, customRecord), { createTime: Date.now() }),
_c)
$inc: (_c = {},
_c["remainTimes." + taskType] = rewards,
_c),
$push: (_d = {},
_d["taskInfo." + today + "." + taskType] = __assign(__assign({}, customRecord), { createTime: Date.now() }),
_d)
})];
case 1: return [2 /*return*/, _d.sent()];
case 1: return [2 /*return*/, _e.sent()];
}
});
});
};
// 根据会员状态更新
TaskService.prototype.updateVipTask = function (userInfo, vipInfo, tasks) {
var member = userInfo.member;
var newMember = member.newMember;
var today = utils_1.getToday();
var newVip = utils_1.isNewVip(userInfo, vipInfo);
var value = tasks.member.value;
var projection = {
$set: {},
$inc: {},
$push: {}
};
if (newVip && !newMember) {
member = utils_1.setNewVipUserData(member);
// @ts-ignore
projection.$set.member = member;
projection.$inc['remainTimes.member'] = +value;
projection.$push["taskInfo." + today + ".member"] = {
creatTime: Date.now()
};
}
return projection;
};
// 根据下单下单记录,更新状态
TaskService.prototype.updateOrderGoodsTask = function (userInfo, tasks, activityStartTime, session) {
var _a, _b;
......@@ -169,7 +157,7 @@ var TaskService = /** @class */ (function (_super) {
case 0:
taskType = 'orderGoods';
_c = tasks, _d = taskType, _e = _c[_d], value = _e.value, itemIds = _e.itemIds, taskRateType = _e.taskRateType, times = _e.times;
_f = task_1.getCompleteTaskByUserTaskInfo(taskType, userInfo), completeTimes = _f.completeTimes, taskInfo = _f.taskInfo;
_f = task_1.getTotalCompleteTask(taskType, userInfo), completeTimes = _f.completeTimes, taskInfo = _f.taskInfo;
todayCompleteTimes = task_1.getTodayCompleteTask(taskType, userInfo).todayCompleteTimes;
// 永久任务且已完成
if (taskRateType === constants_1.TASK_RATE_TYPE.FOREVER && completeTimes) {
......@@ -235,113 +223,6 @@ var TaskService = /** @class */ (function (_super) {
}
: {};
};
/**
*更新关注店铺任务状态
*
* @param {IUserInfo} userInfo
* @param {IActivityInfo} activityInfo
* @returns
* @memberof TaskService
*/
TaskService.prototype.updateFollowTask = function (userInfo, activityInfo) {
return __awaiter(this, void 0, void 0, function () {
var today, _id, follow, tasks, value, followInfo;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
today = utils_1.getToday();
_id = userInfo._id, follow = userInfo.follow;
tasks = activityInfo.tasks;
value = (tasks || {}).follow.value;
followInfo = utils_1.setNewFollowUserData(follow);
return [4 /*yield*/, this.updateUser(_id, {
$set: {
follow: followInfo
},
$inc: {
'remainTimes.follow': value
},
$push: (_a = {},
_a["taskInfo." + today + ".follow"] = {
creatTime: Date.now()
},
_a)
})];
case 1:
// 增加待领取次数
return [2 /*return*/, _b.sent()];
}
});
});
};
/**
*
* 根据用户和任务完成情况,设置任务状态
*
* @param {IUserInfo} useInfo
* @param {string} taskType
* @param {number} taskRateType
* @param {number} [limitTimesEverday] 每天限制次数 任务频率为每天的时候必填
* @return {taskTatus} 1未完成 2 待领取 3 已完成
* @memberof TaskService
*/
TaskService.prototype.setTaskStatus = function (useInfo, taskType, taskRateType, limitTimesEveryday) {
var _a;
if (limitTimesEveryday === void 0) { limitTimesEveryday = 1; }
var waitReceive = ((_a = useInfo === null || useInfo === void 0 ? void 0 : useInfo.remainTimes) === null || _a === void 0 ? void 0 : _a[taskType]) || 0;
if (waitReceive)
return constants_1.TASK_STATUS.WAIT_RECEIVE;
// 当天的完成次数
var todayCompleteTimes = task_1.getTodayCompleteTask(taskType, useInfo).todayCompleteTimes;
// 总共的完成次数
var completeTimes = task_1.getCompleteTaskByUserTaskInfo(taskType, useInfo).completeTimes;
switch (taskRateType) {
case constants_1.TASK_RATE_TYPE.FOREVER:
return completeTimes > 0 ? constants_1.TASK_STATUS.DONE : constants_1.TASK_STATUS.WAIT_DO;
break;
case constants_1.TASK_RATE_TYPE.EVERYDAY:
return todayCompleteTimes >= limitTimesEveryday ? constants_1.TASK_STATUS.DONE : constants_1.TASK_STATUS.WAIT_DO;
break;
case constants_1.TASK_RATE_TYPE.NOLIMIT:
return constants_1.TASK_STATUS.WAIT_DO;
break;
}
};
/**
*根据任务类型更新任务待领取次数和任务记录
*
* @param {string} taskType
* @param {number} rewards
* @param {IUserInfo} userInfo
* @param {object} [customRecord]
* @returns {boolean}
* @memberof TaskService
*/
TaskService.prototype.updateUserTaskRecord = function (taskType, rewards, userInfo, customRecord) {
return __awaiter(this, void 0, void 0, function () {
var _id, today, result;
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_id = userInfo._id;
today = utils_1.getToday();
return [4 /*yield*/, this.updateUser(_id, {
$inc: (_a = {},
_a["remainTimes." + taskType] = rewards,
_a),
$push: (_b = {},
_b["taskInfo." + today + "." + taskType] = __assign({ createTime: Date.now() }, customRecord),
_b)
})];
case 1:
result = _c.sent();
return [2 /*return*/, result === 1];
}
});
});
};
/**
*
* 更新user表中,任务相关字段
......
{"version":3,"file":"task.service.js","sourceRoot":"","sources":["../../src/service/task.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA8B;AAC9B,+CAAwC;AACxC,kCAUiB;AACjB,0CAA0D;AAC1D,6CAA0F;AAe1F;IAAyC,+BAAW;IAClD,qBAAY,OAA0B;eACpC,kBAAM,OAAO,CAAC;IAChB,CAAC;IACD;;;;;;;;;OASG;IACH,8BAAQ,GAAR,UAAS,QAAmB,EAAE,KAAa,EAAE,KAAa,EAAE,QAAmB;QAE3E,IACE,KAAA,KAAK,EADP,KAAC,QAAS,EAAV,WAAuE,EAAzD,KAAK,WAAA,EAAE,eAAY,EAAZ,OAAO,mBAAG,EAAE,KAAA,EAAE,YAAY,kBAAA,EAAE,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAA,EAAE,YAAS,EAAT,IAAI,mBAAG,EAAE,KAC9D,CAAA;QAED,IAAA,WAAW,GAAK,QAAQ,YAAb,CAAa;QACxB,IAAA,kBAAkB,GAAK,2BAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,mBAA7C,CAA6C;QAC/D,IAAA,aAAa,GAAK,oCAA6B,CAAC,QAAQ,EAAE,QAAQ,CAAC,cAAtD,CAAsD;QAE3E,OAAO;YACL,QAAQ,UAAA;YACR,KAAK,OAAA;YACL,OAAO,SAAA;YACP,OAAO,EAAE,KAAK;YACd,YAAY,cAAA;YACZ,KAAK,OAAA;YACL,GAAG,EAAE,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,sBAAc,CAAC,sBAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;YAChF,kBAAkB,oBAAA;YAClB,aAAa,eAAA;YACb,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ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,IAAI,IAAI,EAAE,CAAA;wBAC7B,KAAK,GAAG,UAAU,CAAC,IAAI,IAAI,EAAE,CAAA;wBAC7B,MAAM,GAAG,UAAU,CAAC,KAAK,IAAI,EAAE,CAAA;wBAErC,SAAS;wBACT,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE;4BACjD,OAAO,UAAU,CAAC,IAAI,CAAA;yBACvB;wBACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE;4BACjD,OAAO,UAAU,CAAC,IAAI,CAAA;yBACvB;wBACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,IAAI,UAAU,CAAC,KAAK,EAAE;4BACnD,OAAO,UAAU,CAAC,KAAK,CAAA;yBACxB;wBAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;4BACnC,sBAAO,QAAQ,EAAA;yBAChB;wBAED,qBAAM,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC;4BAErC,mBAAmB;0BAFkB;;wBAArC,SAAqC,CAAA;wBAErC,mBAAmB;wBACnB,qBAAM,aAAK,CAAC,EAAE,CAAC,EAAA;;wBADf,mBAAmB;wBACnB,SAAe,CAAA;wBAER,qBAAM,IAAI,CAAC,WAAW,EAAE,EAAA;4BAA/B,sBAAO,SAAwB,EAAA;;;;KAChC;IACH,kBAAC;AAAD,CAAC,AA5LD,CAAyC,sBAAW,GA4LnD"}
\ No newline at end of file
......@@ -213,7 +213,7 @@ var UserService = /** @class */ (function (_super) {
projection.$inc["remainTimes.follow"] = follow.value;
}
newVip = userUpdate_1.isNewVip(userInfo, vipInfo);
if (newVip && !userInfo.member.newMember) {
if (newVip) {
// @ts-ignore
projection.$set.member = this.setNewVipUserData(userInfo.member);
projection.$push["taskInfo." + today + ".member"] = { createTime: Date.now() };
......
{"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../src/service/user.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAAwC;AACxC,+CAAwC;AACxC,4BAAoC;AACpC,kCAA+D;AAC/D,yDAAqD;AACrD,iDAAuD;AACvD;IAA0B,+BAAW;IAEnC,qBAAY,OAA0B;QAAtC,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,OAAO,GAAG,IAAI,aAAO,CAAC,OAAO,EAAE,iBAAY,CAAC,CAAA;;IACnD,CAAC;IACD;;;OAGG;IACG,iCAAW,GAAjB;;;;;;wBACM,KAAmB,IAAI,CAAC,OAAO,EAA7B,MAAM,YAAA,EAAE,IAAI,UAAA,CAAiB;wBAC7B,UAAU,GAAK,IAAI,WAAT,CAAS;wBACZ,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAY,EAAE,MAAM,QAAA,EAAE,UAAU,YAAA,EAAE,CAAC,EAAA;;wBAAtE,MAAM,GAAG,SAA6D;wBAC1E,sBAAO,MAAM,EAAA;;;;KACd;IAED;;;;;OAKG;IACG,yCAAmB,GAAzB,UAA0B,MAAc;;;;;;wBAChC,UAAU,GAAK,IAAI,CAAC,OAAO,CAAC,IAAI,WAAtB,CAAsB;wBACzB,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAY,EAAE,MAAM,QAAA,EAAE,UAAU,YAAA,EAAE,CAAC,EAAA;;wBAAtE,MAAM,GAAG,SAA6D;wBAC1E,sBAAO,MAAM,EAAA;;;;KACd;IAED;;;;;;;OAOG;IACG,kCAAY,GAAlB,UAAmB,OAAiB,EAAE,YAA2B;;;;;;;wBACzD,KAAmB,IAAI,CAAC,OAAO,EAA7B,MAAM,YAAA,EAAE,IAAI,UAAA,CAAiB;wBAC7B,UAAU,GAA2C,IAAI,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AA;6BACR;yBACF;wBACM,qBAAM,IAAI,CAAC,OAAO,CAAC,KAAK,WAAG,GAAC,YAAY,IAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,aAAU,aAAA,MAAG,EAAA;;wBAAnF,IAAI,GAAG,SAA4E,CAAA;wBACnF,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,GAAG,CAAA;wBACrB,sBAAO,IAAI,EAAA;;;;KACZ;IAED;;;;OAIG;IACG,qCAAe,GAArB,UAAsB,GAAW;;;;4BACxB,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,KAAA,EAAE,CAAC,EAAA;4BAA1C,sBAAO,SAAmC,EAAA;;;;KAC3C;IACH,kBAAC;AAAD,CAAC,AAlND,CAA0B,sBAAW,GAkNpC;AAED,kBAAe,WAAW,CAAA"}
\ No newline at end of file
{"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../src/service/user.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAAwC;AACxC,+CAAwC;AACxC,4BAAoC;AACpC,kCAA+D;AAC/D,yDAAqD;AACrD,iDAAuD;AACvD;IAA0B,+BAAW;IAEnC,qBAAY,OAA0B;QAAtC,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,OAAO,GAAG,IAAI,aAAO,CAAC,OAAO,EAAE,iBAAY,CAAC,CAAA;;IACnD,CAAC;IACD;;;OAGG;IACG,iCAAW,GAAjB;;;;;;wBACM,KAAmB,IAAI,CAAC,OAAO,EAA7B,MAAM,YAAA,EAAE,IAAI,UAAA,CAAiB;wBAC7B,UAAU,GAAK,IAAI,WAAT,CAAS;wBACZ,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAY,EAAE,MAAM,QAAA,EAAE,UAAU,YAAA,EAAE,CAAC,EAAA;;wBAAtE,MAAM,GAAG,SAA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GAAK,IAAI,CAAC,OAAO,OAAjB,CAAiB;wBACX,qBAAM,IAAI,CAAC,OAAO,CAAC,IAAI,WACvC,GAAC,YAAY,IAAG,SAAS,EAAE,aAAU,aAAA,OACvC;gCACE,IAAI,YAAI,GAAC,WAAW,IAAG,CAAC,KAAE;6BAC3B,CACF,EAAA;;wBALG,aAAa,GAAG,SAKnB;wBAEG,GAAG,GAAG,CAAC,CAAA;wBAEX,eAAe;wBACf,KAAS,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;4BAC7C,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,EAAE;gCACtC,GAAG,GAAG,CAAC,CAAA;6BACR;yBACF;wBACM,qBAAM,IAAI,CAAC,OAAO,CAAC,KAAK,WAAG,GAAC,YAAY,IAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,aAAU,aAAA,MAAG,EAAA;;wBAAnF,IAAI,GAAG,SAA4E,CAAA;wBACnF,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,GAAG,CAAA;wBACrB,sBAAO,IAAI,EAAA;;;;KACZ;IAED;;;;OAIG;IACG,qCAAe,GAArB,UAAsB,GAAW;;;;4BACxB,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,KAAA,EAAE,CAAC,EAAA;4BAA1C,sBAAO,SAAmC,EAAA;;;;KAC3C;IACH,kBAAC;AAAD,CAAC,AAlND,CAA0B,sBAAW,GAkNpC;AAED,kBAAe,WAAW,CAAA"}
\ No newline at end of file
......@@ -7,7 +7,6 @@ export * from './common/logger';
export * from './common/rand';
export * from './common/getUserOrderlist';
export * from './common/vip';
export * from './common/exportHandlers';
export * from './common/helper';
export * from './common/userUpdate';
export * from './common/format';
......
......@@ -23,7 +23,6 @@ __exportStar(require("./common/logger"), exports);
__exportStar(require("./common/rand"), exports);
__exportStar(require("./common/getUserOrderlist"), exports);
__exportStar(require("./common/vip"), exports);
__exportStar(require("./common/exportHandlers"), exports);
__exportStar(require("./common/helper"), exports);
__exportStar(require("./common/userUpdate"), exports);
__exportStar(require("./common/format"), exports);
......
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;AAEd,cAAc;AACd,sDAAmC;AAEnC,iBAAiB;AACjB,oDAAiC;AAEjC,gBAAgB;AAChB,uDAAoC;AAEpC,SAAS;AACT,sDAAmC;AAEnC,kDAA+B;AAE/B,gDAA6B;AAE7B,4DAAyC;AAEzC,+CAA4B;AAE5B,0DAAuC;AAEvC,kDAA+B;AAE/B,sDAAmC;AAEnC,kDAA+B;AAE/B,qDAAkC"}
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;AAEd,cAAc;AACd,sDAAmC;AAEnC,iBAAiB;AACjB,oDAAiC;AAEjC,gBAAgB;AAChB,uDAAoC;AAEpC,SAAS;AACT,sDAAmC;AAEnC,kDAA+B;AAE/B,gDAA6B;AAE7B,4DAAyC;AAEzC,+CAA4B;AAE5B,kDAA+B;AAE/B,sDAAmC;AAEnC,kDAA+B;AAE/B,qDAAkC"}
\ No newline at end of file
......@@ -52,7 +52,7 @@ export default class Share {
): Promise<IResult<boolean>> {
const { openId } = context
const result = await taskService.completeTask('invites', inviteUserInfo, activityInfo, {
const result = await taskService.completeTask('invites', activityInfo, inviteUserInfo, {
openId
})
......
......@@ -2,12 +2,14 @@
import { CODE_TYPES, TASK_RATE_TYPE } from './../constants'
import { checkParams, services, registeInfos, preCheck } from '../decorator/common'
import { resultsModel, TBAPIS } from '../sdk'
import { TaskService, BaseService } from '../service'
import { ITaskInfo } from '../service/task.service'
import { checkActivityTime } from '../utils/common/check/checkActivityTime'
import { getCompleteTaskByUserTaskInfo, getTodayCompleteTask } from '../utils/common/task'
import { getTotalCompleteTask, getTodayCompleteTask } from '../utils/common/task'
import { update } from '../decorator/common/update'
import { updateVip } from '../utils/common/update/updateVip'
import { checkTaskLimit } from '../utils/common/check/checkTaskLimit'
export default class Task {
/**
......@@ -17,66 +19,25 @@ export default class Task {
@registeInfos(['vipInfo'])
@services([TaskService])
@preCheck([checkActivityTime])
@update([updateVip])
async getTaskList(
context: IContext<{ activityId: string }>,
{ userInfo, vipInfo, activityInfo }: IControllerInfos,
{ userInfo, activityInfo }: IControllerInfos,
[taskService]: [TaskService]
): Promise<IResult<ITaskInfo[]>> {
const { tasks, startTime } = activityInfo
// 更新user状态
let updatedUserInfo = await taskService.updateTasks(
userInfo._id,
// 需要查询更新的任务
[
taskService.updateVipTask(userInfo, vipInfo, tasks)
// taskService.updateSignTask(userInfo, tasks),
// await taskService.updateOrderGoodsTask(userInfo, tasks, startTime, session)
],
userInfo
)
if (!updatedUserInfo) return resultsModel.error(CODE_TYPES.SYSTEM_ERROR, '更新任务列表失败')
// 返回对应的任务时, B端b_activity_config tasks 需配置对应的任务
return resultsModel.success([
taskService.initTask('member', '加入会员', tasks, updatedUserInfo),
taskService.initTask('follow', '关注店铺', tasks, updatedUserInfo)
// taskService.initTask('sign', '签到', tasks, updatedUserInfo),
// taskService.initTask('orderGoods', '购买商品', tasks, updatedUserInfo),
// taskService.initTask('browseGoods', '浏览商品', tasks, updatedUserInfo),
// taskService.initTask('collectGoods', '收藏商品', tasks, updatedUserInfo),
// taskService.initTask('jumpLink', '浏览页面', tasks, updatedUserInfo),
// taskService.initTask('invites', '邀请好友', tasks, updatedUserInfo),
// taskService.initTask('exchangeCredits', '积分兑换', tasks, updatedUserInfo)
taskService.initTask('member', '加入会员', activityInfo, userInfo),
taskService.initTask('follow', '关注店铺', activityInfo, userInfo)
// taskService.initTask('sign', '签到', activityInfo, userInfo),
// taskService.initTask('orderGoods', '购买商品', activityInfo, userInfo),
// taskService.initTask('browseGoods', '浏览商品', activityInfo, userInfo),
// taskService.initTask('collectGoods', '收藏商品', activityInfo, userInfo),
// taskService.initTask('jumpLink', '浏览页面', activityInfo, userInfo),
// taskService.initTask('invites', '邀请好友', activityInfo, userInfo)
// taskService.initTask('exchangeCredits', '积分兑换', activityInfo, updatedUserInfo)
])
}
/**
* 完成关注店铺任务
*/
@checkParams(['activityId'])
@services([TaskService])
@preCheck([checkActivityTime])
async doFollowTask(
context: IContext<{ activityId: string }>,
{ userInfo, activityInfo }: IControllerInfos,
[TaskService]: [TaskService]
): Promise<IResult<boolean>> {
let { follow } = userInfo
const { flag, newFollow } = follow
// 已经关注过店铺,不可完成
const hasFollowed = flag || newFollow
if (hasFollowed) return resultsModel.error(CODE_TYPES.ERROR_TASK_COMPLETE)
// 更新状态
const result = await TaskService.updateFollowTask(userInfo, activityInfo)
return result ? resultsModel.success(true) : resultsModel.error(CODE_TYPES.SYSTEM_ERROR)
}
/**
* 积分兑换次数
*/
......@@ -122,138 +83,32 @@ export default class Task {
if (!result) return resultsModel.error(CODE_TYPES.SYSTEM_ERROR)
// 更新user表
await taskService.updateUserTaskRecord(taskType, value, userInfo)
return resultsModel.success(true)
}
/**
* 浏览商品
*/
@checkParams(['activityId', 'itemId'])
@services([TaskService])
@preCheck([checkActivityTime])
async doBrowseGoodsTask(
context: IContext<IParams>,
{ userInfo, activityInfo }: IControllerInfos,
[taskService]: [TaskService]
): Promise<IResult<boolean>> {
const taskType = 'browseGoods'
const { itemId } = context.data
const {
tasks: {
browseGoods: { taskRateType, times, itemIds, value }
}
} = activityInfo
const itemIdArray: number[] = Array.isArray(itemIds) ? itemIds : itemIds.split(',').map(v => +v)
// B端配置商品ids不匹配正确
if (!itemIdArray.includes(+itemId)) return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '商品id不匹配')
const { todayTaskInfo, todayCompleteTimes } = getTodayCompleteTask('browseGoods', userInfo)
const hasCompleteToday = todayTaskInfo.some(v => v.itemId === itemId) && taskRateType === TASK_RATE_TYPE.EVERYDAY
// 今日任务已经完成
if (hasCompleteToday) {
return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '今日该浏览商品任务已完成')
}
// 次数超限
if (times && times === todayCompleteTimes && taskRateType === TASK_RATE_TYPE.EVERYDAY) {
return resultsModel.error(CODE_TYPES.ERROR_TASK_LIMIT)
}
// 更新user表
await taskService.updateUserTaskRecord(taskType, value, userInfo, {
itemId
})
await taskService.completeTask(taskType, activityInfo, userInfo)
return resultsModel.success(true)
}
/**
* 收藏商品
* 完成任务
*/
@checkParams(['activityId', 'itemId'])
@services([TaskService])
@preCheck([checkActivityTime])
async doCollectGoodsTask(
context: IContext<IParams>,
{ userInfo, activityInfo }: IControllerInfos,
[taskService]: [TaskService]
): Promise<IResult<boolean>> {
const taskType = 'collectGoods'
const { itemId } = context.data
const {
tasks: {
collectGoods: { taskRateType, times, itemIds, value }
}
} = activityInfo
const itemIdArray: number[] = Array.isArray(itemIds) ? itemIds : itemIds.split(',').map(v => +v)
// B端配置商品ids不匹配正确
if (!itemIdArray.includes(+itemId)) return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '商品id不匹配')
const { todayTaskInfo, todayCompleteTimes } = getTodayCompleteTask(taskType, userInfo)
const hasCompleteToday =
todayTaskInfo.filter(v => v.itemId === itemId).length && taskRateType === TASK_RATE_TYPE.EVERYDAY
// 今日任务已经完成
if (hasCompleteToday) {
return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '今日该收藏商品任务已完成')
}
// 次数超限
if (times && times === todayCompleteTimes && taskRateType === TASK_RATE_TYPE.EVERYDAY) {
return resultsModel.error(CODE_TYPES.ERROR_TASK_LIMIT)
}
// 更新user表
await taskService.updateUserTaskRecord(taskType, value, userInfo, {
itemId
})
return resultsModel.success(true)
}
/**
* 浏览链接
*/
@checkParams(['activityId'])
@checkParams(['activityId', 'taskType'])
@services([TaskService])
@preCheck([checkActivityTime])
async doJumpLinkTask(
context: IContext<IParams>,
@preCheck([checkActivityTime, checkTaskLimit])
async doCompleteTask(
context: IContext<{
activityId: string
taskType: ITaskType
itemId?: string // 涉及到商品的任务需传itemId
}>,
{ userInfo, activityInfo }: IControllerInfos,
[taskService]: [TaskService]
): Promise<IResult<boolean>> {
const taskType = 'jumpLink'
const {
tasks: {
jumpLink: { taskRateType, times, value, link }
}
} = activityInfo
const { todayCompleteTimes } = getTodayCompleteTask(taskType, userInfo)
const hasCompleteToday = times && todayCompleteTimes === times && taskRateType === TASK_RATE_TYPE.EVERYDAY
// 今日任务已经完成
if (hasCompleteToday) {
return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '今日跳转链接任务已完成')
}
// 次数超限
if (times && times === todayCompleteTimes && taskRateType === TASK_RATE_TYPE.EVERYDAY) {
return resultsModel.error(CODE_TYPES.ERROR_TASK_LIMIT)
}
const { taskType, itemId } = context.data
// 更新user表
await taskService.updateUserTaskRecord(taskType, value, userInfo)
const result = await taskService.completeTask(taskType, activityInfo, userInfo, { itemId })
return resultsModel.success(true)
return result ? resultsModel.success(true) : resultsModel.error(CODE_TYPES.SYSTEM_ERROR, '任务完成失败')
}
/**
......@@ -307,7 +162,7 @@ export default class Task {
const { itemIds } = context.data
const list = await baseService.getItemListByIds(itemIds, session)
const { taskInfo } = getCompleteTaskByUserTaskInfo('collectGoods', userInfo)
const { taskInfo } = getTotalCompleteTask('collectGoods', userInfo)
const listWithCollectStatus = list.map(v => {
return {
......
/** @format */
import { merge } from 'lodash'
// 检验参数是否存在
export const update = (checks: IFunction[]) => {
return function (target: Object, name: string, descriptor: PropertyDescriptor) {
......@@ -7,17 +9,20 @@ export const update = (checks: IFunction[]) => {
descriptor.value = async function (...args: any[]) {
let [context, otherArgs = {}, services = []] = args
let totalUpdateProjection: IDecoratorUpdateQuery = {}
for (let i = 0; i < checks.length; i++) {
const checkFn = checks[i]
let result = await checkFn.apply(target, [context, { ...otherArgs }, services])
let result: IDecoratorUpdateQuery = await checkFn.apply(target, [context, { ...otherArgs }, services])
result = result || {}
// 校验报错
if ((result as IErrorResult)?.success === false && (result as IErrorResult)?.code) {
return result
}
otherArgs = { ...otherArgs, ...result }
totalUpdateProjection = merge({}, totalUpdateProjection, result)
otherArgs = { ...otherArgs }
}
return method.apply(target, [context, { ...otherArgs }, services])
}
......
......@@ -15,11 +15,8 @@ const { login } = new LoginController()
const {
getTaskList,
receiveTaskRewards,
doCompleteTask,
getCollectGoodsList, // 获取收藏商品列表,包含收藏状态
doFollowTask,
doJumpLinkTask,
doBrowseGoodsTask,
doCollectGoodsTask,
doExchangeCreditsTask
} = new TaskController()
......@@ -35,6 +32,7 @@ export default {
login,
getVipInfo,
getTaskList,
doCompleteTask,
receiveTaskRewards,
getActivityBaseInfoById,
getMyPrizeList,
......
......@@ -18,7 +18,7 @@ import {
isNewVip
} from '../utils'
import { TASK_RATE_TYPE, TASK_STATUS } from '../constants'
import { getTodayCompleteTask, getCompleteTaskByUserTaskInfo } from '../utils/common/task'
import { getTodayCompleteTask, getTotalCompleteTask, setTaskStatus } from '../utils/common/task'
export interface ITaskInfo {
taskType?: string // 任务类型
......@@ -42,19 +42,16 @@ export default class TaskService extends UserService {
*
* @param {ITaskType} taskType 任务类型
* @param {string} title 任务标题
* @param {ITasks} tasks 任务配置
* @param {IActivityInfo} activityInfo 任务配置
* @param {IUserInfo} userInfo 用户信息
* @return {ITaskInfo} {ITaskInfo} 任务信息
* @memberof TaskService
*/
initTask(taskType: ITaskType, title: string, tasks: ITasks, userInfo: IUserInfo): ITaskInfo {
const {
[taskType]: { value, itemIds = '', taskRateType, times = 1, link = '' }
} = tasks
initTask(taskType: ITaskType, title: string, activityInfo: IActivityInfo, userInfo: IUserInfo): ITaskInfo {
const { value, itemIds = '', taskRateType, times = 1, link = '' } = activityInfo?.tasks?.[taskType] || {}
const { remainTimes } = userInfo
const { todayCompleteTimes } = getTodayCompleteTask(taskType, userInfo)
const { completeTimes } = getCompleteTaskByUserTaskInfo(taskType, userInfo)
const { completeTimes } = getTotalCompleteTask(taskType, userInfo)
return {
taskType,
......@@ -66,17 +63,32 @@ export default class TaskService extends UserService {
url: taskType === 'member' ? generateVipUrl(formatVipCbUrl(this.context)) : link,
todayCompleteTimes,
completeTimes,
status: this.setTaskStatus(userInfo, taskType, taskRateType, times),
waitReceive: remainTimes[taskType]
status: setTaskStatus(userInfo, taskType, taskRateType, times),
waitReceive: remainTimes?.[taskType]
}
}
async completeTask(taskType: ITaskType, userInfo: IUserInfo, activityInfo: IActivityInfo, customRecord: object = {}) {
/**
*根据任务类型更新任务待领取次数和任务记录
*
* @param {string} taskType
* @param {number} activityInfo
* @param {IActivityInfo} userInfo
* @param {object} [customRecord]
* @returns {boolean}
* @memberof TaskService
*/
async completeTask(
taskType: ITaskType,
activityInfo: IActivityInfo,
userInfo: IUserInfo,
customRecord: object = {}
): Promise<number> {
const today = getToday()
const rewards = activityInfo?.tasks?.[taskType]?.value || 0
return await this.updateUser(userInfo._id, {
$inc: {
'remainTimes.invites': rewards
[`remainTimes.${taskType}`]: rewards
},
$push: {
[`taskInfo.${today}.${taskType}`]: { ...customRecord, createTime: Date.now() }
......@@ -84,45 +96,13 @@ export default class TaskService extends UserService {
})
}
// 根据会员状态更新
updateVipTask(userInfo: IUserInfo, vipInfo: IVipInfo, tasks: ITasks) {
let { member } = userInfo
const { newMember } = member
const today = getToday()
const newVip = isNewVip(userInfo, vipInfo)
const {
member: { value }
} = tasks
let projection = {
$set: {},
$inc: {},
$push: {}
}
if (newVip && !newMember) {
member = setNewVipUserData(member)
// @ts-ignore
projection.$set.member = member
projection.$inc['remainTimes.member'] = +value
projection.$push[`taskInfo.${today}.member`] = {
creatTime: Date.now()
}
}
return projection
}
// 根据下单下单记录,更新状态
async updateOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks, activityStartTime: number, session?: string) {
const taskType = 'orderGoods'
const {
[taskType]: { value, itemIds, taskRateType, times }
} = tasks
const { completeTimes, taskInfo } = getCompleteTaskByUserTaskInfo(taskType, userInfo)
const { completeTimes, taskInfo } = getTotalCompleteTask(taskType, userInfo)
const { todayCompleteTimes } = getTodayCompleteTask(taskType, userInfo)
// 永久任务且已完成
if (taskRateType === TASK_RATE_TYPE.FOREVER && completeTimes) {
......@@ -199,106 +179,6 @@ export default class TaskService extends UserService {
: {}
}
/**
*更新关注店铺任务状态
*
* @param {IUserInfo} userInfo
* @param {IActivityInfo} activityInfo
* @returns
* @memberof TaskService
*/
async updateFollowTask(userInfo: IUserInfo, activityInfo: IActivityInfo) {
const today = getToday()
let { _id, follow } = userInfo
// 获取活动基本信息
const { tasks } = activityInfo
// 获取关注店铺奖励
const {
follow: { value }
} = tasks || {}
// 更新follow信息
const followInfo: IFollowInfo = setNewFollowUserData(follow)
// 增加待领取次数
return await this.updateUser(_id, {
$set: {
follow: followInfo
},
$inc: {
'remainTimes.follow': value
},
$push: {
[`taskInfo.${today}.follow`]: {
creatTime: Date.now()
}
}
})
}
/**
*
* 根据用户和任务完成情况,设置任务状态
*
* @param {IUserInfo} useInfo
* @param {string} taskType
* @param {number} taskRateType
* @param {number} [limitTimesEverday] 每天限制次数 任务频率为每天的时候必填
* @return {taskTatus} 1未完成 2 待领取 3 已完成
* @memberof TaskService
*/
setTaskStatus(useInfo: IUserInfo, taskType: string, taskRateType: number, limitTimesEveryday: number = 1): number {
const waitReceive = useInfo?.remainTimes?.[taskType] || 0
if (waitReceive) return TASK_STATUS.WAIT_RECEIVE
// 当天的完成次数
const { todayCompleteTimes } = getTodayCompleteTask(taskType, useInfo)
// 总共的完成次数
const { completeTimes } = getCompleteTaskByUserTaskInfo(taskType, useInfo)
switch (taskRateType) {
case TASK_RATE_TYPE.FOREVER:
return completeTimes > 0 ? TASK_STATUS.DONE : TASK_STATUS.WAIT_DO
break
case TASK_RATE_TYPE.EVERYDAY:
return todayCompleteTimes >= limitTimesEveryday ? TASK_STATUS.DONE : TASK_STATUS.WAIT_DO
break
case TASK_RATE_TYPE.NOLIMIT:
return TASK_STATUS.WAIT_DO
break
}
}
/**
*根据任务类型更新任务待领取次数和任务记录
*
* @param {string} taskType
* @param {number} rewards
* @param {IUserInfo} userInfo
* @param {object} [customRecord]
* @returns {boolean}
* @memberof TaskService
*/
async updateUserTaskRecord(
taskType: string,
rewards: number,
userInfo: IUserInfo,
customRecord?: object
): Promise<boolean> {
const { _id } = userInfo
const today = getToday()
const result = await this.updateUser(_id, {
$inc: {
[`remainTimes.${taskType}`]: rewards
},
$push: {
[`taskInfo.${today}.${taskType}`]: { createTime: Date.now(), ...customRecord }
}
})
return result === 1
}
/**
*
* 更新user表中,任务相关字段
......
......@@ -127,7 +127,7 @@ class UserService extends BaseService {
// 之前进入活动非会员,现在进入会员,则视为新会员用户
const newVip = isNewVip(userInfo, vipInfo)
if (newVip && !userInfo.member.newMember) {
if (newVip) {
// @ts-ignore
projection.$set.member = this.setNewVipUserData(userInfo.member)
projection.$push[`taskInfo.${today}.member`] = { createTime: Date.now() }
......
......@@ -109,18 +109,21 @@ interface IUpdateQuery {
$set?: { [key: string]: any }
$setOnInsert?: { [key: string]: any }
$unset?: { [key: string]: any }
$addToSet?: { [key: string]: any }
$pop?: { [key: string]: any }
$pull?: { [key: string]: any }
$push?: { [key: string]: any }
$pullAll?: { [key: string]: any }
$bit?: {
[key: string]: { [key in 'and' | 'or' | 'xor']?: number }
}
}
interface IDecoratorUpdateQuery {
$inc?: { [key: string]: number | undefined }
$set?: { [key: string]: any }
$push?: { [key: string]: any }
}
interface IFindProjection {
projection?: {
[key: string]: number | boolean | any
......
/** @format */
import { resultsModel, TBAPIS } from '../../../sdk'
import { CODE_TYPES } from '../../../errorCode'
import { getTodayCompleteTask, getTotalCompleteTask } from '../task'
import { TASK_RATE_TYPE } from '../../../constants'
export const checkExchangeCreditsTask = async (
context: IContext<{ activityId: string; taskType: ITaskType; credits?: number }>,
{ session }: IControllerInfos
) => {
const { taskType, credits } = context.data
// 不是兑换积分类型不校验
if (taskType !== 'exchangeCredits') return
const myCredits = await TBAPIS.queryCredits(context, session)
console.log('myCredits', myCredits)
// 积分不足
if (myCredits < credits) return resultsModel.error(CODE_TYPES.ERROR_NO_CREDITS)
// 扣积分
let result = await TBAPIS.changeCredits(context, session, {
quantity: +credits,
change_type: 2, //变更类型:0交易,1:互动活动,2:权益兑换,3:手工调整
opt_type: 1, // 操作类型,'0':增加,1:扣减
remark: `积分兑换任务减积分`
})
if (!result) return resultsModel.error(CODE_TYPES.SYSTEM_ERROR)
}
......@@ -14,6 +14,7 @@ export const checkInviteId = async (context: IContext<{ activityId: string; invi
// 自己邀请自己
if (openId === inviteId) return resultsModel.error(CODE_TYPES.ERROR_NO_INVITE_SELF)
// 获取邀请者信息
const inviteUserInfo = await dbFindOne<IUserInfo>(context, USER_DB_NAME, {
activityId,
openId: inviteId
......
......@@ -4,11 +4,6 @@ import { resultsModel } from '../../../sdk'
import { CODE_TYPES } from '../../../errorCode'
export const checkNewVip = async (context: IContext<IParams>, { vipInfo, userInfo }: IControllerInfos) => {
const {
openId,
data: { activityId, inviteId }
} = context
if (!vipInfo) {
console.error(`使用checkNewVip registeInfos必须注册vipInfo`)
}
......
/** @format */
export const checkTaskLimit = (taskType: ITaskType) => {
return async function (context: IContext<IParams>, { activityInfo, userInfo }: IControllerInfos) {
const {
tasks: {
[taskType]: { value, taskRateType, times }
}
} = activityInfo
const {} = userInfo
import { resultsModel } from '../../../sdk'
import { CODE_TYPES } from '../../../errorCode'
import { getTodayCompleteTask, getTotalCompleteTask } from '../task'
import { TASK_RATE_TYPE } from '../../../constants'
export const checkTaskLimit = async (
context: IContext<{ activityId: string; taskType: ITaskType; itemId?: string }>,
{ userInfo, activityInfo }: IControllerInfos
) => {
const { taskType, itemId } = context.data
const { itemIds } = activityInfo?.tasks?.[taskType] || {}
if (!taskType) {
console.error('使用checkTaskLimit, 云函数必须传入taskType参数')
return
}
if (!activityInfo?.tasks?.[taskType]) {
return resultsModel.error(CODE_TYPES.SYSTEM_ERROR, `该活动缺少${taskType}配置项`)
}
if (itemId && !itemIds) {
return resultsModel.error(CODE_TYPES.SYSTEM_ERROR, `该任务缺少商品配置项`)
}
// B端配置商品ids不匹配正确
if (itemId && itemIds) {
const itemIdArray: number[] = Array.isArray(itemIds) ? itemIds : itemIds.split(',').map(v => +v)
if (!itemIdArray.includes(+itemId)) return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '商品id不匹配')
}
const { taskRateType, times } = activityInfo?.tasks?.[taskType]
// 永久任务已经完成
const { completeTimes } = getTotalCompleteTask(taskType, userInfo)
const hasComplete = completeTimes && taskRateType === TASK_RATE_TYPE.FOREVER
if (hasComplete) return resultsModel.error(CODE_TYPES.ERROR_TASK_LIMIT, `该任务已完成,去看看其它任务吧~`)
// 每日任务今天已经完成
const { todayCompleteTimes, todayTaskInfo } = getTodayCompleteTask(taskType, userInfo)
const hasCompleteToday = times && todayCompleteTimes === times && taskRateType === TASK_RATE_TYPE.EVERYDAY
if (hasCompleteToday) {
return resultsModel.error(CODE_TYPES.ERROR_TASK_LIMIT, `该任务今天已完成,明天再来吧~`)
}
// 今日任务该商品已经完成
const itemHasCompleteToday =
todayTaskInfo.find(v => v.itemId && v.itemId === itemId) && taskRateType === TASK_RATE_TYPE.EVERYDAY
if (itemHasCompleteToday) {
return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '今日该商品任务已完成')
}
}
/** @format */
// 遍历Controller中的方法, 暴露出来
export const exportHandlers = (controllers: any[]) => {
const handlersMapper = controllers
.map(controller => {
const controllerInstance = new controller()
const handlersKeys = Object.getOwnPropertyNames(Object.getPrototypeOf(controllerInstance)).filter(
v => v !== 'constructor'
)
return handlersKeys.reduce((prev, current) => {
return {
...prev,
[current]: controllerInstance[current]
}
}, {})
})
.reduce((prev, current) => {
return {
...current,
...prev
}
}, {})
return handlersMapper
}
/** @format */
import { assign, isEmpty, merge } from 'lodash'
/**
* updateUser projection 格式化
*
......@@ -6,7 +10,6 @@
* @return {*}
* @memberof UserService
*/
export function formatUpdateUserProjection(projection: IUpdateQuery): IUpdateQuery {
projection['$set'] = projection['$set'] || {}
projection['$set'].updateTime = Date.now()
......@@ -31,3 +34,25 @@ export function formatUserNick(name: string) {
}
return newStr
}
/**
* 不通过数据库select的情况下 获取更新后的数据
*
* @export
* @param {IUserInfo} userInfo
* @param {IDecoratorUpdateQuery} projection
*/
export function formatUpdatedUserInfo(userInfo: IUserInfo, projection: IDecoratorUpdateQuery) {
let updatedUserInfo = assign({}, userInfo)
if (!isEmpty(projection.$set)) {
updatedUserInfo = merge({}, userInfo, projection.$set)
}
if (!isEmpty(projection.$inc)) {
Object.keys(projection.$inc).forEach(key => {
// let splitKey
})
updatedUserInfo = merge({}, userInfo, projection.$set)
}
}
/** @format */
import { getToday } from './getToday'
import { TASK_STATUS, TASK_RATE_TYPE } from '../../constants'
/**
* 根据任务类型获取任务完成情况
......@@ -10,7 +11,7 @@ import { getToday } from './getToday'
* @returns {array}
* @memberof TaskService
*/
export function getCompleteTaskByUserTaskInfo(
export function getTotalCompleteTask(
taskType: string,
userInfo: IUserInfo
): {
......@@ -57,3 +58,42 @@ export function getTodayCompleteTask(
todayTaskInfo: userInfo?.taskInfo?.[today]?.[taskType] || []
}
}
/**
*
* 根据用户和任务完成情况,设置任务状态
*
* @param {IUserInfo} useInfo
* @param {string} taskType
* @param {number} taskRateType
* @param {number} [limitTimesEverday] 每天限制次数 任务频率为每天的时候必填
* @return {taskTatus} 1未完成 2 待领取 3 已完成
* @memberof TaskService
*/
export function setTaskStatus(
useInfo: IUserInfo,
taskType: string,
taskRateType: number,
limitTimesEveryday: number = 1
): number {
const waitReceive = useInfo?.remainTimes?.[taskType] || 0
if (waitReceive) return TASK_STATUS.WAIT_RECEIVE
// 当天的完成次数
const { todayCompleteTimes } = getTodayCompleteTask(taskType, useInfo)
// 总共的完成次数
const { completeTimes } = getTotalCompleteTask(taskType, useInfo)
switch (taskRateType) {
case TASK_RATE_TYPE.FOREVER:
return completeTimes > 0 ? TASK_STATUS.DONE : TASK_STATUS.WAIT_DO
break
case TASK_RATE_TYPE.EVERYDAY:
return todayCompleteTimes >= limitTimesEveryday ? TASK_STATUS.DONE : TASK_STATUS.WAIT_DO
break
case TASK_RATE_TYPE.NOLIMIT:
return TASK_STATUS.WAIT_DO
break
}
}
......@@ -3,35 +3,30 @@
import { resultsModel } from '../../../sdk'
import { CODE_TYPES } from '../../../errorCode'
import { dbCount } from '../../common/db'
import { STAT_DB_NAME } from '../../../db'
import { STAT_DB_NAME, USER_DB_NAME } from '../../../db'
import { getToday } from '../getToday'
import { isNewVip, setNewVipUserData } from '../userUpdate'
import { update } from '../../../decorator/common/update'
export function updateVip(context: IContext<IParams>, { vipInfo, userInfo, activityInfo }: IControllerInfos) {
export async function updateVip(
context: IContext<IParams>,
{ vipInfo, userInfo, activityInfo }: IControllerInfos
): Promise<IDecoratorUpdateQuery> {
let { member } = userInfo
const { newMember } = member
const today = getToday()
const newVip = isNewVip(userInfo, vipInfo)
const memberReWards = activityInfo?.tasks?.member?.value
let projection = {
$set: {},
$inc: {},
$push: {}
}
if (newVip && !newMember) {
member = setNewVipUserData(member)
// @ts-ignore
projection.$set.member = member
projection.$inc['remainTimes.member'] = +memberReWards
projection.$push[`taskInfo.${today}.member`] = {
creatTime: Date.now()
}
}
return projection
return isNewVip(userInfo, vipInfo)
? {
$set: {
member: setNewVipUserData(member)
},
$inc: {
'remainTimes.member': +memberReWards
},
$push: {
[`taskInfo.${getToday()}.member`]: { creatTime: Date.now() }
}
}
: {}
}
......@@ -18,7 +18,7 @@ export function isNewVip(userInfo: IUserInfo, vipInfo: IVipInfo): boolean {
const { isVip } = vipInfo
return !flag && isVip
return !flag && isVip && !userInfo.member.newMember
}
export function setNewVipUserData(member: IMemberInfo): IMemberInfo {
......
......@@ -20,8 +20,6 @@ export * from './common/getUserOrderlist'
export * from './common/vip'
export * from './common/exportHandlers'
export * from './common/helper'
export * from './common/userUpdate'
......
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