Commit 693a2219 authored by qinhaitao's avatar qinhaitao

opt: code

parent 417aa155
......@@ -52,6 +52,10 @@ export declare const BusinessError: {
code: string;
defaultMsg: string;
};
ERROR_AREADY_INVITE_SUCCESS: {
code: string;
defaultMsg: string;
};
ERROR_FORBIDDEN_OPE: {
code: string;
defaultMsg: string;
......@@ -134,6 +138,10 @@ export declare const CODE_TYPES: {
code: string;
defaultMsg: string;
};
ERROR_AREADY_INVITE_SUCCESS: {
code: string;
defaultMsg: string;
};
ERROR_FORBIDDEN_OPE: {
code: string;
defaultMsg: string;
......
......@@ -66,6 +66,10 @@ exports.BusinessError = {
code: "430006",
defaultMsg: "\u4ECA\u65E5\u5B8C\u6210\u8BE5\u4EFB\u52A1\u6B21\u6570\u8D85\u9650"
},
ERROR_AREADY_INVITE_SUCCESS: {
code: "43000&",
defaultMsg: "\u5DF2\u7ECF\u6210\u529F\u9080\u8BF7\u8FC7"
},
ERROR_FORBIDDEN_OPE: {
code: "530001",
defaultMsg: "\u975E\u6CD5\u64CD\u4F5C"
......
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,6BAA0C;AAE7B,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,kBAAkB,EAAE;QAClB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,0BAAM;KACnB;IACD,QAAQ;IACR,iBAAiB,EAAE;QACjB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,QAAQ;IACR,sBAAsB,EAAE;QACtB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,QAAQ;IACR,mBAAmB,EAAE;QACnB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,QAAQ;IACR,aAAa,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,cAAc;IACd,uBAAuB,EAAE;QACvB,IAAI,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E3D,OAAO;AACM,QAAA,2BAA2B,GAAa;IACnD,wBAAwB;IACxB,uBAAuB;IACvB,0BAA0B;IAC1B,oBAAoB;IACpB,gBAAgB;IAChB,qBAAqB;CACtB,CAAA;AAQD,UAAU;AACG,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,CAAC;CACX,CAAA;AAEY,QAAA,WAAW,GAAG;IACzB,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE;IACxC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;IACpC,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;IACzC,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;CAC1C,CAAA"}
\ No newline at end of file
/** @format */
import { AwardsService, BaseService } from '../service';
import { AwardsService } from '../service';
export default class AwardsController {
/**
* 我的奖品列表
......@@ -12,5 +12,5 @@ export default class AwardsController {
/**
* 权益重新领取
*/
receiveEnamePrize(context: Context, {}: {}, [awardSer, baseService]: [AwardsService, BaseService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
receiveEnamePrize(context: Context, {}: {}, [awardSer]: [AwardsService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
}
......@@ -58,10 +58,12 @@ var AwardsController = /** @class */ (function () {
AwardsController.prototype.getMyPrizeList = function (context, _a, _b) {
var awardSer = _b[0];
return __awaiter(this, void 0, void 0, function () {
var result;
var openId, activityId, result;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4 /*yield*/, awardSer.getMyPrizeList({ openId: context.openId, activityId: context.data.activityId })];
case 0:
openId = context.openId, activityId = context.data.activityId;
return [4 /*yield*/, awardSer.getMyPrizeList({ openId: openId, activityId: activityId })];
case 1:
result = _c.sent();
return [2 /*return*/, sdk_1.resultsModel.success(result)];
......@@ -107,7 +109,7 @@ var AwardsController = /** @class */ (function () {
* 权益重新领取
*/
AwardsController.prototype.receiveEnamePrize = function (context, _a, _b) {
var awardSer = _b[0], baseService = _b[1];
var awardSer = _b[0];
return __awaiter(this, void 0, void 0, function () {
var _c, _id, activityId, result;
return __generator(this, function (_d) {
......@@ -153,7 +155,7 @@ var AwardsController = /** @class */ (function () {
__decorate([
decorator_1.paramsCheck(['activityId', '_id']),
decorator_1.userCheck({ intercept: true }),
decorator_1.services([service_1.AwardsService, service_1.BaseService]),
decorator_1.services([service_1.AwardsService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
......
{"version":3,"file":"awards.controller.js","sourceRoot":"","sources":["../../src/controller/awards.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGd,0CAA+D;AAE/D,8BAAqC;AACrC,sCAAuD;AACvD;IAAA;IA4DA,CAAC;IA3DC;;OAEG;IAIG,yCAAc,GAApB,UAAqB,OAAgB,EAAE,EAAE,EAAE,EAA2B;YAA1B,QAAQ,QAAA;;;;;4BACrC,qBAAM,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,EAAA;;wBAAvG,MAAM,GAAG,SAA8F;wBAC3G,sBAAO,kBAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAA;;;;KACpC;IAED;;OAEG;IAIG,6CAAkB,GAAxB,UAAyB,OAAgB,EAAE,EAAE,EAAE,EAA2B;YAA1B,QAAQ,QAAA;;;;;;wBAClD,KAAwE,OAAO,CAAC,IAAI,EAAlF,QAAQ,cAAA,EAAE,IAAI,UAAA,EAAE,IAAI,UAAA,EAAE,aAAa,mBAAA,EAAE,GAAG,SAAA,EAAE,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S,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;0DAIzB;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;QAChG,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;8DAmBzB;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAClC,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,EAAE,qBAAW,CAAC,CAAC;;;;6DAgBtC;IACH,uBAAC;CAAA,AA5DD,IA4DC;kBA5DoB,gBAAgB"}
\ No newline at end of file
{"version":3,"file":"awards.controller.js","sourceRoot":"","sources":["../../src/controller/awards.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,0CAA+D;AAE/D,8BAAqC;AACrC,sCAAuD;AACvD;IAAA;IAgEA,CAAC;IA/DC;;OAEG;IAIG,yCAAc,GAApB,UAAqB,OAAgB,EAAE,EAAE,EAAE,EAA2B;YAA1B,QAAQ,QAAA;;;;;;wBAEhD,MAAM,GAEJ,OAAO,OAFH,EACE,UAAU,GAChB,OAAO,gBADS,CACT;wBACE,qBAAM,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,QAAA,EAAE,UAAU,YAAA,EAAE,CAAC,EAAA;;wBAA9D,MAAM,GAAG,SAAqD;wBAClE,sBAAO,kBAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAA;;;;KACpC;IAED;;OAEG;IAIG,6CAAkB,GAAxB,UAAyB,OAAgB,EAAE,EAAE,EAAE,EAA2B;YAA1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AO,kBAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAA;;;;KACpC;IAxDD;QAHC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;0DAQzB;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;QAChG,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;8DAmBzB;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAClC,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;6DAgBzB;IACH,uBAAC;CAAA,AAhED,IAgEC;kBAhEoB,gBAAgB"}
\ No newline at end of file
/** @format */
import { UserService, BaseService, AccessService } from '../service';
import { UserService, AccessService, TaskService } from '../service';
export default class Share {
/**
* 完成分享
*/
insertShareRecord(context: Context, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, baseService, accessService]: [UserService, BaseService, AccessService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
insertShareRecord(context: Context, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, taskService, accessService]: [UserService, TaskService, AccessService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
}
......@@ -66,9 +66,9 @@ var Share = /** @class */ (function () {
*/
Share.prototype.insertShareRecord = function (context, _a, _b) {
var userInfo = _a.userInfo, vipInfo = _a.vipInfo, activityInfo = _a.activityInfo;
var userService = _b[0], baseService = _b[1], accessService = _b[2];
var userService = _b[0], taskService = _b[1], accessService = _b[2];
return __awaiter(this, void 0, void 0, function () {
var _c, activityId, inviteId, openId, inviteUserInfo, isFirstLogin, isValidShare, tasks, value, today, inviteUserId;
var _c, activityId, inviteId, openId, inviteUserInfo, inviteCompleteList, isNewVip, isValidShare, tasks, value, today, inviteUserId;
var _d;
return __generator(this, function (_e) {
switch (_e.label) {
......@@ -83,14 +83,17 @@ var Share = /** @class */ (function () {
// inviteId的用户信息查询不到, 则inviteId无效
if (!inviteUserInfo)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_INVALID_INVITE_ID)];
return [4 /*yield*/, accessService.getAccessCount()];
case 2:
isFirstLogin = (_e.sent()) === 1;
isValidShare = [isFirstLogin].every(function (v) { return !!v; });
inviteCompleteList = taskService.getCompleteTaskByUserTaskInfo('invites', inviteUserInfo);
// 邀请成功列表有该用户信息
if (inviteCompleteList.some(function (v) { return v.openId === openId; })) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_AREADY_INVITE_SUCCESS)];
}
isNewVip = userService.checkNewVipStatus(userInfo, vipInfo);
isValidShare = [isNewVip].every(function (v) { return !!v; });
tasks = activityInfo.tasks;
value = (tasks || {}).inviteFriends.value;
today = utils_1.getToday();
if (!isValidShare) return [3 /*break*/, 4];
if (!isValidShare) return [3 /*break*/, 3];
inviteUserId = inviteUserInfo._id;
// 增加邀请人的待领取次数和邀请记录
return [4 /*yield*/, userService.updateUser(inviteUserId, {
......@@ -101,11 +104,11 @@ var Share = /** @class */ (function () {
_d["taskInfo." + today + ".invites"] = { openId: openId, createTime: Date.now() },
_d)
})];
case 3:
case 2:
// 增加邀请人的待领取次数和邀请记录
_e.sent();
_e.label = 4;
case 4: return [2 /*return*/, sdk_1.resultsModel.success(true)];
_e.label = 3;
case 3: return [2 /*return*/, sdk_1.resultsModel.success(true)];
}
});
});
......@@ -113,7 +116,7 @@ var Share = /** @class */ (function () {
__decorate([
check_1.paramsCheck(['activityId', 'inviteId']),
check_1.activityTimeCheck,
services_1.services([service_1.UserService, service_1.BaseService, service_1.AccessService]),
services_1.services([service_1.UserService, service_1.TaskService, service_1.AccessService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
......
{"version":3,"file":"share.controller.js","sourceRoot":"","sources":["../../src/controller/share.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2C;AAC3C,4CAA8E;AAC9E,kDAAgD;AAEhD,8BAAqC;AACrC,kCAAqD;AACrD,sCAAoE;AAEpE,IAAI;AACJ,+BAA+B;AAC/B,cAAc;AACd,+CAA+C;AAC/C,MAAM;AACN,IAAI;AACJ;IAAA;IAoDA,CAAC;IAnDC;;OAEG;IAIG,iCAAiB,GAAvB,UACE,OAAgB,EAChB,EAAqD,EACrD,EAAoF;YADlF,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA;YAChC,WAAW,QAAA,EAAE,WAAW,QAAA,EAAE,aAAa,QAAA;;;;;;;wBAElC,KAA2B,OAAO,CAAC,IAAI,EAArC,UAAU,gBAAA,EAAE,QAAQ,cAAA,CAAiB;wBACrC,MAAM,GAAK,OAAO,OAAZ,CAAY;wBAEQ,qBAAM,WAAW,CAAC,mBAAmB,CAAC,QAAQ,CAAC;4BACjF,iCAAiC;0BADgD;;wBAA3E,cAAc,GAAc,SAA+C;wBACjF,iCAAiC;wBACjC,IAAI,CAAC,cAAc;4BAAE,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,uBAAuB,CAAC,EAAA;wBAEnD,qBAAM,aAAa,CAAC,cAAc,EAAE,EAAA;;wBAA7D,YAAY,GAAY,CAAC,SAAoC,CAAC,KAAK,CAAC;wBAMpE,YAAY,GAAG,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,CAAC,EAAH,CAAG,CAAC,CAAA;wBAG3C,KAAK,GAAK,YAAY,MAAjB,CAAiB;wBAGX,KAAK,GACZ,CAAA,KAAK,IAAI,EAAE,CAAA,oBADC,CACD;wBAIjB,KAAK,GAAG,gBAAQ,EAAE,CAAA;6BACpB,YAAY,EAAZ,wBAAY;wBACD,YAAY,GAAK,cAAc,IAAnB,CAAmB;wBAC5C,mBAAmB;wBACnB,qBAAM,WAAW,CAAC,UAAU,CAAC,YAAY,EAAE;gCACzC,IAAI,EAAE;oCACJ,qBAAqB,EAAE,KAAK;iCAC7B;gCACD,KAAK;oCACH,GAAC,cAAY,KAAK,aAAU,IAAG,EAAE,MAAM,QAAA,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE;uCAClE;6BACF,CAAC,EAAA;;wBARF,mBAAmB;wBACnB,SAOE,CAAA;;4BAGJ,sBAAO,kBAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAA;;;;KAClC;IA5CD;QAHC,mBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACvC,yBAAiB;QACjB,mBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;kDA6CnD;IACH,YAAC;CAAA,AApDD,IAoDC;kBApDoB,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,4CAA2C;AAC3C,4CAA8E;AAC9E,kDAAgD;AAEhD,8BAAqC;AACrC,kCAAqD;AACrD,sCAAiF;AAEjF,IAAI;AACJ,+BAA+B;AAC/B,cAAc;AACd,+CAA+C;AAC/C,MAAM;AACN,IAAI;AACJ;IAAA;IA2DA,CAAC;IA1DC;;OAEG;IAIG,iCAAiB,GAAvB,UACE,OAAgB,EAChB,EAAqD,EACrD,EAAoF;YADlF,QAAQ,cAAA,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,qBAAqB,EAAE,KAAK;iCAC7B;gCACD,KAAK;oCACH,GAAC,cAAY,KAAK,aAAU,IAAG,EAAE,MAAM,QAAA,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE;uCAClE;6BACF,CAAC,EAAA;;wBARF,mBAAmB;wBACnB,SAOE,CAAA;;4BAGJ,sBAAO,kBAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAA;;;;KAClC;IAnDD;QAHC,mBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACvC,yBAAiB;QACjB,mBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;kDAoDnD;IACH,YAAC;CAAA,AA3DD,IA2DC;kBA3DoB,KAAK"}
\ No newline at end of file
/** @format */
import { UserService, TaskService } from '../service';
import { TaskService } from '../service';
export default class Task {
/**
* 任务列表
......@@ -12,9 +12,13 @@ export default class Task {
/**
* 积分兑换次数
*/
doExchangeCreditsTask(context: Context, { userInfo, activityInfo, session }: IControllerInfos, [userService, taskService]: [UserService, TaskService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
doExchangeCreditsTask(context: Context, { userInfo, activityInfo, session }: IControllerInfos, [taskService]: [TaskService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
/**
* 浏览商品
*/
doBrowseGoodsTask(context: Context, { userInfo, activityInfo }: IControllerInfos, [taskService]: [TaskService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
/**
* 领取任务奖励
*/
receiveTaskRewards(context: Context, { userInfo }: IControllerInfos, [taskService]: [TaskService]): Promise<Result>;
}
......@@ -49,7 +49,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require("./../constants");
var decorator_1 = require("../decorator");
var sdk_1 = require("../sdk");
var utils_1 = require("../utils");
var service_1 = require("../service");
// {
// "handler": "getTaskList",
......@@ -67,7 +66,7 @@ var Task = /** @class */ (function () {
var userInfo = _a.userInfo, vipInfo = _a.vipInfo, activityInfo = _a.activityInfo, session = _a.session;
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var tasks, startTime, updatedUserInfo, _c, _d, _e, _f, vipTask, followTask;
var tasks, startTime, updatedUserInfo, _c, _d, _e, _f, vipTask, followTask, orderGoodsTask, browseGoodsTask, invitesTask;
return __generator(this, function (_g) {
switch (_g.label) {
case 0:
......@@ -87,15 +86,12 @@ var Task = /** @class */ (function () {
];
vipTask = taskService.initVipTask(updatedUserInfo, vipInfo, tasks);
followTask = taskService.initFollowTask(updatedUserInfo, tasks);
// // 下单任务
// const orderGoodsTask = taskService.initOrderGoodsTask(updatedUserInfo, tasks)
// // 浏览商品任务
// const browseGoodsTask = taskService.initBrowseGoodsTask(updatedUserInfo, tasks)
// // 邀请任务
// const invitesTask = taskService.initInvitesTask(updatedUserInfo, tasks)
orderGoodsTask = taskService.initOrderGoodsTask(updatedUserInfo, tasks);
browseGoodsTask = taskService.initBrowseGoodsTask(updatedUserInfo, tasks);
invitesTask = taskService.initInvitesTask(updatedUserInfo, tasks);
// 积分兑换
//const exchangeCreditsTask = taskService.initExchangeCreditsTask(updatedUserInfo, tasks)
return [2 /*return*/, sdk_1.resultsModel.success([vipTask, followTask])];
return [2 /*return*/, sdk_1.resultsModel.success([vipTask, followTask, orderGoodsTask, browseGoodsTask, invitesTask])];
}
});
});
......@@ -131,18 +127,15 @@ var Task = /** @class */ (function () {
*/
Task.prototype.doExchangeCreditsTask = function (context, _a, _b) {
var userInfo = _a.userInfo, activityInfo = _a.activityInfo, session = _a.session;
var userService = _b[0], taskService = _b[1];
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var openId, credits, _id, _c, taskInfo, taskType, _d, value, times, taskRateType, today, todayCompleteTimes, myCredits, result;
return __generator(this, function (_e) {
switch (_e.label) {
var credits, taskType, _c, value, times, taskRateType, todayCompleteTimes, myCredits, result;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
openId = context.openId;
credits = context.data.credits;
_id = userInfo._id, _c = userInfo.taskInfo, taskInfo = _c === void 0 ? {} : _c;
taskType = "exchangeCredits";
_d = activityInfo.tasks.exchangeCredits, value = _d.value, times = _d.times, taskRateType = _d.taskRateType;
today = utils_1.getToday();
_c = activityInfo.tasks.exchangeCredits, value = _c.value, times = _c.times, taskRateType = _c.taskRateType;
todayCompleteTimes = taskService.getTodayCompleteTask(taskType, userInfo).todayCompleteTimes;
// 如果每日限制次数并到达了限制次数
if (times && times === todayCompleteTimes && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY) {
......@@ -150,7 +143,7 @@ var Task = /** @class */ (function () {
}
return [4 /*yield*/, sdk_1.TBAPIS.queryCredits(context, session)];
case 1:
myCredits = _e.sent();
myCredits = _d.sent();
console.log('myCredits', myCredits);
// 积分不足
if (myCredits < credits)
......@@ -164,7 +157,7 @@ var Task = /** @class */ (function () {
remark: "\u79EF\u5206\u5151\u6362\u4EFB\u52A1\u51CF\u79EF\u5206"
})];
case 2:
result = _e.sent();
result = _d.sent();
if (!result)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.SYSTEM_ERROR)
// 更新user表
......@@ -173,7 +166,7 @@ var Task = /** @class */ (function () {
return [4 /*yield*/, taskService.updateUserTaskRecord(taskType, value, userInfo)];
case 3:
// 更新user表
_e.sent();
_d.sent();
return [2 /*return*/, sdk_1.resultsModel.success(true)];
}
});
......@@ -220,6 +213,40 @@ var Task = /** @class */ (function () {
});
});
};
/**
* 领取任务奖励
*/
Task.prototype.receiveTaskRewards = function (context, _a, _b) {
var userInfo = _a.userInfo;
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var taskType, remainTimes, _id, waitReceiveTimes, awardsTargetKey;
var _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
taskType = context.data.taskType;
remainTimes = userInfo.remainTimes, _id = userInfo._id;
// 暂无领取次数
if (!(remainTimes === null || remainTimes === void 0 ? void 0 : remainTimes[taskType]))
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_NORECEIVE)];
waitReceiveTimes = remainTimes === null || remainTimes === void 0 ? void 0 : remainTimes[taskType];
awardsTargetKey = "gameTimes";
return [4 /*yield*/, taskService.updateUser(_id, {
$set: (_c = {},
_c["remainTimes." + taskType] = 0,
_c),
$inc: (_d = {},
_d[awardsTargetKey] = waitReceiveTimes,
_d)
})];
case 1:
_e.sent();
return [2 /*return*/, sdk_1.resultsModel.success(true)];
}
});
});
};
__decorate([
decorator_1.paramsCheck(['activityId']),
decorator_1.userCheck({ intercept: true }),
......@@ -241,7 +268,7 @@ var Task = /** @class */ (function () {
decorator_1.paramsCheck(['activityId', 'credits']),
decorator_1.userCheck({ intercept: true }),
decorator_1.activityTimeCheck,
decorator_1.services([service_1.UserService, service_1.TaskService]),
decorator_1.services([service_1.TaskService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
......@@ -255,6 +282,15 @@ var Task = /** @class */ (function () {
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "doBrowseGoodsTask", null);
__decorate([
decorator_1.paramsCheck(['activityId', 'taskType']),
decorator_1.userCheck({ intercept: true }),
decorator_1.activityTimeCheck,
decorator_1.services([service_1.TaskService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "receiveTaskRewards", null);
return Task;
}());
exports.default = Task;
......
This diff is collapsed.
......@@ -71,7 +71,7 @@ var User = /** @class */ (function () {
case 1:
_c.sent();
return [3 /*break*/, 4];
case 2: return [4 /*yield*/, userService.updateUserData(vipInfo, userInfo)];
case 2: return [4 /*yield*/, userService.updateUserData(vipInfo, userInfo, activityInfo)];
case 3:
_c.sent();
_c.label = 4;
......
{"version":3,"file":"user.controller.js","sourceRoot":"","sources":["../../src/controller/user.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;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AAO,kBAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAA;;;;KACpC;IArCD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;QAC7D,6BAAiB;QACjB,oBAAQ,CAAC,CAAC,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;qCAsBtC;IAMD;QAFC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,oBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;0CAWvB;IACH,WAAC;CAAA,AA7CD,IA6CC;kBA7CoB,IAAI"}
\ No newline at end of file
{"version":3,"file":"user.controller.js","sourceRoot":"","sources":["../../src/controller/user.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,0CAAkF;AAElF,8BAAqC;AACrC,sCAAuD;AACvD,oCAAqC;AAiBrC;IAAA;IA6CA,CAAC;IA5CC;;OAEG;IAIG,oBAAK,GAAX,UACE,OAAsB,EACtB,EAAqD,EACrD,EAA0D;YADxD,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA;YAChC,WAAW,QAAA,EAAE,aAAa,QAAA;;;;;;wBAEnB,MAAM,GAAK,OAAO,OAAZ,CAAY;wBAElB,QAAQ,GAAK,OAAO,CAAC,IAAI,SAAjB,CAAiB;6BAE7B,CAAC,QAAQ,EAAT,wBAAS;wBACX,qBAAM,WAAW,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,EAAA;;wBAArD,SAAqD,CAAA;;4BAErD,qBAAM,WAAW,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAA;;wBAAjE,SAAiE,CAAA;;;oBAGnE,UAAU;oBACV,qBAAM,aAAa,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,EAAA;;wBADtD,UAAU;wBACV,SAAsD,CAAA;wBAEtD,sBAAO,kBAAY,CAAC,OAAO,CAAC;gCAC1B,MAAM,QAAA;6BACP,CAAC,EAAA;;;;KACH;IACD;;OAEG;IAGG,yBAAU,GAAhB,UACE,OAAoB,EACpB,EAA+C,EAC/C,EAA4B;YAD1B,OAAO,aAAA,EAAE,gBAAgB,sBAAA;YAC1B,WAAW,QAAA;;;;;;wBAEJ,WAAW,GAAK,OAAO,CAAC,IAAI,YAAjB,CAAiB;wBAC5B,gBAAgB,GAAK,kBAAS,CAAC,OAAO,CAAC,iBAAvB,CAAuB;wBAChC,qBAAM,WAAW,CAAC,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,WAAW,IAAI,gBAAgB,CAAC,EAAA;;wBAAjG,MAAM,GAAG,SAAwF;wBAEvG,sBAAO,kBAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAA;;;;KACpC;IArCD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;QAC7D,6BAAiB;QACjB,oBAAQ,CAAC,CAAC,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;qCAsBtC;IAMD;QAFC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,oBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;0CAWvB;IACH,WAAC;CAAA,AA7CD,IA6CC;kBA7CoB,IAAI"}
\ No newline at end of file
......@@ -103,7 +103,7 @@ exports.services = function (services) {
_b.label = 2;
case 2:
_b.trys.push([2, 4, , 6]);
utils_1.logger(context);
utils_1.logFn(context);
return [4 /*yield*/, method.apply(target, [context, baseInfos, servicesInstance])];
case 3:
ret = _b.sent();
......
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/decorator/services.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,sCAAwC;AACxC,kCAAmE;AACnE,8BAAqC;AACrC,0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B,qBAAM,YAAY,CAAC,OAAO,EAAE,SAAS,CAAC;gCAC1E,mCAAmC;8BADuC;;4BAApE,SAAS,GAAqB,SAAsC;4BAC1E,mCAAmC;4BACnC,IAAI,SAAS,CAAC,OAAO,EAAE;gCACrB,OAAO,SAAS,CAAC,OAAO,CAAA;gCACxB,sBAAO,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,EAAA;6BACpE;;;;4BAGC,cAAM,CAAC,OAAO,CAAC,CAAA;4BACT,qBAAM,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,EAAA;;4BAAxE,GAAG,GAAG,SAAkE,CAAA;;;;4BAExE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,OAAK,CAAC,CAAA;4BAC3B,qBAAM,sBAAc,CAAC,OAAO,EAAE,SAAS,EAAE,OAAK,CAAC,QAAQ,EAAE,EAAE,OAAK,CAAC,KAAK,CAAC,EAAA;;4BAAvE,SAAuE,CAAA;4BACvE,GAAG,GAAG,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,YAAY,CAAC,CAAA;;gCAEnD,sBAAO,GAAG,EAAA;;;;SACX,CAAA;IACH,CAAC,CAAA;AACH,CAAC,CAAA"}
\ No newline at end of file
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/decorator/services.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,sCAAwC;AACxC,kCAAkE;AAClE,8BAAqC;AACrC,0CAAyC;AACzC,SAAe,YAAY,CAAC,OAAgB,EAAE,SAA2B;;;;;;oBACjE,WAAW,GAAG,IAAI,qBAAW,CAAC,OAAO,CAAC,CAAA;yBAExC,CAAC,SAAS,CAAC,QAAQ,EAAnB,wBAAmB;oBACJ,qBAAM,WAAW,CAAC,WAAW,EAAE,EAAA;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AM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,EAAA;6BACpE;;;;4BAGC,aAAK,CAAC,OAAO,CAAC,CAAA;4BACR,qBAAM,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,EAAA;;4BAAxE,GAAG,GAAG,SAAkE,CAAA;;;;4BAExE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,OAAK,CAAC,CAAA;4BAC3B,qBAAM,sBAAc,CAAC,OAAO,EAAE,SAAS,EAAE,OAAK,CAAC,QAAQ,EAAE,EAAE,OAAK,CAAC,KAAK,CAAC,EAAA;;4BAAvE,SAAuE,CAAA;4BACvE,GAAG,GAAG,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,YAAY,CAAC,CAAA;;gCAEnD,sBAAO,GAAG,EAAA;;;;SACX,CAAA;IACH,CAAC,CAAA;AACH,CAAC,CAAA"}
\ No newline at end of file
......@@ -8,9 +8,9 @@ interface ITaskInfo {
taskType?: string;
url?: string;
rewards: number;
done?: boolean;
itemIds?: string;
todayCompleteTimes?: number;
completeTimes?: number;
taskRateType: number;
times?: number;
waitReceive?: number;
......@@ -25,16 +25,11 @@ export default class TaskService extends UserService {
initFollowTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
initExchangeCreditsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
updateVipTaskStatus(userInfo: IUserInfo, vipInfo: IVipInfo, tasks: ITasks): {
member: IMemberInfo;
remainTimes: IRemainTimesInfo;
$set: {};
$inc: {};
$push: {};
};
updateOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks, activityStartTime: number, session?: string): Promise<{
remainTimes?: undefined;
taskInfo?: undefined;
} | {
remainTimes: IRemainTimesInfo;
taskInfo: object;
}>;
updateOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks, activityStartTime: number, session?: string): Promise<{}>;
/**
*更新关注店铺任务状态
*
......
This diff is collapsed.
This diff is collapsed.
......@@ -34,7 +34,7 @@ declare class UserService extends BaseService {
* @memberof UserService
*/
initUserData(vipInfo: IVipInfo, activityInfo: IActivityInfo): Promise<any>;
updateUserData(vipInfo: IVipInfo, userInfo: IUserInfo): Promise<void>;
updateUserData(vipInfo: IVipInfo, userInfo: IUserInfo, activityInfo: IActivityInfo): Promise<void>;
/**
* @desc 更新用户表
* @param {用户的主键id} _id
......
......@@ -228,34 +228,41 @@ var UserService = /** @class */ (function (_super) {
});
});
};
UserService.prototype.updateUserData = function (vipInfo, userInfo) {
UserService.prototype.updateUserData = function (vipInfo, userInfo, activityInfo) {
return __awaiter(this, void 0, void 0, function () {
var data, isFollow, followBefore, followNow, today, isNewVip;
var data, isFollow, today, projection, tasks, attentionStore, beMembership, followBefore, followNow, isNewVip;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
data = this.context.data;
isFollow = data.isFollow;
today = utils_1.getToday();
projection = {
$set: {},
$push: {},
$inc: (_a = {},
_a["login." + today] = 1,
_a)
};
tasks = activityInfo.tasks;
attentionStore = tasks.attentionStore, beMembership = tasks.beMembership;
followBefore = userInfo.follow.flag;
followNow = isFollow;
if (!followBefore && followNow && !userInfo.follow.newFollow) {
userInfo.follow = this.setNewFollowUserData(userInfo.follow);
// @ts-ignore
projection.$set.follow = this.setNewFollowUserData(userInfo.follow);
projection.$push["taskInfo." + today + ".follow"] = { createTime: Date.now() };
projection.$inc["remainTimes.follow"] = attentionStore.value;
}
today = utils_1.getToday();
isNewVip = this.checkNewVipStatus(userInfo, vipInfo);
if (isNewVip && !userInfo.member.newMember) {
userInfo.member = this.setNewVipUserData(userInfo.member);
// @ts-ignore
projection.$set.member = this.setNewVipUserData(userInfo.member);
projection.$push["taskInfo." + today + ".member"] = { createTime: Date.now() };
projection.$inc["remainTimes.member"] = beMembership.value;
}
return [4 /*yield*/, this.updateUser(userInfo._id, {
$set: {
follow: userInfo.follow,
member: userInfo.member
},
$inc: (_a = {},
_a["login." + today] = 1,
_a)
})];
return [4 /*yield*/, this.updateUser(userInfo._id, projection)];
case 1:
_b.sent();
return [2 /*return*/];
......
This diff is collapsed.
......@@ -87,7 +87,8 @@ exports.getUserOrderlist = function (context, queryStartTime, queryEndTime, sess
price: s.price,
orderId: s.oid,
img: s.pic_path,
title: s.title
title: s.title,
tId: i.tid
});
});
}
......
{"version":3,"file":"getUserOrderlist.js","sourceRoot":"","sources":["../../../src/utils/package/getUserOrderlist.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA8B;AAC9B,iCAAuE;AACvE,2CAA+C;AAC/C,6CAA6D;AAEhD,QAAA,gBAAgB,GAAG,UAAO,OAAO,EAAE,cAAc,EAAE,YAAa,EAAE,OAAgB;;;;;;gBAEvF,YAAU,EAAE,CAAA;gBACZ,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;gBAExB,cAAc,GAAG,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,CAAA;gBACvD,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAA;gBAC7C,yCAAyC;gBACzC,IAAI,cAAc,GAAG,cAAc,EAAE;oBACnC,cAAc,GAAG,cAAc,CAAA;iBAChC;qBACG,CAAC,OAAO,EAAR,wBAAQ;gBACC,qBAAM,6BAAgB,CAAC,OAAO,CAAC,EAAA;;gBAA1C,OAAO,GAAG,CAAC,SAA+B,CAAC,CAAC,OAAO,CAAA;;;gBAGjD,MAAM,GAAG;oBACX,SAAS,EAAE,mBAAa,CAAC,0BAAoB,CAAC,cAAc,CAAC,CAAC;oBAC9D,OAAO,EAAE,mBAAa,CAAC,0BAAoB,CAAC,YAAY,IAAI,WAAW,CAAC,CAAC;oBACzE,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,OAAO,SAAA;iBACR,CAAA;gBACiB,qBAAM,YAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,EAAA;;gBAA7D,WAAW,GAAG,SAA+C;gBACjE,IAAI,WAAW,CAAC,aAAa,GAAG,CAAC,EAAE;oBACzB,KAAK,GAAK,WAAW,CAAC,MAAM,MAAvB,CAAuB;oBACpC,KAAK,CAAC,OAAO,CAAC,UAAA,CAAC;wBACb,IAAI,uCAA2B,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;4BAClD,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,UAAA,CAAC;gCACtB,SAAO,CAAC,IAAI,CAAC;oCACX,OAAO,EAAE,CAAC,CAAC,QAAQ;oCACnB,MAAM,EAAE,CAAC,CAAC,OAAO;oCACjB,IAAI,EAAE,CAAC,CAAC,OAAO;oCACf,KAAK,EAAE,CAAC,CAAC,KAAK;oCACd,OAAO,EAAE,CAAC,CAAC,GAAG;oCACd,GAAG,EAAE,CAAC,CAAC,QAAQ;oCACf,KAAK,EAAE,CAAC,CAAC,KAAK;iCACf,CAAC,CAAA;4BACJ,CAAC,CAAC,CAAA;yBACH;oBACH,CAAC,CAAC,CAAA;iBACH;gBACD,OAAO,CAAC,GAAG,CAAC,kDAAU,EAAE,SAAO,CAAC,CAAA;gBAChC,sBAAO,SAAO,EAAA;;;gBAEd,OAAO,CAAC,GAAG,CAAC,cAAI,EAAE,GAAC,CAAC,CAAA;gBACpB,sBAAO,EAAE,EAAA;;;;KAEZ,CAAA"}
\ No newline at end of file
{"version":3,"file":"getUserOrderlist.js","sourceRoot":"","sources":["../../../src/utils/package/getUserOrderlist.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA8B;AAC9B,iCAAuE;AACvE,2CAA+C;AAC/C,6CAA6D;AAEhD,QAAA,gBAAgB,GAAG,UAAO,OAAO,EAAE,cAAc,E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AAI,EAAE,CAAC,CAAC,OAAO;oCACf,KAAK,EAAE,CAAC,CAAC,KAAK;oCACd,OAAO,EAAE,CAAC,CAAC,GAAG;oCACd,GAAG,EAAE,CAAC,CAAC,QAAQ;oCACf,KAAK,EAAE,CAAC,CAAC,KAAK;oCACd,GAAG,EAAE,CAAC,CAAC,GAAG;iCACX,CAAC,CAAA;4BACJ,CAAC,CAAC,CAAA;yBACH;oBACH,CAAC,CAAC,CAAA;iBACH;gBACD,OAAO,CAAC,GAAG,CAAC,kDAAU,EAAE,SAAO,CAAC,CAAA;gBAChC,sBAAO,SAAO,EAAA;;;gBAEd,OAAO,CAAC,GAAG,CAAC,cAAI,EAAE,GAAC,CAAC,CAAA;gBACpB,sBAAO,EAAE,EAAA;;;;KAEZ,CAAA"}
\ No newline at end of file
export declare const logger: (context: Context) => void;
export declare const logFn: (context: Context) => void;
export declare const recordErrorLog: (context: Context, baseInfos: IControllerInfos, errorMsg: string, stack: string) => Promise<any>;
export declare const logger: (message: any) => void;
......@@ -36,12 +36,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.recordErrorLog = exports.logger = void 0;
exports.logger = exports.recordErrorLog = exports.logFn = void 0;
/** @format */
var sdk_1 = require("../../sdk");
var db_1 = require("../../db");
var utils_1 = require("../../utils");
exports.logger = function (context) {
exports.logFn = function (context) {
var _a, _b, _c;
var data = JSON.stringify(context.data);
console.log(context);
......@@ -78,4 +78,12 @@ exports.recordErrorLog = function (context, baseInfos, errorMsg, stack) { return
}
});
}); };
// 本地mock 增加颜色辨识度
exports.logger = function (message) {
console.log('\x1b[36m%s\x1b[0m', "-------------------\u65E5\u5FD7----------------------------");
console.log('\x1b[36m%s\x1b[0m', JSON.stringify(message, null, 2));
// @ts-nocheck no-octal-escape
console.log('\x1b[36m%s\x1b[0m', "-------------------\u65E5\u5FD7----------------------------");
// console.log(`\033[42;30m 日志 \033[40;32m ${message} \033[0m`)
};
//# sourceMappingURL=logger.js.map
\ No newline at end of file
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/package/logger.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,iCAAmC;AACnC,+BAA4C;AAC5C,qCAAsC;AAEzB,QAAA,MAAM,GAAG,UAAC,OAAgB;;IACrC,IAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACzC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACpB,OAAO,CAAC,GAAG,CACT,6BAAgB,OAAO,CAAC,MAAM,IAAI,EAAE,WAClC,mBAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,SAAS,0CAAE,OAAO,0CAAE,OAAO,KAAI,OAAO,CAAC,OAAO,kBAClD,CACf,CAAA;IACD,OAAO,CAAC,GAAG,CAAC,wCAAkB,IAAI,iBAAc,CAAC,CAAA;AACnD,CAAC,CAAA;AAED,SAAS;AACI,QAAA,cAAc,GAAG,UAC5B,OAAgB,EAChB,SAA2B,EAC3B,QAAgB,EAChB,KAAa;;;;;;gBAEL,MAAM,GAAK,OAAO,OAAZ,CAAY;gBAClB,UAAU,GAAK,CAAA,OAAO,CAAC,IAAI,IAAI,EAAE,CAAA,WAAvB,CAAuB;gBACjC,QAAQ,GAAK,SAAS,SAAd,CAAc;gBACtB,QAAQ,GAAK,CAAA,QAAQ,IAAI,EAAE,CAAA,SAAnB,CAAmB;gBAC7B,MAAM,GAAa,IAAI,aAAO,CAAC,OAAO,EAAE,sBAAiB,CAAC,CAAA;gBAC1D,YAAY,GAAW,CAAG,OAAO,CAAC,MAAM,IAAI,EAAE,WAClD,mBAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,SAAS,0CAAE,OAAO,0CAAE,OAAO,KAAI,OAAO,CAAC,OAAO,CAC9D,CAAA;gBACK,qBAAM,MAAM,CAAC,SAAS,CAAC;wBAC5B,MAAM,QAAA;wBACN,UAAU,YAAA;wBACV,QAAQ,UAAA;wBACR,UAAU,EAAE,KAAK;wBACjB,YAAY,cAAA;wBACZ,QAAQ,UAAA;wBACR,UAAU,EAAE,OAAO,CAAC,UAAU;wBAC9B,MAAM,EAAE,OAAO,CAAC,IAAI;wBACpB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;wBACtB,SAAS,EAAE,gBAAQ,EAAE;wBACrB,SAAS,EAAE,CAAC;qBACb,CAAC,EAAA;oBAZF,sBAAO,SAYL,EAAA;;;KACH,CAAA"}
\ No newline at end of file
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/package/logger.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,iCAAmC;AACnC,+BAA4C;AAC5C,qCAAsC;AAEzB,QAAA,KAAK,GAAG,UAAC,OAAgB;;IACpC,IAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACzC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACpB,OAAO,CAAC,GAAG,CACT,6BAAgB,OAAO,CAAC,MAAM,IAAI,EAAE,WAClC,mBAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,SAAS,0CAAE,OAAO,0CAAE,OAAO,KAAI,OAAO,CAAC,OAAO,kBAClD,CACf,CAAA;IACD,OAAO,CAAC,GAAG,CAAC,wCAAkB,IAAI,iBAAc,CAAC,CAAA;AACnD,CAAC,CAAA;AAED,SAAS;AACI,QAAA,cAAc,GAAG,UAC5B,OAAgB,EAChB,SAA2B,EAC3B,QAAgB,EAChB,KAAa;;;;;;gBAEL,MAAM,GAAK,OAAO,OAAZ,CAAY;gBAClB,UAAU,GAAK,CAAA,OAAO,CAAC,IAAI,IAAI,EAAE,CAAA,WAAvB,CAAuB;gBACj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": "^0.15.0",
"source-map-support": "^0.5.19",
"taobao-mini-sdk": "0.1.6"
"taobao-mini-sdk": "^0.1.6"
},
"scripts": {
"start": "npx tsc",
......@@ -23,6 +22,7 @@
"notNeedLogin": []
},
"optionalDependencies": {
"@types/lodash": "^4.14.160",
"@types/node": "^14.6.0",
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.9.1",
......
......@@ -65,6 +65,10 @@ export const BusinessError = {
code: `430006`,
defaultMsg: `今日完成该任务次数超限`
},
ERROR_AREADY_INVITE_SUCCESS: {
code: `43000&`,
defaultMsg: `已经成功邀请过`
},
ERROR_FORBIDDEN_OPE: {
code: `530001`,
defaultMsg: `非法操作`
......
/** @format */
import { CODE_TYPES } from './../constants'
import { services, paramsCheck, userCheck } from '../decorator'
import { resultsModel } from '../sdk'
......@@ -13,7 +12,11 @@ export default class AwardsController {
@userCheck({ intercept: true })
@services([AwardsService])
async getMyPrizeList(context: Context, {}, [awardSer]: [AwardsService]) {
let result = await awardSer.getMyPrizeList({ openId: context.openId, activityId: context.data.activityId })
const {
openId,
data: { activityId }
} = context
let result = await awardSer.getMyPrizeList({ openId, activityId })
return resultsModel.success(result)
}
......@@ -48,8 +51,8 @@ export default class AwardsController {
*/
@paramsCheck(['activityId', '_id'])
@userCheck({ intercept: true })
@services([AwardsService, BaseService])
async receiveEnamePrize(context: Context, {}, [awardSer, baseService]: [AwardsService, BaseService]) {
@services([AwardsService])
async receiveEnamePrize(context: Context, {}, [awardSer]: [AwardsService]) {
let { _id, activityId } = context.data
let result = await awardSer.recieveEnamePrize(_id, activityId)
......
......@@ -6,7 +6,7 @@ import { services } from '../decorator/services'
import { resultsModel } from '../sdk'
import { getToday, getUserOrderlist } from '../utils'
import { UserService, BaseService, AccessService } from '../service'
import { UserService, BaseService, AccessService, TaskService } from '../service'
// {
// "handler": "doFollowTask",
......@@ -20,11 +20,11 @@ export default class Share {
*/
@paramsCheck(['activityId', 'inviteId'])
@activityTimeCheck
@services([UserService, BaseService, AccessService])
@services([UserService, TaskService, AccessService])
async insertShareRecord(
context: Context,
{ userInfo, vipInfo, activityInfo }: IControllerInfos,
[userService, baseService, accessService]: [UserService, BaseService, AccessService]
[userService, taskService, accessService]: [UserService, TaskService, AccessService]
) {
const { activityId, inviteId } = context.data
const { openId } = context
......@@ -33,13 +33,20 @@ export default class Share {
// inviteId的用户信息查询不到, 则inviteId无效
if (!inviteUserInfo) return resultsModel.error(CODE_TYPES.ERROR_INVALID_INVITE_ID)
const isFirstLogin: boolean = (await accessService.getAccessCount()) === 1
const inviteCompleteList = taskService.getCompleteTaskByUserTaskInfo('invites', inviteUserInfo)
// // 新会员
// const isNewVip = userService.checkNewVipStatus(userInfo, vipInfo)
// 邀请成功列表有该用户信息
if (inviteCompleteList.some(v => v.openId === openId)) {
return resultsModel.error(CODE_TYPES.ERROR_AREADY_INVITE_SUCCESS)
}
// const isFirstLogin: boolean = (await accessService.getAccessCount()) === 1
// 新会员
const isNewVip = userService.checkNewVipStatus(userInfo, vipInfo)
// 满足邀请标准的条件, 根据需求变化
const isValidShare = [isFirstLogin].every(v => !!v)
const isValidShare = [isNewVip].every(v => !!v)
// 获取活动基本信息
const { tasks } = activityInfo
......
......@@ -4,7 +4,7 @@ import { CODE_TYPES, TASK_RATE_TYPE } from './../constants'
import { paramsCheck, userCheck, activityTimeCheck, noCatch, services } from '../decorator'
import { getConfig } from '../config'
import { resultsModel, TBAPIS } from '../sdk'
import { getToday, getUserOrderlist } from '../utils'
import { getToday, getUserOrderlist, logger } from '../utils'
import { UserService, BaseService, TaskService } from '../service'
// {
......@@ -45,15 +45,15 @@ export default class Task {
// 关注店铺
const followTask = taskService.initFollowTask(updatedUserInfo, tasks)
// // 下单任务
// 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)
return resultsModel.success([vipTask, followTask])
return resultsModel.success([vipTask, followTask, orderGoodsTask, browseGoodsTask, invitesTask])
}
/**
......@@ -82,15 +82,13 @@ export default class Task {
@paramsCheck(['activityId', 'credits'])
@userCheck({ intercept: true })
@activityTimeCheck
@services([UserService, TaskService])
@services([TaskService])
async doExchangeCreditsTask(
context: Context,
{ userInfo, activityInfo, session }: IControllerInfos,
[userService, taskService]: [UserService, TaskService]
[taskService]: [TaskService]
) {
const { openId } = context
const { credits } = context.data
const { _id, taskInfo = {} } = userInfo
const taskType = `exchangeCredits`
const {
tasks: {
......@@ -98,7 +96,6 @@ export default class Task {
}
} = activityInfo
const today = getToday()
const { todayCompleteTimes } = taskService.getTodayCompleteTask(taskType, userInfo)
// 如果每日限制次数并到达了限制次数
......@@ -149,8 +146,6 @@ export default class Task {
}
} = activityInfo
// const { CALL_BACK_URL } = getConfig(context)
const itemIdArray: number[] = Array.isArray(itemIds) ? itemIds : itemIds.split(',').map(v => +v)
// B端配置商品ids不匹配正确
......@@ -178,4 +173,40 @@ export default class Task {
return resultsModel.success(true)
}
/**
* 领取任务奖励
*/
@paramsCheck(['activityId', 'taskType'])
@userCheck({ intercept: true })
@activityTimeCheck
@services([TaskService])
async receiveTaskRewards(
context: Context,
{ userInfo }: IControllerInfos,
[taskService]: [TaskService]
): Promise<Result> {
const { taskType } = context.data
const { remainTimes, _id } = userInfo
// 暂无领取次数
if (!remainTimes?.[taskType]) return resultsModel.error(CODE_TYPES.ERROR_TASK_NORECEIVE)
const waitReceiveTimes = remainTimes?.[taskType]
// 根据需求自定义领取任务增加的key值 如: gameTimes
const awardsTargetKey = `gameTimes`
await taskService.updateUser(_id, {
$set: {
[`remainTimes.${taskType}`]: 0
},
$inc: {
[awardsTargetKey]: waitReceiveTimes
}
})
return resultsModel.success(true)
}
}
......@@ -40,7 +40,7 @@ export default class User {
if (!userInfo) {
await userService.initUserData(vipInfo, activityInfo)
} else {
await userService.updateUserData(vipInfo, userInfo)
await userService.updateUserData(vipInfo, userInfo, activityInfo)
}
// access表
......
/** @format */
import { UserService } from '../service'
import { getSellerSession, logger, recordErrorLog } from '../utils'
import { getSellerSession, logFn, recordErrorLog } from '../utils'
import { resultsModel } from '../sdk'
import { CODE_TYPES } from '../constants'
async function initBaseInfo(context: Context, baseInfos: IControllerInfos) {
......@@ -39,7 +39,7 @@ export const services = (services: any[]) => {
}
let ret: Result
try {
logger(context)
logFn(context)
ret = await method.apply(target, [context, baseInfos, servicesInstance])
} catch (error) {
console.log('error', error)
......
This diff is collapsed.
......@@ -129,34 +129,43 @@ class UserService extends BaseService {
return await this.userdao.insertOne(user)
}
async updateUserData(vipInfo: IVipInfo, userInfo: IUserInfo) {
async updateUserData(vipInfo: IVipInfo, userInfo: IUserInfo, activityInfo: IActivityInfo) {
const { data } = this.context
const { isFollow } = data
const today = getToday()
let projection = {
$set: {},
$push: {},
$inc: {
[`login.${today}`]: 1
}
}
const { tasks } = activityInfo
const { attentionStore, beMembership } = tasks
// 老用户
// 之前进入活动未关注,现在进入关注,则视为新关注店铺用户
const followBefore = userInfo.follow.flag
const followNow = isFollow
if (!followBefore && followNow && !userInfo.follow.newFollow) {
userInfo.follow = this.setNewFollowUserData(userInfo.follow)
// @ts-ignore
projection.$set.follow = this.setNewFollowUserData(userInfo.follow)
projection.$push[`taskInfo.${today}.follow`] = { createTime: Date.now() }
projection.$inc[`remainTimes.follow`] = attentionStore.value
}
const today = getToday()
// 之前进入活动非会员,现在进入会员,则视为新会员用户
const isNewVip = this.checkNewVipStatus(userInfo, vipInfo)
if (isNewVip && !userInfo.member.newMember) {
userInfo.member = this.setNewVipUserData(userInfo.member)
// @ts-ignore
projection.$set.member = this.setNewVipUserData(userInfo.member)
projection.$push[`taskInfo.${today}.member`] = { createTime: Date.now() }
projection.$inc[`remainTimes.member`] = beMembership.value
}
await this.updateUser(userInfo._id, {
$set: {
follow: userInfo.follow,
member: userInfo.member
},
$inc: {
[`login.${today}`]: 1
}
})
await this.updateUser(userInfo._id, projection)
}
/**
......
......@@ -43,7 +43,8 @@ export const getUserOrderlist = async (context, queryStartTime, queryEndTime?, s
price: s.price,
orderId: s.oid,
img: s.pic_path,
title: s.title
title: s.title,
tId: i.tid
})
})
}
......
......@@ -3,7 +3,7 @@ import { BaseDao } from '../../sdk'
import { ERROR_LOG_DB_NAME } from '../../db'
import { getToday } from '../../utils'
export const logger = (context: Context) => {
export const logFn = (context: Context) => {
const data = JSON.stringify(context.data)
console.log(context)
console.log(
......@@ -43,3 +43,13 @@ export const recordErrorLog = async (
catchType: 1
})
}
// 本地mock 增加颜色辨识度
export const logger = (message: any) => {
console.log('\x1b[36m%s\x1b[0m', `-------------------日志----------------------------`)
console.log('\x1b[36m%s\x1b[0m', JSON.stringify(message, null, 2))
// @ts-nocheck no-octal-escape
console.log('\x1b[36m%s\x1b[0m', `-------------------日志----------------------------`)
// console.log(`\033[42;30m 日志 \033[40;32m ${message} \033[0m`)
}
......@@ -23,6 +23,13 @@
chalk "^2.0.0"
js-tokens "^4.0.0"
"@types/bson@*":
version "4.0.2"
resolved "https://registry.npm.taobao.org/@types/bson/download/@types/bson-4.0.2.tgz?cache=0&sync_timestamp=1596838007251&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fbson%2Fdownload%2F%40types%2Fbson-4.0.2.tgz#7accb85942fc39bbdb7515d4de437c04f698115f"
integrity sha1-esy4WUL8ObvbdRXU3kN8BPaYEV8=
dependencies:
"@types/node" "*"
"@types/color-name@^1.1.1":
version "1.1.1"
resolved "https://registry.npm.taobao.org/@types/color-name/download/@types/color-name-1.1.1.tgz?cache=0&sync_timestamp=1596837707987&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fcolor-name%2Fdownload%2F%40types%2Fcolor-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
......@@ -43,7 +50,15 @@
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/mongodb@^3.5.26":
version "3.5.26"
resolved "https://registry.npm.taobao.org/@types/mongodb/download/@types/mongodb-3.5.26.tgz?cache=0&sync_timestamp=1597563376772&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fmongodb%2Fdownload%2F%40types%2Fmongodb-3.5.26.tgz#aa10315925ba10cdc7931ef280c0ff6f54fd37f3"
integrity sha1-qhAxWSW6EM3Hkx7ygMD/b1T9N/M=
dependencies:
"@types/bson" "*"
"@types/node" "*"
"@types/node@*", "@types/node@^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"
integrity sha1-fUQRv1FXM5M318/4ZNn/RfF3tJk=
......
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