Commit 417aa155 authored by qinhaitao's avatar qinhaitao

opt

parent 5bc86ecb
...@@ -67,30 +67,35 @@ var Task = /** @class */ (function () { ...@@ -67,30 +67,35 @@ var Task = /** @class */ (function () {
var userInfo = _a.userInfo, vipInfo = _a.vipInfo, activityInfo = _a.activityInfo, session = _a.session; var userInfo = _a.userInfo, vipInfo = _a.vipInfo, activityInfo = _a.activityInfo, session = _a.session;
var taskService = _b[0]; var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var tasks, updatedUserInfo, _c, _d, _e, _f, vipTask, followTask, browseGoodsTask; var tasks, startTime, updatedUserInfo, _c, _d, _e, _f, vipTask, followTask;
return __generator(this, function (_g) { return __generator(this, function (_g) {
switch (_g.label) { switch (_g.label) {
case 0: case 0:
tasks = activityInfo.tasks; tasks = activityInfo.tasks, startTime = activityInfo.startTime;
_d = (_c = taskService).updateTasks; _d = (_c = taskService).updateTasks;
_e = [userInfo._id]; _e = [userInfo._id];
_f = [taskService.updateVipTaskStatus(userInfo, vipInfo, tasks)]; _f = [taskService.updateVipTaskStatus(userInfo, vipInfo, tasks)];
return [4 /*yield*/, taskService.updateOrderGoodsTask(userInfo, tasks, session)]; return [4 /*yield*/, taskService.updateOrderGoodsTask(userInfo, tasks, startTime, session)];
case 1: return [4 /*yield*/, _d.apply(_c, _e.concat([_f.concat([ case 1: return [4 /*yield*/, _d.apply(_c, _e.concat([_f.concat([
_g.sent() _g.sent()
])])) ]), userInfo]))];
// 会员任务
];
case 2: case 2:
updatedUserInfo = _g.sent(); updatedUserInfo = _g.sent();
if (!updatedUserInfo)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.SYSTEM_ERROR, '更新任务列表失败')
// 会员任务
];
vipTask = taskService.initVipTask(updatedUserInfo, vipInfo, tasks); vipTask = taskService.initVipTask(updatedUserInfo, vipInfo, tasks);
followTask = taskService.initFollowTask(updatedUserInfo, tasks); followTask = taskService.initFollowTask(updatedUserInfo, tasks);
browseGoodsTask = taskService.initBrowseGoodsTask(updatedUserInfo, tasks); // // 下单任务
// const orderGoodsTask = taskService.initOrderGoodsTask(updatedUserInfo, tasks)
// // 浏览商品任务
// const browseGoodsTask = taskService.initBrowseGoodsTask(updatedUserInfo, tasks)
// // 邀请任务 // // 邀请任务
// const invitesTask = taskService.initInvitesTask(updatedUserInfo, tasks) // const invitesTask = taskService.initInvitesTask(updatedUserInfo, tasks)
// 积分兑换 // 积分兑换
//const exchangeCreditsTask = taskService.initExchangeCreditsTask(updatedUserInfo, tasks) //const exchangeCreditsTask = taskService.initExchangeCreditsTask(updatedUserInfo, tasks)
return [2 /*return*/, sdk_1.resultsModel.success([vipTask, followTask, browseGoodsTask])]; return [2 /*return*/, sdk_1.resultsModel.success([vipTask, followTask])];
} }
}); });
}); });
...@@ -128,7 +133,7 @@ var Task = /** @class */ (function () { ...@@ -128,7 +133,7 @@ var Task = /** @class */ (function () {
var userInfo = _a.userInfo, activityInfo = _a.activityInfo, session = _a.session; var userInfo = _a.userInfo, activityInfo = _a.activityInfo, session = _a.session;
var userService = _b[0], taskService = _b[1]; var userService = _b[0], taskService = _b[1];
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var openId, credits, _id, _c, taskInfo, taskType, _d, value, times, taskRateType, today, todayTimes, myCredits, result; var openId, credits, _id, _c, taskInfo, taskType, _d, value, times, taskRateType, today, todayCompleteTimes, myCredits, result;
return __generator(this, function (_e) { return __generator(this, function (_e) {
switch (_e.label) { switch (_e.label) {
case 0: case 0:
...@@ -138,9 +143,9 @@ var Task = /** @class */ (function () { ...@@ -138,9 +143,9 @@ var Task = /** @class */ (function () {
taskType = "exchangeCredits"; taskType = "exchangeCredits";
_d = activityInfo.tasks.exchangeCredits, value = _d.value, times = _d.times, taskRateType = _d.taskRateType; _d = activityInfo.tasks.exchangeCredits, value = _d.value, times = _d.times, taskRateType = _d.taskRateType;
today = utils_1.getToday(); today = utils_1.getToday();
todayTimes = taskService.getTodayCompleteTask(taskType, userInfo).todayTimes; todayCompleteTimes = taskService.getTodayCompleteTask(taskType, userInfo).todayCompleteTimes;
// 如果每日限制次数并到达了限制次数 // 如果每日限制次数并到达了限制次数
if (times && times === todayTimes && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY) { 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)]; return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_LIMIT)];
} }
return [4 /*yield*/, sdk_1.TBAPIS.queryCredits(context, session)]; return [4 /*yield*/, sdk_1.TBAPIS.queryCredits(context, session)];
...@@ -181,7 +186,7 @@ var Task = /** @class */ (function () { ...@@ -181,7 +186,7 @@ var Task = /** @class */ (function () {
var userInfo = _a.userInfo, activityInfo = _a.activityInfo; var userInfo = _a.userInfo, activityInfo = _a.activityInfo;
var taskService = _b[0]; var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var taskType, itemId, _c, taskRateType, times, itemIds, value, itemIdArray, _d, todayTaskInfo, todayTimes, hasCompleteToday; var taskType, itemId, _c, taskRateType, times, itemIds, value, itemIdArray, _d, todayTaskInfo, todayCompleteTimes, hasCompleteToday;
return __generator(this, function (_e) { return __generator(this, function (_e) {
switch (_e.label) { switch (_e.label) {
case 0: case 0:
...@@ -192,7 +197,7 @@ var Task = /** @class */ (function () { ...@@ -192,7 +197,7 @@ var Task = /** @class */ (function () {
// B端配置商品ids不匹配正确 // B端配置商品ids不匹配正确
if (!itemIdArray.includes(+itemId)) if (!itemIdArray.includes(+itemId))
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '商品id不匹配')]; return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '商品id不匹配')];
_d = taskService.getTodayCompleteTask('browseGoods', userInfo), todayTaskInfo = _d.todayTaskInfo, todayTimes = _d.todayTimes; _d = taskService.getTodayCompleteTask('browseGoods', userInfo), todayTaskInfo = _d.todayTaskInfo, todayCompleteTimes = _d.todayCompleteTimes;
hasCompleteToday = todayTaskInfo.filter(function (v) { return v.itemId === itemId; }).length && hasCompleteToday = todayTaskInfo.filter(function (v) { return v.itemId === itemId; }).length &&
taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY; taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY;
// 今日任务已经完成 // 今日任务已经完成
...@@ -200,7 +205,7 @@ var Task = /** @class */ (function () { ...@@ -200,7 +205,7 @@ var Task = /** @class */ (function () {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '今日该商品任务已完成')]; return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '今日该商品任务已完成')];
} }
// 次数超限 // 次数超限
if (times && times === todayTimes && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY) { 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)]; return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_LIMIT)];
} }
// 更新user表 // 更新user表
......
{"version":3,"file":"task.controller.js","sourceRoot":"","sources":["../../src/controller/task.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2D;AAC3D,0CAA2F;AAE3F,8BAA6C;AAC7C,kCAAqD;AACrD,sCAAkE;AAElE,IAAI;AACJ,8BAA8B;AAC9B,cAAc;AACd,+CAA+C;AAC/C,MAAM;AACN,IAAI;AACJ;IAAA;IA+JA,CAAC;IA9JC;;OAEG;IAKG,0BAAW,GAAjB,UACE,O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AE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,6BAAiB;QACjB,oBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,CAAC,CAAC;;;;qDA6CpC;IASD;QAJC,uBAAW,CAAC,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACrC,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,6BAAiB;QACjB,oBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;iDA0CvB;IACH,WAAC;CAAA,AArKD,IAqKC;kBArKoB,IAAI"}
\ No newline at end of file \ No newline at end of file
...@@ -11,7 +11,8 @@ interface ITaskInfo { ...@@ -11,7 +11,8 @@ interface ITaskInfo {
done?: boolean; done?: boolean;
itemIds?: string; itemIds?: string;
todayCompleteTimes?: number; todayCompleteTimes?: number;
taskLimitTimes?: number; taskRateType: number;
times?: number;
waitReceive?: number; waitReceive?: number;
title: string; title: string;
} }
...@@ -21,25 +22,13 @@ export default class TaskService extends UserService { ...@@ -21,25 +22,13 @@ export default class TaskService extends UserService {
initOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo; initOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
initBrowseGoodsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo; initBrowseGoodsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
initInvitesTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo; initInvitesTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
initFollowTask(userInfo: IUserInfo, tasks: ITasks): { initFollowTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
taskType: string; initExchangeCreditsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
title: string;
rewards: number;
waitReceive: number;
done: boolean;
};
initExchangeCreditsTask(userInfo: IUserInfo, tasks: ITasks): {
taskType: string;
title: string;
rewards: number;
waitReceive: number;
done: boolean;
};
updateVipTaskStatus(userInfo: IUserInfo, vipInfo: IVipInfo, tasks: ITasks): { updateVipTaskStatus(userInfo: IUserInfo, vipInfo: IVipInfo, tasks: ITasks): {
member: IMemberInfo; member: IMemberInfo;
remainTimes: IRemainTimesInfo; remainTimes: IRemainTimesInfo;
}; };
updateOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks, session?: string): Promise<{ updateOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks, activityStartTime: number, session?: string): Promise<{
remainTimes?: undefined; remainTimes?: undefined;
taskInfo?: undefined; taskInfo?: undefined;
} | { } | {
...@@ -65,7 +54,7 @@ export default class TaskService extends UserService { ...@@ -65,7 +54,7 @@ export default class TaskService extends UserService {
* @memberof TaskService * @memberof TaskService
*/ */
getTodayCompleteTask(taskType: string, userInfo: IUserInfo): { getTodayCompleteTask(taskType: string, userInfo: IUserInfo): {
todayTimes: any; todayCompleteTimes: any;
todayTaskInfo: any; todayTaskInfo: any;
}; };
/** /**
...@@ -88,6 +77,16 @@ export default class TaskService extends UserService { ...@@ -88,6 +77,16 @@ export default class TaskService extends UserService {
* @memberof TaskService * @memberof TaskService
*/ */
updateUserTaskRecord(taskType: string, rewards: number, userInfo: IUserInfo, customRecord?: object): Promise<boolean>; updateUserTaskRecord(taskType: string, rewards: number, userInfo: IUserInfo, customRecord?: object): Promise<boolean>;
updateTasks(id: string, needUpdateKeysArray: object[]): Promise<any>; /**
*
* 更新user表中,任务相关字段
*
* @param {string} id
* @param {object[]} needUpdateKeysArray
* @param {IUserInfo} userInfo
* @returns {IUserInfo | boolean} userInfo
* @memberof TaskService
*/
updateTasks(id: string, needUpdateKeysArray: object[], userInfo: IUserInfo): Promise<false | IUserInfo>;
} }
export {}; export {};
...@@ -75,6 +75,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); ...@@ -75,6 +75,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var user_service_1 = require("./user.service"); var user_service_1 = require("./user.service");
var utils_1 = require("../utils"); var utils_1 = require("../utils");
var constants_1 = require("../constants"); var constants_1 = require("../constants");
var lodash_1 = require("lodash");
var TaskService = /** @class */ (function (_super) { var TaskService = /** @class */ (function (_super) {
__extends(TaskService, _super); __extends(TaskService, _super);
function TaskService(context) { function TaskService(context) {
...@@ -91,6 +92,7 @@ var TaskService = /** @class */ (function (_super) { ...@@ -91,6 +92,7 @@ var TaskService = /** @class */ (function (_super) {
title: "\u52A0\u5165\u4F1A\u5458", title: "\u52A0\u5165\u4F1A\u5458",
url: vipInfo.url, url: vipInfo.url,
rewards: value, rewards: value,
taskRateType: constants_1.TASK_RATE_TYPE.FOREVER,
waitReceive: remainTimes.member, waitReceive: remainTimes.member,
// 已经是会员, 说明完成任务 // 已经是会员, 说明完成任务
done: newMember || isVipBefore done: newMember || isVipBefore
...@@ -98,14 +100,19 @@ var TaskService = /** @class */ (function (_super) { ...@@ -98,14 +100,19 @@ var TaskService = /** @class */ (function (_super) {
}; };
// 初始化下单任务 // 初始化下单任务
TaskService.prototype.initOrderGoodsTask = function (userInfo, tasks) { TaskService.prototype.initOrderGoodsTask = function (userInfo, tasks) {
var _a; var _a, _b;
var _b = tasks.orderGoods, value = _b.value, itemIds = _b.itemIds, taskRateType = _b.taskRateType, times = _b.times; var _c = tasks.orderGoods, value = _c.value, itemIds = _c.itemIds, taskRateType = _c.taskRateType, times = _c.times;
var remainTimes = userInfo.remainTimes, _c = userInfo.taskInfo, taskInfo = _c === void 0 ? {} : _c; var remainTimes = userInfo.remainTimes, _d = userInfo.taskInfo, taskInfo = _d === void 0 ? {} : _d;
var today = utils_1.getToday();
var todayCompleteTimes = ((_b = (_a = taskInfo === null || taskInfo === void 0 ? void 0 : taskInfo[today]) === null || _a === void 0 ? void 0 : _a.orderGoods) === null || _b === void 0 ? void 0 : _b.length) || 0;
var orderTask = { var orderTask = {
taskType: "orderGoods", taskType: "orderGoods",
title: "\u4E0B\u5355\u5546\u54C1", title: "\u4E0B\u5355\u5546\u54C1",
itemIds: itemIds, itemIds: itemIds,
rewards: value, rewards: value,
taskRateType: taskRateType,
times: times,
todayCompleteTimes: todayCompleteTimes,
waitReceive: remainTimes.orderGoods, waitReceive: remainTimes.orderGoods,
done: false done: false
}; };
...@@ -115,8 +122,7 @@ var TaskService = /** @class */ (function (_super) { ...@@ -115,8 +122,7 @@ var TaskService = /** @class */ (function (_super) {
orderTask.done = true; orderTask.done = true;
} }
// 每日限制完成且完成次数达到限制 // 每日限制完成且完成次数达到限制
var today = utils_1.getToday(); if (taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY && todayCompleteTimes >= times) {
if (taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY && ((_a = taskInfo === null || taskInfo === void 0 ? void 0 : taskInfo[today]) === null || _a === void 0 ? void 0 : _a.orderGoods) >= times) {
orderTask.done = true; orderTask.done = true;
} }
return orderTask; return orderTask;
...@@ -127,13 +133,14 @@ var TaskService = /** @class */ (function (_super) { ...@@ -127,13 +133,14 @@ var TaskService = /** @class */ (function (_super) {
var _b = tasks.browseGoods, value = _b.value, itemIds = _b.itemIds, taskRateType = _b.taskRateType, times = _b.times; var _b = tasks.browseGoods, value = _b.value, itemIds = _b.itemIds, taskRateType = _b.taskRateType, times = _b.times;
var remainTimes = userInfo.remainTimes, _c = userInfo.taskInfo, taskInfo = _c === void 0 ? {} : _c; var remainTimes = userInfo.remainTimes, _c = userInfo.taskInfo, taskInfo = _c === void 0 ? {} : _c;
var today = utils_1.getToday(); var today = utils_1.getToday();
var todayCompleteTimes = (_a = taskInfo === null || taskInfo === void 0 ? void 0 : taskInfo[today]) === null || _a === void 0 ? void 0 : _a.browseGoods.length;
var orderTask = { var orderTask = {
taskType: "browseGoods", taskType: "browseGoods",
title: "\u6D4F\u89C8\u5546\u54C1", title: "\u6D4F\u89C8\u5546\u54C1",
itemIds: itemIds, itemIds: itemIds,
rewards: value, rewards: value,
waitReceive: remainTimes.browseGoods, waitReceive: remainTimes.browseGoods,
// todayCompeleTimes: taskInfo?.[today]?.browseGoods.length, todayCompleteTimes: todayCompleteTimes,
taskRateType: taskRateType, taskRateType: taskRateType,
done: false done: false
}; };
...@@ -143,20 +150,24 @@ var TaskService = /** @class */ (function (_super) { ...@@ -143,20 +150,24 @@ var TaskService = /** @class */ (function (_super) {
orderTask.done = true; orderTask.done = true;
} }
// 每日限制完成且完成次数达到限制 // 每日限制完成且完成次数达到限制
if (taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY && ((_a = taskInfo === null || taskInfo === void 0 ? void 0 : taskInfo[today]) === null || _a === void 0 ? void 0 : _a.browseGoods.length) >= times) { if (taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY && todayCompleteTimes >= times) {
orderTask.done = true; orderTask.done = true;
} }
return orderTask; return orderTask;
}; };
// 初始化邀请任务 // 初始化邀请任务
TaskService.prototype.initInvitesTask = function (userInfo, tasks) { TaskService.prototype.initInvitesTask = function (userInfo, tasks) {
var _a; var _a = tasks.inviteFriends, value = _a.value, taskRateType = _a.taskRateType, times = _a.times;
var _b = tasks.inviteFriends, value = _b.value, taskRateType = _b.taskRateType, times = _b.times;
var remainTimes = userInfo.remainTimes, taskInfo = userInfo.taskInfo; var remainTimes = userInfo.remainTimes, taskInfo = userInfo.taskInfo;
var today = utils_1.getToday();
var todayCompleteTimes = this.getTodayCompleteTask('invites', userInfo).todayCompleteTimes;
var orderTask = { var orderTask = {
taskType: "invites", taskType: "invites",
title: "\u9080\u8BF7", title: "\u9080\u8BF7",
rewards: value, rewards: value,
taskRateType: taskRateType,
times: times,
todayCompleteTimes: todayCompleteTimes,
waitReceive: remainTimes.invites, waitReceive: remainTimes.invites,
done: false done: false
}; };
...@@ -166,8 +177,7 @@ var TaskService = /** @class */ (function (_super) { ...@@ -166,8 +177,7 @@ var TaskService = /** @class */ (function (_super) {
orderTask.done = true; orderTask.done = true;
} }
// 每日限制完成且完成次数达到限制 // 每日限制完成且完成次数达到限制
var today = utils_1.getToday(); if (taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY && todayCompleteTimes >= times) {
if (taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY && ((_a = taskInfo === null || taskInfo === void 0 ? void 0 : taskInfo[today]) === null || _a === void 0 ? void 0 : _a.invites) >= times) {
orderTask.done = true; orderTask.done = true;
} }
return orderTask; return orderTask;
...@@ -181,23 +191,26 @@ var TaskService = /** @class */ (function (_super) { ...@@ -181,23 +191,26 @@ var TaskService = /** @class */ (function (_super) {
taskType: "follow", taskType: "follow",
title: "\u5173\u6CE8\u5E97\u94FA", title: "\u5173\u6CE8\u5E97\u94FA",
rewards: value, rewards: value,
taskRateType: constants_1.TASK_RATE_TYPE.FOREVER,
waitReceive: remainTimes.follow, waitReceive: remainTimes.follow,
done: !!orderGoodsCompleteList.length done: !!orderGoodsCompleteList.length
}; };
}; };
// 积分兑换 // 积分兑换
TaskService.prototype.initExchangeCreditsTask = function (userInfo, tasks) { TaskService.prototype.initExchangeCreditsTask = function (userInfo, tasks) {
var _a; var _a = tasks.exchangeCredits, value = _a.value, times = _a.times;
var _b = tasks.exchangeCredits, value = _b.value, times = _b.times;
var remainTimes = userInfo.remainTimes, taskInfo = userInfo.taskInfo; var remainTimes = userInfo.remainTimes, taskInfo = userInfo.taskInfo;
var today = utils_1.getToday(); var todayCompleteTimes = this.getTodayCompleteTask('exchangeCredits', userInfo).todayCompleteTimes;
return { return {
taskType: "exchangeCredits", taskType: "exchangeCredits",
title: "\u79EF\u5206\u5151\u6362", title: "\u79EF\u5206\u5151\u6362",
rewards: value, rewards: value,
times: times,
taskRateType: constants_1.TASK_RATE_TYPE.EVERYDAY,
todayCompleteTimes: todayCompleteTimes,
waitReceive: remainTimes.exchangeCredits, waitReceive: remainTimes.exchangeCredits,
// 积分兑换固定为每日限制 // 积分兑换固定为每日限制
done: !!(((_a = taskInfo === null || taskInfo === void 0 ? void 0 : taskInfo[today]) === null || _a === void 0 ? void 0 : _a.exchangeCredits) >= times) done: !!(todayCompleteTimes >= times)
}; };
}; };
// 根据会员状态更新 // 根据会员状态更新
...@@ -208,9 +221,7 @@ var TaskService = /** @class */ (function (_super) { ...@@ -208,9 +221,7 @@ var TaskService = /** @class */ (function (_super) {
var isNewVip = this.checkNewVipStatus(userInfo, vipInfo); var isNewVip = this.checkNewVipStatus(userInfo, vipInfo);
var value = tasks.beMembership.value; var value = tasks.beMembership.value;
if (isNewVip && !newMember) { if (isNewVip && !newMember) {
member.newMember = true; member = this.setNewVipUserData(member);
member.bememberTime = Date.now();
member.bememberDay = today;
remainTimes.member = (remainTimes.member || 0) + value; remainTimes.member = (remainTimes.member || 0) + value;
} }
return { return {
...@@ -218,38 +229,40 @@ var TaskService = /** @class */ (function (_super) { ...@@ -218,38 +229,40 @@ var TaskService = /** @class */ (function (_super) {
remainTimes: remainTimes remainTimes: remainTimes
}; };
}; };
TaskService.prototype.updateOrderGoodsTask = function (userInfo, tasks, session) { TaskService.prototype.updateOrderGoodsTask = function (userInfo, tasks, activityStartTime, session) {
var _a;
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var taskInfo, remainTimes, _b, value, itemIds, taskRateType, times, orderGoodsCompleteList, today, lastOrderInfo, orderResult, itemIdsArr; var taskInfo, remainTimes, _a, value, itemIds, taskRateType, times, orderGoodsCompleteList, todayCompleteTimes, today, orderResult, itemIdsArr;
return __generator(this, function (_c) { return __generator(this, function (_b) {
switch (_c.label) { switch (_b.label) {
case 0: case 0:
taskInfo = userInfo.taskInfo, remainTimes = userInfo.remainTimes; taskInfo = userInfo.taskInfo, remainTimes = userInfo.remainTimes;
_b = tasks.orderGoods, value = _b.value, itemIds = _b.itemIds, taskRateType = _b.taskRateType, times = _b.times; _a = tasks.orderGoods, value = _a.value, itemIds = _a.itemIds, taskRateType = _a.taskRateType, times = _a.times;
orderGoodsCompleteList = this.getCompleteTaskByUserTaskInfo('orderGoods', userInfo); orderGoodsCompleteList = this.getCompleteTaskByUserTaskInfo('orderGoods', userInfo);
todayCompleteTimes = this.getTodayCompleteTask('orderGoods', userInfo).todayCompleteTimes;
// 永久任务且已完成 // 永久任务且已完成
if (taskRateType === constants_1.TASK_RATE_TYPE.FOREVER && orderGoodsCompleteList) { if (taskRateType === constants_1.TASK_RATE_TYPE.FOREVER && orderGoodsCompleteList) {
return [2 /*return*/, {}]; return [2 /*return*/, {}];
} }
today = utils_1.getToday(); today = utils_1.getToday();
if (taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY && ((_a = taskInfo === null || taskInfo === void 0 ? void 0 : taskInfo[today]) === null || _a === void 0 ? void 0 : _a.orderGoods) >= times) { if (taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY && todayCompleteTimes >= times) {
return [2 /*return*/, {}]; return [2 /*return*/, {}];
} }
lastOrderInfo = (orderGoodsCompleteList === null || orderGoodsCompleteList === void 0 ? void 0 : orderGoodsCompleteList[orderGoodsCompleteList.length - 1]) || {};
return [4 /*yield*/, utils_1.getUserOrderlist(this.context, return [4 /*yield*/, utils_1.getUserOrderlist(this.context,
//@ts-ignore //@ts-ignore
lastOrderInfo.createTime || Date.now(), Date.now(), session)]; activityStartTime || Date.now(), Date.now(), session)];
case 1: case 1:
orderResult = _c.sent(); orderResult = _b.sent();
itemIdsArr = itemIds.split(',').map(function (v) { return +v; }); itemIdsArr = itemIds.split(',').map(function (v) { return +v; });
orderResult.forEach(function (v) { orderResult.forEach(function (v) {
if (itemIdsArr.includes(v.itemId)) { // @ts-ignore
// 商品订单包含目标商品 且orderId为新订单
if (itemIdsArr.includes(v.itemId) && !orderGoodsCompleteList.some(function (order) { return order.orderId === v.orderId; })) {
remainTimes.orderGoods += +value; remainTimes.orderGoods += +value;
taskInfo[today] = (taskInfo === null || taskInfo === void 0 ? void 0 : taskInfo[today]) || {}; taskInfo[today] = (taskInfo === null || taskInfo === void 0 ? void 0 : taskInfo[today]) || {};
taskInfo[today].orderGoods = taskInfo[today].orderGoods || []; taskInfo[today].orderGoods = taskInfo[today].orderGoods || [];
taskInfo[today].orderGoods.push({ taskInfo[today].orderGoods.push({
itemId: v.itemId, itemId: v.itemId,
orderId: v.orderId,
createTime: Date.now() createTime: Date.now()
}); });
} }
...@@ -272,28 +285,30 @@ var TaskService = /** @class */ (function (_super) { ...@@ -272,28 +285,30 @@ var TaskService = /** @class */ (function (_super) {
*/ */
TaskService.prototype.updateFollowTask = function (userInfo, activityInfo) { TaskService.prototype.updateFollowTask = function (userInfo, activityInfo) {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var today, remainTimes, _id, _a, taskInfo, follow, tasks, value, followInfo; var today, _id, _a, taskInfo, follow, tasks, value, followInfo;
return __generator(this, function (_b) { return __generator(this, function (_b) {
switch (_b.label) { switch (_b.label) {
case 0: case 0:
today = utils_1.getToday(); today = utils_1.getToday();
remainTimes = userInfo.remainTimes, _id = userInfo._id, _a = userInfo.taskInfo, taskInfo = _a === void 0 ? {} : _a, follow = userInfo.follow; _id = userInfo._id, _a = userInfo.taskInfo, taskInfo = _a === void 0 ? {} : _a, follow = userInfo.follow;
tasks = activityInfo.tasks; tasks = activityInfo.tasks;
value = (tasks || {}).attentionStore.value; value = (tasks || {}).attentionStore.value;
followInfo = __assign(__assign({}, follow), { newFollow: true, followTime: Date.now(), followDay: today }); followInfo = this.setNewFollowUserData(follow);
// 记录数据 // 记录数据
taskInfo[today] = taskInfo[today] || {}; taskInfo[today] = taskInfo[today] || {};
taskInfo[today].follow = 1; taskInfo[today].follow = 1;
// 增加待领取次数
remainTimes.follow += value;
return [4 /*yield*/, this.updateUser(_id, { return [4 /*yield*/, this.updateUser(_id, {
$set: { $set: {
remainTimes: remainTimes,
follow: followInfo, follow: followInfo,
taskInfo: taskInfo taskInfo: taskInfo
},
$inc: {
'remainTimes.follow': 1
} }
})]; })];
case 1: return [2 /*return*/, _b.sent()]; case 1:
// 增加待领取次数
return [2 /*return*/, _b.sent()];
} }
}); });
}); });
...@@ -311,7 +326,7 @@ var TaskService = /** @class */ (function (_super) { ...@@ -311,7 +326,7 @@ var TaskService = /** @class */ (function (_super) {
var _a, _b, _c, _d, _e; var _a, _b, _c, _d, _e;
var today = utils_1.getToday(); var today = utils_1.getToday();
return { return {
todayTimes: ((_c = (_b = (_a = userInfo === null || userInfo === void 0 ? void 0 : userInfo.taskInfo) === null || _a === void 0 ? void 0 : _a[today]) === null || _b === void 0 ? void 0 : _b[taskType]) === null || _c === void 0 ? void 0 : _c.length) || 0, todayCompleteTimes: ((_c = (_b = (_a = userInfo === null || userInfo === void 0 ? void 0 : userInfo.taskInfo) === null || _a === void 0 ? void 0 : _a[today]) === null || _b === void 0 ? void 0 : _b[taskType]) === null || _c === void 0 ? void 0 : _c.length) || 0,
todayTaskInfo: (_e = (_d = userInfo === null || userInfo === void 0 ? void 0 : userInfo.taskInfo) === null || _d === void 0 ? void 0 : _d[today]) === null || _e === void 0 ? void 0 : _e[taskType] todayTaskInfo: (_e = (_d = userInfo === null || userInfo === void 0 ? void 0 : userInfo.taskInfo) === null || _d === void 0 ? void 0 : _d[today]) === null || _e === void 0 ? void 0 : _e[taskType]
}; };
}; };
...@@ -371,20 +386,30 @@ var TaskService = /** @class */ (function (_super) { ...@@ -371,20 +386,30 @@ var TaskService = /** @class */ (function (_super) {
}); });
}); });
}; };
TaskService.prototype.updateTasks = function (id, needUpdateKeysArray) { /**
*
* 更新user表中,任务相关字段
*
* @param {string} id
* @param {object[]} needUpdateKeysArray
* @param {IUserInfo} userInfo
* @returns {IUserInfo | boolean} userInfo
* @memberof TaskService
*/
TaskService.prototype.updateTasks = function (id, needUpdateKeysArray, userInfo) {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var updateKeys; var updateKeys, result;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
updateKeys = Object.assign.apply(Object, __spreadArrays([{}], needUpdateKeysArray)); updateKeys = lodash_1.extend.apply(void 0, __spreadArrays([{}], needUpdateKeysArray));
return [4 /*yield*/, this.updateUser(id, { return [4 /*yield*/, this.updateUser(id, {
$set: updateKeys $set: updateKeys
})]; })];
case 1: case 1:
_a.sent(); result = _a.sent();
return [4 /*yield*/, this.getUserInfo()]; return [2 /*return*/, result === 1
case 2: return [2 /*return*/, _a.sent()]; ? __assign(__assign({}, userInfo), updateKeys) : false];
} }
}); });
}); });
......
{"version":3,"file":"task.service.js","sourceRoot":"","sources":["../../src/service/task.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,+CAAwC;AAExC,kCAAqD;AACrD,0CAA6C;AAa7C;IAAyC,+BAAW;IAClD,qBAAY,OAAgB;eAC1B,kBAAM,OAAO,CAAC;IAChB,CAAC;IAED,iCAAW,GAAX,UAAY,QAAmB,EAAE,OAAiB,EAAE,KAAa;QAE7D,IAAA,KAEE,QAAQ,OAFiB,EAAjB,IAAI,UAAA,EAAE,SAAS,eAAA,EACzB,WAAW,GACT,QAAQ,YADC,CACD;QAEZ,SAAS;QAES,IAAA,KAAK,GACnB,KAAK,mBADc,CACd;QAET,OAAO;QAEP,IAAM,WAAW,GAAG,IAAI,CAAA;QAExB,OAAO;YACL,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,0BAAM;YACb,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,WAAW,CAAC,MAAM;YAC/B,gBAAgB;YAChB,IAAI,EAAE,SAAS,IAAI,WAAW;SAC/B,CAAA;IACH,CAAC;IAED,UAAU;IACV,wCAAkB,GAAlB,UAAmB,QAAmB,EAAE,KAAa;;QAEjD,IAAA,KACE,KAAK,WAD4C,EAArC,KAAK,WAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA,EAAE,KAAK,WAAE,CAC5C;QAED,IAAA,WAAW,GAAoB,QAAQ,YAA5B,EAAE,KAAkB,QAAQ,SAAb,EAAb,QAAQ,mBAAG,EAAE,KAAA,CAAa;QAE/C,IAAI,SAAS,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,QAAU,IAAG,OAAO;uCACrC;gCACD,KAAK;oCACH,GAAC,cAAY,KAAK,SAAI,QAAU,eAAK,MAAM,QAAA,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,IAAK,YAAY,CAAE;uCACvF;6BACF,CAAC,EAAA;;wBAPI,MAAM,GAAG,SAOb;wBACF,sBAAO,MAAM,KAAK,CAAC,EAAA;;;;KACpB;IAED;;;;;;;;;OASG;IACG,iCAAW,GAAjB,UAAkB,EAAU,EAAE,mBAA6B,EAAE,QAAmB;;;;;;wBACxE,UAAU,GAAW,eAAM,+BAAC,EAAE,GAAK,mBAAmB,EAAC,CAAA;wBAC9C,qBAAM,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE;gCACvC,IAAI,EAAE,UAAU;6BACjB,CAAC,EAAA;;wBAFI,MAAM,GAAG,SAEb;wBACF,sBAAO,MAAM,KAAK,CAAC;gCACjB,CAAC,uBACM,QAAQ,GACR,UAAU,EAEjB,CAAC,CAAC,KAAK,EAAA;;;;KACV;IACH,kBAAC;AAAD,CAAC,AA3XD,CAAyC,sBAAW,GA2XnD"}
\ No newline at end of file \ No newline at end of file
...@@ -57,5 +57,7 @@ declare class UserService extends BaseService { ...@@ -57,5 +57,7 @@ declare class UserService extends BaseService {
* @memberof UserService * @memberof UserService
*/ */
checkNewVipStatus(userInfo: IUserInfo, vipInfo: IVipInfo): boolean; checkNewVipStatus(userInfo: IUserInfo, vipInfo: IVipInfo): boolean;
setNewVipUserData(member: IMemberInfo): IMemberInfo;
setNewFollowUserData(follow: IFollowInfo): IFollowInfo;
} }
export default UserService; export default UserService;
...@@ -17,6 +17,17 @@ var __extends = (this && this.__extends) || (function () { ...@@ -17,6 +17,17 @@ var __extends = (this && this.__extends) || (function () {
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}; };
})(); })();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
...@@ -220,34 +231,33 @@ var UserService = /** @class */ (function (_super) { ...@@ -220,34 +231,33 @@ var UserService = /** @class */ (function (_super) {
UserService.prototype.updateUserData = function (vipInfo, userInfo) { UserService.prototype.updateUserData = function (vipInfo, userInfo) {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var data, isFollow, followBefore, followNow, today, isNewVip; var data, isFollow, followBefore, followNow, today, isNewVip;
return __generator(this, function (_a) { var _a;
switch (_a.label) { return __generator(this, function (_b) {
switch (_b.label) {
case 0: case 0:
data = this.context.data; data = this.context.data;
isFollow = data.isFollow; isFollow = data.isFollow;
followBefore = userInfo.follow.flag; followBefore = userInfo.follow.flag;
followNow = isFollow; followNow = isFollow;
if (!followBefore && followNow && !userInfo.follow.newFollow) { if (!followBefore && followNow && !userInfo.follow.newFollow) {
userInfo.follow.newFollow = true; userInfo.follow = this.setNewFollowUserData(userInfo.follow);
userInfo.follow.followTime = userInfo.follow.followTime || Date.now();
} }
today = utils_1.getToday(); today = utils_1.getToday();
isNewVip = this.checkNewVipStatus(userInfo, vipInfo); isNewVip = this.checkNewVipStatus(userInfo, vipInfo);
if (isNewVip && !userInfo.member.newMember) { if (isNewVip && !userInfo.member.newMember) {
userInfo.member.newMember = true; userInfo.member = this.setNewVipUserData(userInfo.member);
userInfo.member.bememberTime = userInfo.member.bememberTime || Date.now();
} }
// 添加登录次数
userInfo['login'][today] = userInfo['login'][today] ? userInfo['login'][today] + 1 : 1;
return [4 /*yield*/, this.updateUser(userInfo._id, { return [4 /*yield*/, this.updateUser(userInfo._id, {
$set: { $set: {
follow: userInfo.follow, follow: userInfo.follow,
login: userInfo['login'],
member: userInfo.member member: userInfo.member
} },
$inc: (_a = {},
_a["login." + today] = 1,
_a)
})]; })];
case 1: case 1:
_a.sent(); _b.sent();
return [2 /*return*/]; return [2 /*return*/];
} }
}); });
...@@ -302,6 +312,14 @@ var UserService = /** @class */ (function (_super) { ...@@ -302,6 +312,14 @@ var UserService = /** @class */ (function (_super) {
var isVip = vipInfo.isVip; var isVip = vipInfo.isVip;
return !flag && isVip; return !flag && isVip;
}; };
UserService.prototype.setNewVipUserData = function (member) {
var today = utils_1.getToday();
return __assign(__assign({}, member), { newMember: true, bememberTime: Date.now(), bememberDay: today });
};
UserService.prototype.setNewFollowUserData = function (follow) {
var today = utils_1.getToday();
return __assign(__assign({}, follow), { newFollow: true, followTime: Date.now(), followDay: today });
};
return UserService; return UserService;
}(base_service_1.default)); }(base_service_1.default));
exports.default = UserService; exports.default = UserService;
......
{"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../src/service/user.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAAwC;AACxC,+CAAwC;AACxC,4BAAoC;AACpC,kCAAiD;AACjD,sCAAqC;AAErC;IAA0B,+BAAW;IAEnC,qBAAY,OAAgB;QAA5B,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,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+7,9 @@
"license": "ISC", "license": "ISC",
"sdkVersion": "*", "sdkVersion": "*",
"dependencies": { "dependencies": {
"@types/lodash": "^4.14.160",
"dayjs": "^1.8.28", "dayjs": "^1.8.28",
"lodash": "^4.17.20",
"node-xlsx": "^0.15.0", "node-xlsx": "^0.15.0",
"source-map-support": "^0.5.19", "source-map-support": "^0.5.19",
"taobao-mini-sdk": "0.1.6" "taobao-mini-sdk": "0.1.6"
......
...@@ -26,13 +26,19 @@ export default class Task { ...@@ -26,13 +26,19 @@ export default class Task {
{ userInfo, vipInfo, activityInfo, session }: IControllerInfos, { userInfo, vipInfo, activityInfo, session }: IControllerInfos,
[taskService]: [TaskService] [taskService]: [TaskService]
): Promise<Result> { ): Promise<Result> {
const { tasks } = activityInfo const { tasks, startTime } = activityInfo
// 更新user状态 // 更新user状态
let updatedUserInfo = await taskService.updateTasks(userInfo._id, [ let updatedUserInfo = await taskService.updateTasks(
userInfo._id,
[
taskService.updateVipTaskStatus(userInfo, vipInfo, tasks), taskService.updateVipTaskStatus(userInfo, vipInfo, tasks),
await taskService.updateOrderGoodsTask(userInfo, tasks, session) await taskService.updateOrderGoodsTask(userInfo, tasks, startTime, session)
]) ],
userInfo
)
if (!updatedUserInfo) return resultsModel.error(CODE_TYPES.SYSTEM_ERROR, '更新任务列表失败')
// 会员任务 // 会员任务
const vipTask = taskService.initVipTask(updatedUserInfo, vipInfo, tasks) const vipTask = taskService.initVipTask(updatedUserInfo, vipInfo, tasks)
...@@ -41,13 +47,13 @@ export default class Task { ...@@ -41,13 +47,13 @@ export default class Task {
// // 下单任务 // // 下单任务
// const orderGoodsTask = taskService.initOrderGoodsTask(updatedUserInfo, tasks) // const orderGoodsTask = taskService.initOrderGoodsTask(updatedUserInfo, tasks)
// // 浏览商品任务 // // 浏览商品任务
const browseGoodsTask = taskService.initBrowseGoodsTask(updatedUserInfo, tasks) // const browseGoodsTask = taskService.initBrowseGoodsTask(updatedUserInfo, tasks)
// // 邀请任务 // // 邀请任务
// const invitesTask = taskService.initInvitesTask(updatedUserInfo, tasks) // const invitesTask = taskService.initInvitesTask(updatedUserInfo, tasks)
// 积分兑换 // 积分兑换
//const exchangeCreditsTask = taskService.initExchangeCreditsTask(updatedUserInfo, tasks) //const exchangeCreditsTask = taskService.initExchangeCreditsTask(updatedUserInfo, tasks)
return resultsModel.success([vipTask, followTask, browseGoodsTask]) return resultsModel.success([vipTask, followTask])
} }
/** /**
...@@ -93,10 +99,10 @@ export default class Task { ...@@ -93,10 +99,10 @@ export default class Task {
} = activityInfo } = activityInfo
const today = getToday() const today = getToday()
const { todayTimes } = taskService.getTodayCompleteTask(taskType, userInfo) const { todayCompleteTimes } = taskService.getTodayCompleteTask(taskType, userInfo)
// 如果每日限制次数并到达了限制次数 // 如果每日限制次数并到达了限制次数
if (times && times === todayTimes && taskRateType === TASK_RATE_TYPE.EVERYDAY) { if (times && times === todayCompleteTimes && taskRateType === TASK_RATE_TYPE.EVERYDAY) {
return resultsModel.error(CODE_TYPES.ERROR_TASK_LIMIT) return resultsModel.error(CODE_TYPES.ERROR_TASK_LIMIT)
} }
...@@ -150,7 +156,7 @@ export default class Task { ...@@ -150,7 +156,7 @@ export default class Task {
// B端配置商品ids不匹配正确 // B端配置商品ids不匹配正确
if (!itemIdArray.includes(+itemId)) return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '商品id不匹配') if (!itemIdArray.includes(+itemId)) return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '商品id不匹配')
const { todayTaskInfo, todayTimes } = taskService.getTodayCompleteTask('browseGoods', userInfo) const { todayTaskInfo, todayCompleteTimes } = taskService.getTodayCompleteTask('browseGoods', userInfo)
const hasCompleteToday = const hasCompleteToday =
todayTaskInfo.filter((v: { itemId: string }) => v.itemId === itemId).length && todayTaskInfo.filter((v: { itemId: string }) => v.itemId === itemId).length &&
...@@ -161,7 +167,7 @@ export default class Task { ...@@ -161,7 +167,7 @@ export default class Task {
return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '今日该商品任务已完成') return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '今日该商品任务已完成')
} }
// 次数超限 // 次数超限
if (times && times === todayTimes && taskRateType === TASK_RATE_TYPE.EVERYDAY) { if (times && times === todayCompleteTimes && taskRateType === TASK_RATE_TYPE.EVERYDAY) {
return resultsModel.error(CODE_TYPES.ERROR_TASK_LIMIT) return resultsModel.error(CODE_TYPES.ERROR_TASK_LIMIT)
} }
......
...@@ -9,6 +9,7 @@ import UserService from './user.service' ...@@ -9,6 +9,7 @@ import UserService from './user.service'
import { USER_DB_NAME } from '../db' import { USER_DB_NAME } from '../db'
import { getToday, getUserOrderlist } from '../utils' import { getToday, getUserOrderlist } from '../utils'
import { TASK_RATE_TYPE } from '../constants' import { TASK_RATE_TYPE } from '../constants'
import { extend } from 'lodash'
interface ITaskInfo { interface ITaskInfo {
taskType?: string taskType?: string
...@@ -17,7 +18,8 @@ interface ITaskInfo { ...@@ -17,7 +18,8 @@ interface ITaskInfo {
done?: boolean done?: boolean
itemIds?: string itemIds?: string
todayCompleteTimes?: number todayCompleteTimes?: number
taskLimitTimes?: number // 任务每日限制次数 taskRateType: number
times?: number // 任务每日限制次数
waitReceive?: number waitReceive?: number
title: string title: string
} }
...@@ -46,6 +48,7 @@ export default class TaskService extends UserService { ...@@ -46,6 +48,7 @@ export default class TaskService extends UserService {
title: `加入会员`, title: `加入会员`,
url: vipInfo.url, url: vipInfo.url,
rewards: value, rewards: value,
taskRateType: TASK_RATE_TYPE.FOREVER,
waitReceive: remainTimes.member, waitReceive: remainTimes.member,
// 已经是会员, 说明完成任务 // 已经是会员, 说明完成任务
done: newMember || isVipBefore done: newMember || isVipBefore
...@@ -59,12 +62,16 @@ export default class TaskService extends UserService { ...@@ -59,12 +62,16 @@ export default class TaskService extends UserService {
} = tasks } = tasks
const { remainTimes, taskInfo = {} } = userInfo const { remainTimes, taskInfo = {} } = userInfo
const today = getToday()
const todayCompleteTimes = taskInfo?.[today]?.orderGoods?.length || 0
let orderTask: ITaskInfo = { let orderTask: ITaskInfo = {
taskType: `orderGoods`, taskType: `orderGoods`,
title: `下单商品`, title: `下单商品`,
itemIds, itemIds,
rewards: value, rewards: value,
taskRateType,
times,
todayCompleteTimes,
waitReceive: remainTimes.orderGoods, waitReceive: remainTimes.orderGoods,
done: false done: false
} }
...@@ -77,8 +84,7 @@ export default class TaskService extends UserService { ...@@ -77,8 +84,7 @@ export default class TaskService extends UserService {
} }
// 每日限制完成且完成次数达到限制 // 每日限制完成且完成次数达到限制
const today = getToday() if (taskRateType === TASK_RATE_TYPE.EVERYDAY && todayCompleteTimes >= times) {
if (taskRateType === TASK_RATE_TYPE.EVERYDAY && taskInfo?.[today]?.orderGoods >= times) {
orderTask.done = true orderTask.done = true
} }
...@@ -93,6 +99,7 @@ export default class TaskService extends UserService { ...@@ -93,6 +99,7 @@ export default class TaskService extends UserService {
const { remainTimes, taskInfo = {} } = userInfo const { remainTimes, taskInfo = {} } = userInfo
const today = getToday() const today = getToday()
const todayCompleteTimes = taskInfo?.[today]?.browseGoods.length
let orderTask: ITaskInfo = { let orderTask: ITaskInfo = {
taskType: `browseGoods`, taskType: `browseGoods`,
...@@ -100,8 +107,8 @@ export default class TaskService extends UserService { ...@@ -100,8 +107,8 @@ export default class TaskService extends UserService {
itemIds, itemIds,
rewards: value, rewards: value,
waitReceive: remainTimes.browseGoods, waitReceive: remainTimes.browseGoods,
// todayCompeleTimes: taskInfo?.[today]?.browseGoods.length, todayCompleteTimes,
taskRateType: taskRateType, taskRateType,
done: false done: false
} }
...@@ -113,11 +120,9 @@ export default class TaskService extends UserService { ...@@ -113,11 +120,9 @@ export default class TaskService extends UserService {
} }
// 每日限制完成且完成次数达到限制 // 每日限制完成且完成次数达到限制
if (taskRateType === TASK_RATE_TYPE.EVERYDAY && todayCompleteTimes >= times) {
if (taskRateType === TASK_RATE_TYPE.EVERYDAY && taskInfo?.[today]?.browseGoods.length >= times) {
orderTask.done = true orderTask.done = true
} }
return orderTask return orderTask
} }
...@@ -129,10 +134,15 @@ export default class TaskService extends UserService { ...@@ -129,10 +134,15 @@ export default class TaskService extends UserService {
const { remainTimes, taskInfo } = userInfo const { remainTimes, taskInfo } = userInfo
const today = getToday()
const { todayCompleteTimes } = this.getTodayCompleteTask('invites', userInfo)
let orderTask: ITaskInfo = { let orderTask: ITaskInfo = {
taskType: `invites`, taskType: `invites`,
title: `邀请`, title: `邀请`,
rewards: value, rewards: value,
taskRateType,
times,
todayCompleteTimes,
waitReceive: remainTimes.invites, waitReceive: remainTimes.invites,
done: false done: false
} }
...@@ -145,8 +155,7 @@ export default class TaskService extends UserService { ...@@ -145,8 +155,7 @@ export default class TaskService extends UserService {
} }
// 每日限制完成且完成次数达到限制 // 每日限制完成且完成次数达到限制
const today = getToday() if (taskRateType === TASK_RATE_TYPE.EVERYDAY && todayCompleteTimes >= times) {
if (taskRateType === TASK_RATE_TYPE.EVERYDAY && taskInfo?.[today]?.invites >= times) {
orderTask.done = true orderTask.done = true
} }
...@@ -154,7 +163,7 @@ export default class TaskService extends UserService { ...@@ -154,7 +163,7 @@ export default class TaskService extends UserService {
} }
// 关注店铺 // 关注店铺
initFollowTask(userInfo: IUserInfo, tasks: ITasks) { initFollowTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo {
const { const {
attentionStore: { value } attentionStore: { value }
} = tasks } = tasks
...@@ -166,27 +175,30 @@ export default class TaskService extends UserService { ...@@ -166,27 +175,30 @@ export default class TaskService extends UserService {
taskType: `follow`, taskType: `follow`,
title: `关注店铺`, title: `关注店铺`,
rewards: value, rewards: value,
taskRateType: TASK_RATE_TYPE.FOREVER,
waitReceive: remainTimes.follow, waitReceive: remainTimes.follow,
done: !!orderGoodsCompleteList.length done: !!orderGoodsCompleteList.length
} }
} }
// 积分兑换 // 积分兑换
initExchangeCreditsTask(userInfo: IUserInfo, tasks: ITasks) { initExchangeCreditsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo {
const { const {
exchangeCredits: { value, times } exchangeCredits: { value, times }
} = tasks } = tasks
const { remainTimes, taskInfo } = userInfo const { remainTimes, taskInfo } = userInfo
const today = getToday() const { todayCompleteTimes } = this.getTodayCompleteTask('exchangeCredits', userInfo)
return { return {
taskType: `exchangeCredits`, taskType: `exchangeCredits`,
title: `积分兑换`, title: `积分兑换`,
rewards: value, rewards: value,
times,
taskRateType: TASK_RATE_TYPE.EVERYDAY,
todayCompleteTimes,
waitReceive: remainTimes.exchangeCredits, waitReceive: remainTimes.exchangeCredits,
// 积分兑换固定为每日限制 // 积分兑换固定为每日限制
done: !!(taskInfo?.[today]?.exchangeCredits >= times) done: !!(todayCompleteTimes >= times)
} }
} }
...@@ -204,9 +216,7 @@ export default class TaskService extends UserService { ...@@ -204,9 +216,7 @@ export default class TaskService extends UserService {
} = tasks } = tasks
if (isNewVip && !newMember) { if (isNewVip && !newMember) {
member.newMember = true member = this.setNewVipUserData(member)
member.bememberTime = Date.now()
member.bememberDay = today
remainTimes.member = (remainTimes.member || 0) + value remainTimes.member = (remainTimes.member || 0) + value
} }
return { return {
...@@ -215,13 +225,13 @@ export default class TaskService extends UserService { ...@@ -215,13 +225,13 @@ export default class TaskService extends UserService {
} }
} }
async updateOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks, session?: string) { async updateOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks, activityStartTime: number, session?: string) {
let { taskInfo, remainTimes } = userInfo let { taskInfo, remainTimes } = userInfo
const { const {
orderGoods: { value, itemIds, taskRateType, times } orderGoods: { value, itemIds, taskRateType, times }
} = tasks } = tasks
const orderGoodsCompleteList: object[] = this.getCompleteTaskByUserTaskInfo('orderGoods', userInfo) const orderGoodsCompleteList: object[] = this.getCompleteTaskByUserTaskInfo('orderGoods', userInfo)
const { todayCompleteTimes } = this.getTodayCompleteTask('orderGoods', userInfo)
// 永久任务且已完成 // 永久任务且已完成
if (taskRateType === TASK_RATE_TYPE.FOREVER && orderGoodsCompleteList) { if (taskRateType === TASK_RATE_TYPE.FOREVER && orderGoodsCompleteList) {
return {} return {}
...@@ -229,16 +239,14 @@ export default class TaskService extends UserService { ...@@ -229,16 +239,14 @@ export default class TaskService extends UserService {
// 每日限制完成且完成次数达到限制 // 每日限制完成且完成次数达到限制
const today = getToday() const today = getToday()
if (taskRateType === TASK_RATE_TYPE.EVERYDAY && taskInfo?.[today]?.orderGoods >= times) { if (taskRateType === TASK_RATE_TYPE.EVERYDAY && todayCompleteTimes >= times) {
return {} return {}
} }
const lastOrderInfo = orderGoodsCompleteList?.[orderGoodsCompleteList.length - 1] || {}
const orderResult = await getUserOrderlist( const orderResult = await getUserOrderlist(
this.context, this.context,
//@ts-ignore //@ts-ignore
lastOrderInfo.createTime || Date.now(), activityStartTime || Date.now(),
Date.now(), Date.now(),
session session
) )
...@@ -246,12 +254,15 @@ export default class TaskService extends UserService { ...@@ -246,12 +254,15 @@ export default class TaskService extends UserService {
const itemIdsArr = itemIds.split(',').map(v => +v) const itemIdsArr = itemIds.split(',').map(v => +v)
orderResult.forEach(v => { orderResult.forEach(v => {
if (itemIdsArr.includes(v.itemId)) { // @ts-ignore
// 商品订单包含目标商品 且orderId为新订单
if (itemIdsArr.includes(v.itemId) && !orderGoodsCompleteList.some(order => order.orderId === v.orderId)) {
remainTimes.orderGoods += +value remainTimes.orderGoods += +value
taskInfo[today] = taskInfo?.[today] || {} taskInfo[today] = taskInfo?.[today] || {}
taskInfo[today].orderGoods = taskInfo[today].orderGoods || [] taskInfo[today].orderGoods = taskInfo[today].orderGoods || []
taskInfo[today].orderGoods.push({ taskInfo[today].orderGoods.push({
itemId: v.itemId, itemId: v.itemId,
orderId: v.orderId,
createTime: Date.now() createTime: Date.now()
}) })
} }
...@@ -272,7 +283,7 @@ export default class TaskService extends UserService { ...@@ -272,7 +283,7 @@ export default class TaskService extends UserService {
*/ */
async updateFollowTask(userInfo: IUserInfo, activityInfo: IActivityInfo) { async updateFollowTask(userInfo: IUserInfo, activityInfo: IActivityInfo) {
const today = getToday() const today = getToday()
let { remainTimes, _id, taskInfo = {}, follow } = userInfo let { _id, taskInfo = {}, follow } = userInfo
// 获取活动基本信息 // 获取活动基本信息
const { tasks } = activityInfo const { tasks } = activityInfo
// 获取关注店铺奖励 // 获取关注店铺奖励
...@@ -281,24 +292,20 @@ export default class TaskService extends UserService { ...@@ -281,24 +292,20 @@ export default class TaskService extends UserService {
} = tasks || {} } = tasks || {}
// 更新follow信息 // 更新follow信息
const followInfo: IFollowInfo = { const followInfo: IFollowInfo = this.setNewFollowUserData(follow)
...follow,
newFollow: true,
followTime: Date.now(),
followDay: today
}
// 记录数据 // 记录数据
taskInfo[today] = taskInfo[today] || {} taskInfo[today] = taskInfo[today] || {}
taskInfo[today].follow = 1 taskInfo[today].follow = 1
// 增加待领取次数 // 增加待领取次数
remainTimes.follow += value
return await this.updateUser(_id, { return await this.updateUser(_id, {
$set: { $set: {
remainTimes,
follow: followInfo, follow: followInfo,
taskInfo taskInfo
},
$inc: {
'remainTimes.follow': 1
} }
}) })
} }
...@@ -315,7 +322,7 @@ export default class TaskService extends UserService { ...@@ -315,7 +322,7 @@ export default class TaskService extends UserService {
getTodayCompleteTask(taskType: string, userInfo: IUserInfo) { getTodayCompleteTask(taskType: string, userInfo: IUserInfo) {
const today = getToday() const today = getToday()
return { return {
todayTimes: userInfo?.taskInfo?.[today]?.[taskType]?.length || 0, todayCompleteTimes: userInfo?.taskInfo?.[today]?.[taskType]?.length || 0,
todayTaskInfo: userInfo?.taskInfo?.[today]?.[taskType] todayTaskInfo: userInfo?.taskInfo?.[today]?.[taskType]
} }
} }
...@@ -353,7 +360,12 @@ export default class TaskService extends UserService { ...@@ -353,7 +360,12 @@ export default class TaskService extends UserService {
* @returns {boolean} * @returns {boolean}
* @memberof TaskService * @memberof TaskService
*/ */
async updateUserTaskRecord(taskType: string, rewards: number, userInfo: IUserInfo, customRecord?: object) { async updateUserTaskRecord(
taskType: string,
rewards: number,
userInfo: IUserInfo,
customRecord?: object
): Promise<boolean> {
const { _id } = userInfo const { _id } = userInfo
const { openId } = this.context const { openId } = this.context
const today = getToday() const today = getToday()
...@@ -368,11 +380,26 @@ export default class TaskService extends UserService { ...@@ -368,11 +380,26 @@ export default class TaskService extends UserService {
return result === 1 return result === 1
} }
async updateTasks(id: string, needUpdateKeysArray: object[]) { /**
const updateKeys = Object.assign({}, ...needUpdateKeysArray) *
await this.updateUser(id, { * 更新user表中,任务相关字段
*
* @param {string} id
* @param {object[]} needUpdateKeysArray
* @param {IUserInfo} userInfo
* @returns {IUserInfo | boolean} userInfo
* @memberof TaskService
*/
async updateTasks(id: string, needUpdateKeysArray: object[], userInfo: IUserInfo): Promise<false | IUserInfo> {
const updateKeys: object = extend({}, ...needUpdateKeysArray)
const result = await this.updateUser(id, {
$set: updateKeys $set: updateKeys
}) })
return await this.getUserInfo() return result === 1
? {
...userInfo,
...updateKeys
}
: false
} }
} }
...@@ -138,26 +138,23 @@ class UserService extends BaseService { ...@@ -138,26 +138,23 @@ class UserService extends BaseService {
const followBefore = userInfo.follow.flag const followBefore = userInfo.follow.flag
const followNow = isFollow const followNow = isFollow
if (!followBefore && followNow && !userInfo.follow.newFollow) { if (!followBefore && followNow && !userInfo.follow.newFollow) {
userInfo.follow.newFollow = true userInfo.follow = this.setNewFollowUserData(userInfo.follow)
userInfo.follow.followTime = userInfo.follow.followTime || Date.now()
} }
const today = getToday() const today = getToday()
// 之前进入活动非会员,现在进入会员,则视为新会员用户 // 之前进入活动非会员,现在进入会员,则视为新会员用户
const isNewVip = this.checkNewVipStatus(userInfo, vipInfo) const isNewVip = this.checkNewVipStatus(userInfo, vipInfo)
if (isNewVip && !userInfo.member.newMember) { if (isNewVip && !userInfo.member.newMember) {
userInfo.member.newMember = true userInfo.member = this.setNewVipUserData(userInfo.member)
userInfo.member.bememberTime = userInfo.member.bememberTime || Date.now()
} }
// 添加登录次数
userInfo['login'][today] = userInfo['login'][today] ? userInfo['login'][today] + 1 : 1
await this.updateUser(userInfo._id, { await this.updateUser(userInfo._id, {
$set: { $set: {
follow: userInfo.follow, follow: userInfo.follow,
login: userInfo['login'],
member: userInfo.member member: userInfo.member
},
$inc: {
[`login.${today}`]: 1
} }
}) })
} }
...@@ -201,6 +198,26 @@ class UserService extends BaseService { ...@@ -201,6 +198,26 @@ class UserService extends BaseService {
return !flag && isVip return !flag && isVip
} }
setNewVipUserData(member: IMemberInfo): IMemberInfo {
const today = getToday()
return {
...member,
newMember: true,
bememberTime: Date.now(),
bememberDay: today
}
}
setNewFollowUserData(follow: IFollowInfo): IFollowInfo {
const today = getToday()
return {
...follow,
newFollow: true,
followTime: Date.now(),
followDay: today
}
}
} }
export default UserService export default UserService
...@@ -38,6 +38,11 @@ ...@@ -38,6 +38,11 @@
resolved "https://registry.npm.taobao.org/@types/json-schema/download/@types/json-schema-7.0.5.tgz#dcce4430e64b443ba8945f0290fb564ad5bac6dd" resolved "https://registry.npm.taobao.org/@types/json-schema/download/@types/json-schema-7.0.5.tgz#dcce4430e64b443ba8945f0290fb564ad5bac6dd"
integrity sha1-3M5EMOZLRDuolF8CkPtWStW6xt0= integrity sha1-3M5EMOZLRDuolF8CkPtWStW6xt0=
"@types/lodash@^4.14.160":
version "4.14.160"
resolved "https://registry.npm.taobao.org/@types/lodash/download/@types/lodash-4.14.160.tgz?cache=0&sync_timestamp=1598288460918&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Flodash%2Fdownload%2F%40types%2Flodash-4.14.160.tgz#2f1bba6500bc3cb9a732c6d66a083378fb0b0b29"
integrity sha1-Lxu6ZQC8PLmnMsbWaggzePsLCyk=
"@types/node@^14.6.0": "@types/node@^14.6.0":
version "14.6.0" version "14.6.0"
resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-14.6.0.tgz?cache=0&sync_timestamp=1597673176468&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-14.6.0.tgz#7d4411bf5157339337d7cff864d9ff45f177b499" resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-14.6.0.tgz?cache=0&sync_timestamp=1597673176468&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-14.6.0.tgz#7d4411bf5157339337d7cff864d9ff45f177b499"
...@@ -632,7 +637,7 @@ levn@^0.4.1: ...@@ -632,7 +637,7 @@ levn@^0.4.1:
prelude-ls "^1.2.1" prelude-ls "^1.2.1"
type-check "~0.4.0" type-check "~0.4.0"
lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19: lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20:
version "4.17.20" version "4.17.20"
resolved "https://registry.npm.taobao.org/lodash/download/lodash-4.17.20.tgz?cache=0&sync_timestamp=1597336053864&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" resolved "https://registry.npm.taobao.org/lodash/download/lodash-4.17.20.tgz?cache=0&sync_timestamp=1597336053864&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha1-tEqbYpe8tpjxxRo1RaKzs2jVnFI= integrity sha1-tEqbYpe8tpjxxRo1RaKzs2jVnFI=
...@@ -862,10 +867,10 @@ table@^5.2.3: ...@@ -862,10 +867,10 @@ table@^5.2.3:
slice-ansi "^2.1.0" slice-ansi "^2.1.0"
string-width "^3.0.0" string-width "^3.0.0"
taobao-mini-sdk@0.1.5: taobao-mini-sdk@0.1.6:
version "0.1.5" version "0.1.6"
resolved "https://registry.npm.taobao.org/taobao-mini-sdk/download/taobao-mini-sdk-0.1.5.tgz?cache=0&sync_timestamp=1597738826643&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftaobao-mini-sdk%2Fdownload%2Ftaobao-mini-sdk-0.1.5.tgz#7cd64eaa581423c57f841fecd6bf76c827386771" resolved "https://registry.npm.taobao.org/taobao-mini-sdk/download/taobao-mini-sdk-0.1.6.tgz#cc20f10879a1b872a7358d24efc426fda104fce7"
integrity sha1-fNZOqlgUI8V/hB/s1r92yCc4Z3E= integrity sha1-zCDxCHmhuHKnNY0k78Qm/aEE/Oc=
text-table@^0.2.0: text-table@^0.2.0:
version "0.2.0" version "0.2.0"
......
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