Commit 1957215c authored by qinhaitao's avatar qinhaitao

refactor: 💡 收藏列表接口

parent 40a581ee
...@@ -33,7 +33,7 @@ export default class Task { ...@@ -33,7 +33,7 @@ export default class Task {
/** /**
* 获取收藏商品列表 * 获取收藏商品列表
*/ */
getCollectGoodsList(context: IContext<IParams>, { session, userInfo }: IControllerInfos, [baseService]: [BaseService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<{ getCollectGoodsList(context: IContext<IParams>, { session, userInfo }: IControllerInfos, [baseService, taskService]: [BaseService, TaskService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<{
collected: boolean; collected: boolean;
itemId: string; itemId: string;
name: string; name: string;
......
"use strict"; "use strict";
/** @format */ /** @format */
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
...@@ -62,7 +51,6 @@ var common_1 = require("../decorator/common"); ...@@ -62,7 +51,6 @@ var common_1 = require("../decorator/common");
var sdk_1 = require("../sdk"); var sdk_1 = require("../sdk");
var service_1 = require("../service"); var service_1 = require("../service");
var check_1 = require("../utils/common/check/"); var check_1 = require("../utils/common/check/");
var task_1 = require("../utils/common/task");
var common_2 = require("../decorator/common"); var common_2 = require("../decorator/common");
var update_1 = require("../utils/common/update"); var update_1 = require("../utils/common/update");
var Task = /** @class */ (function () { var Task = /** @class */ (function () {
...@@ -141,9 +129,9 @@ var Task = /** @class */ (function () { ...@@ -141,9 +129,9 @@ var Task = /** @class */ (function () {
*/ */
Task.prototype.getCollectGoodsList = function (context, _a, _b) { Task.prototype.getCollectGoodsList = function (context, _a, _b) {
var session = _a.session, userInfo = _a.userInfo; var session = _a.session, userInfo = _a.userInfo;
var baseService = _b[0]; var baseService = _b[0], taskService = _b[1];
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var itemIds, list, taskInfo, listWithCollectStatus; var itemIds, list, listWithCollectStatus;
return __generator(this, function (_c) { return __generator(this, function (_c) {
switch (_c.label) { switch (_c.label) {
case 0: case 0:
...@@ -151,12 +139,7 @@ var Task = /** @class */ (function () { ...@@ -151,12 +139,7 @@ var Task = /** @class */ (function () {
return [4 /*yield*/, baseService.getItemListByIds(itemIds, session)]; return [4 /*yield*/, baseService.getItemListByIds(itemIds, session)];
case 1: case 1:
list = _c.sent(); list = _c.sent();
taskInfo = task_1.getTotalCompleteTask('collectGoods', userInfo).taskInfo; listWithCollectStatus = taskService.getItemListWithCollectStatus(list, userInfo);
listWithCollectStatus = list.map(function (v) {
return __assign(__assign({}, v), {
// 完成列表是否含有itemId
collected: taskInfo.some(function (completeItem) { return completeItem.itemId === v.itemId; }) });
});
return [2 /*return*/, sdk_1.resultsModel.success(listWithCollectStatus)]; return [2 /*return*/, sdk_1.resultsModel.success(listWithCollectStatus)];
} }
}); });
...@@ -192,7 +175,7 @@ var Task = /** @class */ (function () { ...@@ -192,7 +175,7 @@ var Task = /** @class */ (function () {
__decorate([ __decorate([
common_1.checkParams(['activityId', 'itemIds']), common_1.checkParams(['activityId', 'itemIds']),
common_1.registeInfos(['session']), common_1.registeInfos(['session']),
common_1.services([service_1.BaseService]), common_1.services([service_1.BaseService, service_1.TaskService]),
__metadata("design:type", Function), __metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]), __metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise) __metadata("design:returntype", Promise)
......
{"version":3,"file":"task.controller.js","sourceRoot":"","sources":["../../src/controller/task.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2C;AAC3C,8CAAmF;AACnF,8BAAqC;AACrC,sCAAqD;AAErD,gDAAsH;AACtH,6CAA2D;AAC3D,8CAA+C;AAC/C,iDAAkE;AAElE;IAAA;IA0GA,CAAC;IAzGC;;OAEG;IAMG,0BAAW,GAAjB,UACE,OAAyC,EACzC,EAA4C,EAC5C,EAA4B;YAD1B,QAAQ,cAAA,EAAE,YAAY,kBAAA;YACvB,WAAW,QAAA;;;gBAEZ,sBAAO,kBAAY,CAAC,OAAO,CAAC;wBAC1B,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC;wBAC9D,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC;wBAC9D,8DAA8D;wBAC9D,sEAAsE;wBACtE,uEAAuE;wBACvE,wEAAwE;wBACxE,oEAAoE;wBACpE,kEAAkE;wBAClE,0EAA0E;qBAC3E,CAAC,EAAA;;;KACH;IAED;;;;;OAKG;IAKG,6BAAc,GAApB,UACE,OAKE,EACF,EAA4C,EAC5C,EAA4B;YAD1B,QAAQ,cAAA,EAAE,YAAY,kBAAA;YACvB,WAAW,QAAA;;;;;;wBAEN,KAAuB,OAAO,CAAC,IAAI,EAAjC,QAAQ,cAAA,EAAE,MAAM,YAAA,CAAiB;wBAG1B,qBAAM,WAAW,CAAC,YAAY,CAAC,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,EAAA;;wBAArF,MAAM,GAAG,SAA4E;wBAE3F,sBAAO,MAAM,CAAC,CAAC,CA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CAAC;QACvB,iBAAQ,CAAC,CAAC,yBAAiB,EAAE,wBAAgB,CAAC,CAAC;;;;kDAkB/C;IAQD;QAHC,oBAAW,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACtC,qBAAY,CAAC,CAAC,SAAS,CAAC,CAAC;QACzB,iBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,CAAC,CAAC;;;;mDAYpC;IACH,WAAC;CAAA,AAlGD,IAkGC;kBAlGoB,IAAI"}
\ No newline at end of file \ No newline at end of file
...@@ -27,12 +27,12 @@ declare const _default: { ...@@ -27,12 +27,12 @@ declare const _default: {
list: IAwards[]; list: IAwards[];
}>>; }>>;
receiveObjectPrize: (context: IContext<import("./controller/awards.controller").IReceiveOjectParams>, { activityInfo }: import("./controller/awards.controller").IReceivePrizeControllerInfos, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<boolean>>; receiveObjectPrize: (context: IContext<import("./controller/awards.controller").IReceiveOjectParams>, { activityInfo }: import("./controller/awards.controller").IReceivePrizeControllerInfos, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<boolean>>;
receiveEnamePrize: (context: IContext<import("./controller/awards.controller").IReceiveEnameParams>, { awardInfo, session }: import("./controller/awards.controller").IReceivePrizeControllerInfos, [awardSer]: [import("./service").AwardsService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | number[] | object[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<import("taobao-mini-sdk/lib/utils/codetypes").CodeType | IAwards, true>>; receiveEnamePrize: (context: IContext<import("./controller/awards.controller").IReceiveEnameParams>, { awardInfo, session }: import("./controller/awards.controller").IReceivePrizeControllerInfos, [awardSer]: [import("./service").AwardsService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<import("taobao-mini-sdk/lib/utils/codetypes").CodeType | IAwards, true>>;
doHelp: (context: IContext<{ doHelp: (context: IContext<{
activityId: string; activityId: string;
inviteId: string; inviteId: string;
}>, { userInfo, activityInfo, inviteUserInfo }: import("./controller/share.controller").IdoHelpInfos, [taskService, statService]: [import("./service").TaskService, import("./service").StatService]) => Promise<IResult<boolean>>; }>, { userInfo, activityInfo, inviteUserInfo }: import("./controller/share.controller").IdoHelpInfos, [taskService, statService]: [import("./service").TaskService, import("./service").StatService]) => Promise<IResult<boolean>>;
getStats: (context: IContext<import("./controller/stat.controller").IGetStatsParams>) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | number[] | object[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any, true>>; getStats: (context: IContext<import("./controller/stat.controller").IGetStatsParams>) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any, true>>;
addStat: (context: IContext<import("./controller/stat.controller").IAddStatsParams>, { userInfo }: IControllerInfos, [statService]: [import("./service").StatService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<boolean, true>>; addStat: (context: IContext<import("./controller/stat.controller").IAddStatsParams>, { userInfo }: IControllerInfos, [statService]: [import("./service").StatService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<boolean, true>>;
getRankList: (context: IContext<{ getRankList: (context: IContext<{
activityId: string; activityId: string;
......
...@@ -53,4 +53,13 @@ export default class TaskService extends UserService { ...@@ -53,4 +53,13 @@ export default class TaskService extends UserService {
*/ */
completeTask(taskType: ITaskType, activityInfo: IActivityInfo, userInfo: IUserInfo, customRecord?: object): Promise<number>; completeTask(taskType: ITaskType, activityInfo: IActivityInfo, userInfo: IUserInfo, customRecord?: object): Promise<number>;
updateOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks, activityStartTime: number, session?: string): Promise<{}>; updateOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks, activityStartTime: number, session?: string): Promise<{}>;
getItemListWithCollectStatus(list: ITaoBaoItems[], userInfo: IUserInfo): {
collected: boolean;
itemId: string;
name: string;
price: string;
url: string;
image: string;
desc: string;
}[];
} }
...@@ -230,6 +230,14 @@ var TaskService = /** @class */ (function (_super) { ...@@ -230,6 +230,14 @@ var TaskService = /** @class */ (function (_super) {
}); });
}); });
}; };
TaskService.prototype.getItemListWithCollectStatus = function (list, userInfo) {
var taskInfo = task_1.getTotalCompleteTask('collectGoods', userInfo).taskInfo;
return list.map(function (v) {
return __assign(__assign({}, v), {
// 完成列表是否含有itemId
collected: taskInfo.some(function (completeItem) { return completeItem.itemId === v.itemId; }) });
});
};
return TaskService; return TaskService;
}(user_service_1.default)); }(user_service_1.default));
exports.default = TaskService; exports.default = TaskService;
......
{"version":3,"file":"task.service.js","sourceRoot":"","sources":["../../src/service/task.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,+CAAwC;AACxC,kCAUiB;AACjB,0CAA0D;AAC1D,6CAAgG;AAehG;IAAyC,+BAAW;IAClD,qBAAY,OAA0B;eACpC,kBAAM,OAAO,CAAC;IAChB,CAAC;IACD;;;;;;;;;OASG;IACH,8BAAQ,GAAR,UAAS,QAAmB,EAAE,KAAa,EAAE,YAA2B,EAAE,QAAmB;;QACrF,IAAA,KAA8D,OAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,KAAK,0CAAG,QAAQ,MAAK,EAAE,EAAjG,KAAK,WAAA,EAAE,eAAY,EAAZ,OAAO,mBAAG,EAAE,KAAA,EAAE,YAAY,kBAAA,EAAE,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAA,EAAE,YAAS,EAAT,IAAI,mBAAG,EAAE,KAA0C,CAAA;QACjG,IAAA,WAAW,GAAK,QAAQ,YAAb,CAAa;QACxB,IAAA,kBAAkB,GAAK,2BAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,mBAA7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,CAAC,AA/JD,CAAyC,sBAAW,GA+JnD"}
\ No newline at end of file \ No newline at end of file
...@@ -95,24 +95,16 @@ export default class Task { ...@@ -95,24 +95,16 @@ export default class Task {
*/ */
@checkParams(['activityId', 'itemIds']) @checkParams(['activityId', 'itemIds'])
@registeInfos(['session']) @registeInfos(['session'])
@services([BaseService]) @services([BaseService, TaskService])
async getCollectGoodsList( async getCollectGoodsList(
context: IContext<IParams>, context: IContext<IParams>,
{ session, userInfo }: IControllerInfos, { session, userInfo }: IControllerInfos,
[baseService]: [BaseService] [baseService, taskService]: [BaseService, TaskService]
) { ) {
const { itemIds } = context.data const { itemIds } = context.data
const list = await baseService.getItemListByIds(itemIds, session) const list = await baseService.getItemListByIds(itemIds, session)
const { taskInfo } = getTotalCompleteTask('collectGoods', userInfo) const listWithCollectStatus = taskService.getItemListWithCollectStatus(list, userInfo)
const listWithCollectStatus = list.map(v => {
return {
...v,
// 完成列表是否含有itemId
collected: taskInfo.some(completeItem => completeItem.itemId === v.itemId)
}
})
return resultsModel.success(listWithCollectStatus) return resultsModel.success(listWithCollectStatus)
} }
......
...@@ -180,4 +180,16 @@ export default class TaskService extends UserService { ...@@ -180,4 +180,16 @@ export default class TaskService extends UserService {
return projection return projection
} }
getItemListWithCollectStatus(list: ITaoBaoItems[], userInfo: IUserInfo) {
const { taskInfo } = getTotalCompleteTask('collectGoods', userInfo)
return list.map(v => {
return {
...v,
// 完成列表是否含有itemId
collected: taskInfo.some(completeItem => completeItem.itemId === v.itemId)
}
})
}
} }
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