Commit 46d532cb authored by qinhaitao's avatar qinhaitao

feat: 🎸 增加排名

parent 6b9ac21a
......@@ -56,8 +56,7 @@ export declare const SHIP_STATUS: {
HAS_SHIP: number;
};
export declare enum STAT_TYPE {
CLICK_INVITE = 1,
CLICK_FOLLOW_TASK = 2
INITE_SUCCESS = 0
}
export declare const appId = "${\u9700\u8981\u8865\u5145}";
export declare const sellerId = "${\u5546\u94FAid}";
......
......@@ -86,8 +86,7 @@ exports.SHIP_STATUS = {
// 记录数据
var STAT_TYPE;
(function (STAT_TYPE) {
STAT_TYPE[STAT_TYPE["CLICK_INVITE"] = 1] = "CLICK_INVITE";
STAT_TYPE[STAT_TYPE["CLICK_FOLLOW_TASK"] = 2] = "CLICK_FOLLOW_TASK";
STAT_TYPE[STAT_TYPE["INITE_SUCCESS"] = 0] = "INITE_SUCCESS";
})(STAT_TYPE = exports.STAT_TYPE || (exports.STAT_TYPE = {}));
exports.appId = '${需要补充}';
// 商铺id 拼接vip链接用
......
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;AAEd,8CAA2B;AAE3B,cAAc;AACD,QAAA,OAAO,GAAG;IACrB,6CAA6C,EAAE,kBAAkB;IACjE,yBAAyB,EAAE,iBAAiB;IAC5C,oBAAoB,EAAE,aAAa;IACnC,sCAAsC,EAAE,gBAAgB;IACxD,iBAAiB,EAAE,cAAc;IACjC,YAAY,EAAE,YAAY;IAC1B,iBAAiB,EAAE,iBAAiB;CACrC,CAAA;AAED,SAAS;AACI,QAAA,WAAW,GAAG;IACzB,MAAM;IACN,SAAS,EAAE,CAAC;IACZ,MAAM;IACN,UAAU,EAAE,CAAC;IACb,OAAO;IACP,OAAO,EAAE,CAAC;IACV,OAAO;IACP,IAAI,EAAE,CAAC;IACP,MAAM;IACN,OAAO,EAAE,CAAC;IACV,OAAO;IACP,KAAK,EAAE,CAAC;CACT,CAAA;AAED,OAAO;AACM,QAAA,2BAA2B,GAAa;IACnD,wBAAwB;IACxB,uBAAuB;IACvB,0BAA0B;IAC1B,oBAAoB;IACpB,gBAAgB;IAChB,qBAAqB;CACtB,CAAA;AAcD,UAAU;AACG,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,CAAC;CACX,CAAA;AAED,MAAM;AACO,QAAA,WAAW,GAAG;IACzB,OAAO,EAAE,CAAC;IACV,YAAY,EAAE,CAAC;IACf,IAAI,EAAE,CAAC,CAAC,MAAM;CACf,CAAA;AAED,OAAO;AACM,QAAA,UAAU,GAAG;IACxB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACV,CAAA;AAED,OAAO;AACM,QAAA,eAAe,GAAG;IAC7B,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,CAAC,CAAC,KAAK;CACrB,CAAA;AAED,WAAW;AACX,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,6CAAS,CAAA;IACT,mDAAY,CAAA;AACd,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB;AAED,MAAM;AACO,QAAA,WAAW,GAAG;IACzB,UAAU,EAAE,CAAC;IACb,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,CAAC;CACZ,CAAA;AAED,OAAO;AACP,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,yDAAgB,CAAA;IAChB,mEAAiB,CAAA;AACnB,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB;AAEY,QAAA,KAAK,GAAG,SAAS,CAAA;AAE9B,gBAAgB;AACH,QAAA,QAAQ,GAAG,SAAS,CAAA;AAEjC,cAAc;AACD,QAAA,UAAU,GAAW,qBAAmB,aAAO,CAAA"}
\ No newline at end of file
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;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HW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB;AAED,MAAM;AACO,QAAA,WAAW,GAAG;IACzB,UAAU,EAAE,CAAC;IACb,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,CAAC;CACZ,CAAA;AAED,OAAO;AACP,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,2DAAa,CAAA;AACf,CAAC,EAFW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEpB;AAEY,QAAA,KAAK,GAAG,SAAS,CAAA;AAE9B,gBAAgB;AACH,QAAA,QAAQ,GAAG,SAAS,CAAA;AAEjC,cAAc;AACD,QAAA,UAAU,GAAW,qBAAmB,aAAO,CAAA"}
\ No newline at end of file
/** @format */
import { UserService, TaskService } from '../service';
import { UserService, AccessService, TaskService, StatService } from '../service';
export default class Share {
/**
* 获取邀请信息
......@@ -15,5 +15,5 @@ export default class Share {
doHelp(context: IContext<{
activityId: string;
inviteId: string;
}>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, taskService]: [UserService, TaskService]): Promise<IResult<boolean>>;
}>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, taskService, statService]: [UserService, TaskService, StatService, AccessService]): Promise<IResult<boolean>>;
}
......@@ -53,6 +53,7 @@ var sdk_1 = require("../sdk");
var utils_1 = require("../utils");
var service_1 = require("../service");
var registeInfos_1 = require("../decorator/registeInfos");
var constants_2 = require("../constants");
var Share = /** @class */ (function () {
function Share() {
}
......@@ -76,14 +77,14 @@ var Share = /** @class */ (function () {
*/
Share.prototype.doHelp = function (context, _a, _b) {
var userInfo = _a.userInfo, vipInfo = _a.vipInfo, activityInfo = _a.activityInfo;
var userService = _b[0], taskService = _b[1];
var userService = _b[0], taskService = _b[1], statService = _b[2];
return __awaiter(this, void 0, void 0, function () {
var inviteId, openId, inviteUserInfo, taskInfo, tasks, value, isNewVip, isValidShare, today, inviteUserId;
var _c;
return __generator(this, function (_d) {
switch (_d.label) {
var _c, inviteId, activityId, openId, inviteUserInfo, userInviteSuccessCount, tasks, value, isNewVip, isValidShare, today, inviteUserId;
var _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
inviteId = context.data.inviteId;
_c = context.data, inviteId = _c.inviteId, activityId = _c.activityId;
openId = context.openId;
if (openId === inviteId)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_NO_INVITE_SELF)];
......@@ -91,52 +92,66 @@ var Share = /** @class */ (function () {
// inviteId的用户信息查询不到, 则inviteId无效
];
case 1:
inviteUserInfo = _d.sent();
inviteUserInfo = _e.sent();
// inviteId的用户信息查询不到, 则inviteId无效
if (!inviteUserInfo)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_INVALID_INVITE_ID)];
taskInfo = taskService.getCompleteTaskByUserTaskInfo('invites', inviteUserInfo).taskInfo;
// 邀请成功列表有该用户信息
if (taskInfo.some(function (v) { return v.openId === openId; })) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_AREADY_INVITE_SUCCESS)];
}
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_INVALID_INVITE_ID)
// 邀请成功有该用户信息
];
return [4 /*yield*/, statService.getStatCountByquery({
activityId: activityId,
openId: openId,
type: constants_2.STAT_TYPE.INITE_SUCCESS
})];
case 2:
userInviteSuccessCount = _e.sent();
if (userInviteSuccessCount)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_AREADY_INVITE_SUCCESS)
// 获取活动基本信息
];
tasks = activityInfo.tasks;
value = tasks.invites.value;
isNewVip = userService.checkNewVip(userInfo, vipInfo);
if (!(isNewVip && !userInfo.member.newMember)) return [3 /*break*/, 3];
isNewVip = utils_1.checkNewVip(userInfo, vipInfo);
if (!(isNewVip && !userInfo.member.newMember)) return [3 /*break*/, 4];
return [4 /*yield*/, userService.updateUser(userInfo._id, {
$set: {
member: userService.setNewVipUserData(userInfo.member)
member: utils_1.setNewVipUserData(userInfo.member)
}
})];
case 2:
_d.sent();
_d.label = 3;
case 3:
_e.sent();
_e.label = 4;
case 4:
isValidShare = [isNewVip].every(function (v) { return !!v; });
today = utils_1.getToday();
if (!isValidShare) return [3 /*break*/, 5];
if (!isValidShare)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_INVITE)
// 成功邀请
];
inviteUserId = inviteUserInfo._id;
// 增加邀请人的待领取次数和邀请记录
return [4 /*yield*/, userService.updateUser(inviteUserId, {
$inc: {
'remainTimes.invites': value
},
$push: (_c = {},
_c["taskInfo." + today + ".invites"] = { openId: openId, createTime: Date.now() },
_c)
$push: (_d = {},
_d["taskInfo." + today + ".invites"] = { openId: openId, createTime: Date.now() },
_d)
})];
case 4:
case 5:
// 增加邀请人的待领取次数和邀请记录
_d.sent();
_d.label = 5;
case 5: return [2 /*return*/, sdk_1.resultsModel.success(true)];
_e.sent();
return [4 /*yield*/, statService.addStat(constants_2.STAT_TYPE.INITE_SUCCESS, userInfo)];
case 6:
_e.sent();
return [2 /*return*/, sdk_1.resultsModel.success(true)];
}
});
});
};
__decorate([
check_1.paramsCheck(['activityId']),
check_1.userCheck({ intercept: true }),
registeInfos_1.registeInfos(['userInfo', 'activityInfo']),
services_1.services([service_1.UserService]),
__metadata("design:type", Function),
......@@ -146,8 +161,9 @@ var Share = /** @class */ (function () {
__decorate([
check_1.paramsCheck(['activityId', 'inviteId']),
check_1.activityTimeCheck,
check_1.userCheck({ intercept: true }),
registeInfos_1.registeInfos(['userInfo', 'vipInfo', 'activityInfo']),
services_1.services([service_1.UserService, service_1.TaskService, service_1.AccessService]),
services_1.services([service_1.UserService, service_1.TaskService, service_1.StatService, 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;;;;;;;;;;;;;;;;;;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CAkBvB;IAQD;QAJC,mBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACvC,yBAAiB;QACjB,2BAAY,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QACrD,mBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;uCA8DnD;IACH,YAAC;CAAA,AA9FD,IA8FC;kBA9FoB,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,kCAAmE;AACnE,sCAAiF;AACjF,0DAAwD;AACxD,0CAAwC;AAExC;IAAA;IAqGA,CAAC;IApGC;;OAEG;IAKG,4BAAY,GAAlB,UACE,OAEE,EACF,EAA8B;YAA5B,QAAQ,cAAA;;;;gBAOO,OAAO,GACpB,QAAQ,oBADY,CACZ;gBAEZ,sBAAO,kBAAY,CAAC,OAAO,CAAC;wBAC1B,OAAO,EAAE,OAAO;qBACjB,CAAC,EAAA;;;KACH;IACD;;OAEG;IAMG,sBAAM,GAAZ,UACE,OAGE,EACF,EAAqD,EACrD,EAA+F;YAD7F,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA;YAChC,WAAW,QAAA,EAAE,WAAW,QAAA,EAAE,WAAW,QAAA;;;;;;;wBAEhC,KAA2B,OAAO,CAAC,IAAI,EAArC,QAAQ,cAAA,EAAE,UAAU,gBAAA,CAAiB;wBACrC,MAAM,GAAK,OAAO,OAAZ,CAAY;wBAE1B,IAAI,MAAM,KAAK,QAAQ;4BAAE,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,oBAAoB,CAAC,EAAA;wBAEjD,qBAAM,WAAW,CAAC,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C,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;wBAEF,qBAAM,WAAW,CAAC,OAAO,CAAC,qBAAS,CAAC,aAAa,EAAE,QAAQ,CAAC,EAAA;;wBAA5D,SAA4D,CAAA;wBAE5D,sBAAO,kBAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAA;;;;KAClC;IA5FD;QAJC,mBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,iBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,2BAAY,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC1C,mBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;6CAkBvB;IASD;QALC,mBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACvC,yBAAiB;QACjB,iBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,2BAAY,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QACrD,mBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,EAAE,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;uCAmEhE;IACH,YAAC;CAAA,AArGD,IAqGC;kBArGoB,KAAK"}
\ No newline at end of file
......@@ -23,4 +23,33 @@ export default class User {
* 获取会员信息
*/
getVipInfo(context: IContext<IVipParams>, { session, activityUserNick }: IControllerInfos): Promise<IResult<IVipInfo>>;
/**
* 获取排行榜
*/
getRankList(context: IContext<{
activityId: string;
}>, { userInfo }: IControllerInfos, [userService]: [UserService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<{
userNick: string;
avatar: string;
rank: number;
score: any;
list: {
userNick: string;
rank: number;
_id?: string;
id?: string;
activityId: string;
avatar: string;
openId: string;
createTime: number;
updateTime: number;
createDay?: string;
inviteId?: string;
member?: IMemberInfo;
follow?: IFollowInfo;
remainTimes?: IRemainTimesInfo;
taskInfo?: object;
login?: object;
}[];
}, true>>;
}
......@@ -106,6 +106,37 @@ var User = /** @class */ (function () {
});
});
};
/**
* 获取排行榜
*/
User.prototype.getRankList = function (context, _a, _b) {
var userInfo = _a.userInfo;
var userService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var sortKey, sortTime, userNick, avatar, rank, list;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
sortKey = 'score';
sortTime = 'updateScoreTime';
userNick = userInfo.userNick, avatar = userInfo.avatar;
return [4 /*yield*/, userService.getMyRank(sortKey, sortTime, userInfo[sortKey])];
case 1:
rank = _c.sent();
return [4 /*yield*/, userService.getRank(sortKey, sortTime, 200)];
case 2:
list = _c.sent();
return [2 /*return*/, sdk_1.resultsModel.success({
userNick: userNick,
avatar: avatar,
rank: rank,
score: userInfo[sortKey],
list: list
})];
}
});
});
};
__decorate([
decorator_1.paramsCheck(['activityId', 'userNick', 'avatar', 'isFollow']),
decorator_1.activityTimeCheck,
......@@ -123,6 +154,14 @@ var User = /** @class */ (function () {
__metadata("design:paramtypes", [Object, Object]),
__metadata("design:returntype", Promise)
], User.prototype, "getVipInfo", null);
__decorate([
decorator_1.paramsCheck(['activityId']),
decorator_1.userCheck({ intercept: true }),
decorator_1.services([service_1.UserService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], User.prototype, "getRankList", null);
return User;
}());
exports.default = User;
......
{"version":3,"file":"user.controller.js","sourceRoot":"","sources":["../../src/controller/user.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AiB;QACjB,wBAAY,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QACrD,oBAAQ,CAAC,CAAC,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;qCAoBtC;IAOD;QAHC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,wBAAY,CAAC,CAAC,SAAS,CAAC,CAAC;QACzB,oBAAQ,CAAC,EAAE,CAAC;;;;0CAUZ;IACH,WAAC;CAAA,AA5CD,IA4CC;kBA5CoB,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,0CAAgG;AAChG,8BAAqC;AACrC,sCAAuD;AACvD,4CAAiE;AAcjE;IAAA;IA2EA,CAAC;IA1EC;;OAEG;IAKG,oBAAK,GAAX,UACE,OAA+B,EAC/B,EAAqD,EACrD,EAA0D;YADxD,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA;YAChC,WAAW,QAAA,EAAE,aAAa,QAAA;;;;;;wBAEnB,MAAM,GAAK,OAAO,OAAZ,CAAY;6BAEtB,CAAC,QAAQ,EAAT,wBAAS;wBACA,qBAAM,WAAW,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,EAAA;;wBAAhE,QAAQ,GAAG,SAAqD,CAAA;;4BAErD,qBAAM,WAAW,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAA;;wBAA5E,QAAQ,GAAG,SAAiE,CAAA;;;oBAG9E,UAAU;oBACV,qBAAM,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAA;;wBADvC,UAAU;wBACV,SAAuC,CAAA;wBAEvC,sBAAO,kBAAY,CAAC,OAAO,CAAC;gCAC1B,MAAM,QAAA;6BACP,CAAC,EAAA;;;;KACH;IACD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,CAAC,CAAC,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;qCAoBtC;IAOD;QAHC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,wBAAY,CAAC,CAAC,SAAS,CAAC,CAAC;QACzB,oBAAQ,CAAC,EAAE,CAAC;;;;0CAUZ;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;2CAwBvB;IACH,WAAC;CAAA,AA3ED,IA2EC;kBA3EoB,IAAI"}
\ No newline at end of file
......@@ -17,12 +17,38 @@ declare const _default: {
list: IAwards[];
}>>;
receiveObjectPrize: (context: IContext<import("./controller/awards.controller").IReceiveOjectParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<boolean>>;
receiveEnamePrize: (context: IContext<import("./controller/awards.controller").IReceiveEnameParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<import("taobao-mini-sdk/lib/utils/codetypes").CodeType | IAwards, true>>;
receiveEnamePrize: (context: IContext<import("./controller/awards.controller").IReceiveEnameParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<IAwards | import("taobao-mini-sdk/lib/utils/codetypes").CodeType, true>>;
doHelp: (context: IContext<{
activityId: string;
inviteId: string;
}>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, taskService]: [import("./service/user.service").default, import("./service").TaskService]) => Promise<IResult<boolean>>;
}>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, taskService, statService]: [import("./service/user.service").default, import("./service").TaskService, import("./service").StatService, import("./service").AccessService]) => Promise<IResult<boolean>>;
getStats: (context: IContext<import("./controller/stat.controller").IGetStatsParams>) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any, true>>;
addStat: (context: IContext<import("./controller/stat.controller").IAddStatsParams>, { userInfo }: IControllerInfos, [statService]: [import("./service").StatService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<boolean, true>>;
getRankList: (context: IContext<{
activityId: string;
}>, { userInfo }: IControllerInfos, [userService]: [import("./service/user.service").default]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<{
userNick: string;
avatar: string;
rank: number;
score: any;
list: {
userNick: string;
rank: number;
_id?: string;
id?: string;
activityId: string;
avatar: string;
openId: string;
createTime: number;
updateTime: number;
createDay?: string;
inviteId?: string;
member?: IMemberInfo;
follow?: IFollowInfo;
remainTimes?: IRemainTimesInfo;
taskInfo?: object;
login?: object;
}[];
}, true>>;
};
export default _default;
......@@ -8,7 +8,7 @@ var base_controller_1 = require("./controller/base.controller");
var awards_controller_1 = require("./controller/awards.controller");
var share_controller_1 = require("./controller/share.controller");
var stat_controller_1 = require("./controller/stat.controller");
var _a = new user_controller_1.default(), login = _a.login, getVipInfo = _a.getVipInfo;
var _a = new user_controller_1.default(), login = _a.login, getVipInfo = _a.getVipInfo, getRankList = _a.getRankList;
var _b = new task_controller_1.default(), getTaskList = _b.getTaskList, receiveTaskRewards = _b.receiveTaskRewards, getCollectGoodsList = _b.getCollectGoodsList, // 获取收藏商品列表,包含收藏状态
doFollowTask = _b.doFollowTask, doJumpLinkTask = _b.doJumpLinkTask, doBrowseGoodsTask = _b.doBrowseGoodsTask, doCollectGoodsTask = _b.doCollectGoodsTask, doExchangeCreditsTask = _b.doExchangeCreditsTask;
var _c = new base_controller_1.default(), getActivityBaseInfoById = _c.getActivityBaseInfoById, getItemListByItemIds = _c.getItemListByItemIds;
......@@ -26,6 +26,7 @@ exports.default = {
receiveEnamePrize: receiveEnamePrize,
doHelp: doHelp,
getStats: getStats,
addStat: addStat
addStat: addStat,
getRankList: getRankList
};
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,2CAA2C;AAC3C,gEAAyD;AACzD,gEAAyD;AACzD,gEAAyD;AACzD,oEAA6D;AAC7D,kEAA2D;AAC3D,gEAAyD;AAEnD,IAAA,KAAwB,IAAI,yBAAc,EAAE,EAA1C,KAAK,WAAA,EAAE,UAAU,gBAAyB,CAAA;AAC5C,IAAA,KASF,IAAI,yBAAc,EAAE,EARtB,WAAW,iBAAA,EACX,kBAAkB,wBAAA,EAClB,mBAAmB,yBAAA,EAAE,kBAAkB;AACvC,YAAY,kBAAA,EACZ,cAAc,oBAAA,EACd,iBAAiB,uBAAA,EACjB,kBAAkB,wBAAA,EAClB,qBAAqB,2BACC,CAAA;AAElB,IAAA,KAAoD,IAAI,yBAAc,EAAE,EAAtE,uBAAuB,6BAAA,EAAE,oBAAoB,0BAAyB,CAAA;AAExE,IAAA,KAA8E,IAAI,2BAAgB,EAAE,EAAlG,cAAc,oBAAA,EAAE,kBAAkB,wBAAA,EAAE,iBAAiB,uBAAA,EAAE,gBAAgB,sBAA2B,CAAA;AAElG,IAAA,MAAM,GAAK,IAAI,0BAAe,EAAE,OAA1B,CAA0B;AAElC,IAAA,KAAwB,IAAI,yBAAc,EAAE,EAA1C,QAAQ,cAAA,EAAE,OAAO,aAAyB,CAAA;AAElD,kBAAe;IACb,KAAK,OAAA;IACL,UAAU,YAAA;IACV,WAAW,aAAA;IACX,kBAAkB,oBAAA;IAClB,uBAAuB,yBAAA;IACvB,cAAc,gBAAA;IACd,kBAAkB,oBAAA;IAClB,iBAAiB,mBAAA;IACjB,MAAM,QAAA;IACN,QAAQ,UAAA;IACR,OAAO,SAAA;CACR,CAAA"}
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,2CAA2C;AAC3C,gEAAyD;AACzD,gEAAyD;AACzD,gEAAyD;AACzD,oEAA6D;AAC7D,kEAA2D;AAC3D,gEAAyD;AAEnD,IAAA,KAAqC,IAAI,yBAAc,EAAE,EAAvD,KAAK,WAAA,EAAE,UAAU,gBAAA,EAAE,WAAW,iBAAyB,CAAA;AACzD,IAAA,KASF,IAAI,yBAAc,EAAE,EARtB,WAAW,iBAAA,EACX,kBAAkB,wBAAA,EAClB,mBAAmB,yBAAA,EAAE,kBAAkB;AACvC,YAAY,kBAAA,EACZ,cAAc,oBAAA,EACd,iBAAiB,uBAAA,EACjB,kBAAkB,wBAAA,EAClB,qBAAqB,2BACC,CAAA;AAElB,IAAA,KAAoD,IAAI,yBAAc,EAAE,EAAtE,uBAAuB,6BAAA,EAAE,oBAAoB,0BAAyB,CAAA;AAExE,IAAA,KAA8E,IAAI,2BAAgB,EAAE,EAAlG,cAAc,oBAAA,EAAE,kBAAkB,wBAAA,EAAE,iBAAiB,uBAAA,EAAE,gBAAgB,sBAA2B,CAAA;AAElG,IAAA,MAAM,GAAK,IAAI,0BAAe,EAAE,OAA1B,CAA0B;AAElC,IAAA,KAAwB,IAAI,yBAAc,EAAE,EAA1C,QAAQ,cAAA,EAAE,OAAO,aAAyB,CAAA;AAElD,kBAAe;IACb,KAAK,OAAA;IACL,UAAU,YAAA;IACV,WAAW,aAAA;IACX,kBAAkB,oBAAA;IAClB,uBAAuB,yBAAA;IACvB,cAAc,gBAAA;IACd,kBAAkB,oBAAA;IAClB,iBAAiB,mBAAA;IACjB,MAAM,QAAA;IACN,QAAQ,UAAA;IACR,OAAO,SAAA;IACP,WAAW,aAAA;CACZ,CAAA"}
\ No newline at end of file
......@@ -17,4 +17,5 @@ export default class StatService {
* @memberof StatService
*/
addStat(type: number, userInfo?: IUserInfo, customStatData?: object): Promise<string>;
getStatCountByquery(query: IMongoQuery): Promise<number>;
}
......@@ -89,6 +89,16 @@ var StatService = /** @class */ (function () {
});
});
};
StatService.prototype.getStatCountByquery = function (query) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.statdao.count(query)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
return StatService;
}());
exports.default = StatService;
......
{"version":3,"file":"stat.service.js","sourceRoot":"","sources":["../../src/service/stat.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAAgC;AAChC,4BAAoC;AACpC,kCAAmC;AACnC,0CAAwC;AAExC;IAGE,qBAAY,OAA0B;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,aAAO,CAAC,OAAO,EAAE,iBAAY,CAAC,CAAA;IACnD,CAAC;IAED;;;;;;;;OAQG;IACG,6BAAO,GAAb,UAAc,IAAY,EAAE,QAAqC,EAAE,cAA2B;QAAlE,yBAAA,EAAA,WAAsB,EAAe;QAAE,+BAAA,EAAA,mBAA2B;;;;;;wBACpF,MAAM,GAAK,IAAI,CAAC,OAAO,OAAjB,CAAiB;wBACvB,UAAU,GAAK,IAAI,CAAC,OAAO,CAAC,IAAI,WAAtB,CAAsB;wBAChC,QAAQ,GAAK,QAAQ,SAAb,CAAa;wBACtB,qBAAM,IAAI,CAAC,OAAO,CAAC,SAAS,qBACjC,UAAU,YAAA;gCACV,IAAI,MAAA,EACJ,QAAQ,EAAE,qBAAS,CAAC,IAAI,CAAC,EACzB,QAAQ,UAAA;gCACR,MAAM,QAAA,IACH,cAAc,KACjB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EACtB,SAAS,EAAE,gBAAQ,EAAE,IACrB,EAAA;4BATF,sBAAO,SASL,EAAA;;;;KACH;IACH,kBAAC;AAAD,CAAC,AAhCD,IAgCC"}
\ No newline at end of file
{"version":3,"file":"stat.service.js","sourceRoot":"","sources":["../../src/service/stat.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAAgC;AAChC,4BAAoC;AACpC,kCAAmC;AACnC,0CAAwC;AAExC;IAGE,qBAAY,OAA0B;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,aAAO,CAAC,OAAO,EAAE,iBAAY,CAAC,CAAA;IACnD,CAAC;IAED;;;;;;;;OAQG;IACG,6BAAO,GAAb,UAAc,IAAY,EAAE,QAAqC,EAAE,cAA2B;QAAlE,yBAAA,EAAA,WAAsB,EAAe;QAAE,+BAAA,EAAA,mBAA2B;;;;;;wBACpF,MAAM,GAAK,IAAI,CAAC,OAAO,OAAjB,CAAiB;wBACvB,UAAU,GAAK,IAAI,CAAC,OAAO,CAAC,IAAI,WAAtB,CAAsB;wBAChC,QAAQ,GAAK,QAAQ,SAAb,CAAa;wBACtB,qBAAM,IAAI,CAAC,OAAO,CAAC,SAAS,qBACjC,UAAU,YAAA;gCACV,IAAI,MAAA,EACJ,QAAQ,EAAE,qBAAS,CAAC,IAAI,CAAC,EACzB,QAAQ,UAAA;gCACR,MAAM,QAAA,IACH,cAAc,KACjB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EACtB,SAAS,EAAE,gBAAQ,EAAE,IACrB,EAAA;4BATF,sBAAO,SASL,EAAA;;;;KACH;IAEK,yCAAmB,GAAzB,UAA0B,KAAkB;;;;4BACnC,qBAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAA;4BAAtC,sBAAO,SAA+B,EAAA;;;;KACvC;IACH,kBAAC;AAAD,CAAC,AApCD,IAoCC"}
\ No newline at end of file
......@@ -115,7 +115,7 @@ var TaskService = /** @class */ (function (_super) {
var member = userInfo.member;
var newMember = member.newMember;
var today = utils_1.getToday();
var isNewVip = this.checkNewVip(userInfo, vipInfo);
var isNewVip = utils_1.checkNewVip(userInfo, vipInfo);
var value = tasks.member.value;
var projection = {
$set: {},
......@@ -123,7 +123,7 @@ var TaskService = /** @class */ (function (_super) {
$push: {}
};
if (isNewVip && !newMember) {
member = this.setNewVipUserData(member);
member = utils_1.setNewVipUserData(member);
// @ts-ignore
projection.$set.member = member;
projection.$inc['remainTimes.member'] = +value;
......@@ -229,7 +229,7 @@ var TaskService = /** @class */ (function (_super) {
_id = userInfo._id, follow = userInfo.follow;
tasks = activityInfo.tasks;
value = (tasks || {}).follow.value;
followInfo = this.setNewFollowUserData(follow);
followInfo = utils_1.setNewFollowUserData(follow);
return [4 /*yield*/, this.updateUser(_id, {
$set: {
follow: followInfo
......
{"version":3,"file":"task.service.js","sourceRoot":"","sources":["../../src/service/task.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA8B;AAC9B,+CAAwC;AACxC,kCAAoG;AACpG,0CAA0D;AAe1D;IAAyC,+BAAW;IAClD,qBAAY,OAA0B;eACpC,kBAAM,OAAO,CAAC;IAChB,CAAC;IACD;;;;;;;;;OASG;IACH,8BAAQ,GAAR,UAAS,QAAmB,EAAE,KAAa,EAAE,KAAa,EAAE,QAAmB;QAE3E,IACE,KAAA,KAAK,EADP,KAAC,QAAS,EAAV,WAAuE,EAAzD,KAAK,WAAA,EAAE,eAAY,EAAZ,OAAO,mBAAG,EAAE,KAAA,EAAE,YAAY,kBAAA,EAAE,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAA,EAAE,YAAS,EAAT,IAAI,mBAAG,EAAE,KAC9D,CAAA;QAED,IAAA,WAAW,GAAK,QAAQ,YAAb,CAAa;QACxB,IAAA,kBAAkB,GAAK,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC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AC,CAAC,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE;4BACjD,OAAO,UAAU,CAAC,IAAI,CAAA;yBACvB;wBACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,IAAI,UAAU,CAAC,KAAK,EAAE;4BACnD,OAAO,UAAU,CAAC,KAAK,CAAA;yBACxB;wBAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;4BACnC,sBAAO,QAAQ,EAAA;yBAChB;wBAED,qBAAM,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC;4BAErC,mBAAmB;0BAFkB;;wBAArC,SAAqC,CAAA;wBAErC,mBAAmB;wBACnB,qBAAM,aAAK,CAAC,EAAE,CAAC,EAAA;;wBADf,mBAAmB;wBACnB,SAAe,CAAA;wBAER,qBAAM,IAAI,CAAC,WAAW,EAAE,EAAA;4BAA/B,sBAAO,SAAwB,EAAA;;;;KAChC;IACH,kBAAC;AAAD,CAAC,AA9VD,CAAyC,sBAAW,GA8VnD"}
\ No newline at end of file
......@@ -36,47 +36,39 @@ declare class UserService extends BaseService {
* @returns 若更新成功,返回为1; 若更新失败,返回为 0 或系统直接报错
*/
updateUser(_id: string, projection: IUpdateQuery): Promise<number>;
getRank(sortValueKey: string, sortTimeKey: string, limit?: number): Promise<{
userNick: string;
rank: number;
_id?: string;
id?: string;
activityId: string;
avatar: string;
openId: string;
createTime: number;
updateTime: number;
createDay?: string;
inviteId?: string;
member?: IMemberInfo;
follow?: IFollowInfo;
remainTimes?: IRemainTimesInfo;
taskInfo?: object;
login?: object;
}[]>;
/**
* @desc 排行榜
* @param {查询条件} match
* @param {排序规则} sort
* @param {查询条数} limit
*/
getRank(match: Object, sort: Object, limit: number): Promise<any>;
/**
* @desc 获取我的排名
* @param {查询条件} match
* @param {排序规则} sort
*/
getMyRank(match: Object, sort: Object): Promise<any>;
/**
* 获取用户排名
*/
getUserRank(hotValue: number): Promise<string | number>;
/**
* updateUser projection 格式化
* 获取用户排名
*
* @param {object} projection
* @return {*}
* @param {string} sortValueKey 排名字段
* @param {number} userValue
* @param {string} sortTimeKey
* @return {number} 排行
* @memberof UserService
*/
formatUpdateUserProjection(projection: IUpdateQuery): IUpdateQuery;
getMyRank(sortValueKey: string, sortTimeKey: string, userValue: number): Promise<number>;
/**
* @desc 根据用户主键id查找用户详情
* @param {用户的主键id} _id
* @returns 若用户不存在,返回null; 用户存在,返回用户信息(object对象)
*/
getUserInfoById(_id: string): Promise<unknown>;
/**
*判断是否新会员
*
* @param {IUserInfo} userInfo
* @param {IVipInfo} vipInfo
* @returns {boolean}
* @memberof UserService
*/
checkNewVip(userInfo: IUserInfo, vipInfo: IVipInfo): boolean;
setNewVipUserData(member: IMemberInfo): IMemberInfo;
setNewFollowUserData(follow: IFollowInfo): IFollowInfo;
}
export default UserService;
......@@ -69,6 +69,8 @@ var sdk_1 = require("../sdk");
var base_service_1 = require("./base.service");
var db_1 = require("../db");
var utils_1 = require("../utils");
var userUpdate_1 = require("../utils/package/userUpdate");
var format_1 = require("../utils/package/format");
var UserService = /** @class */ (function (_super) {
__extends(UserService, _super);
function UserService(context) {
......@@ -210,7 +212,7 @@ var UserService = /** @class */ (function (_super) {
projection.$push["taskInfo." + today + ".follow"] = { createTime: Date.now() };
projection.$inc["remainTimes.follow"] = follow.value;
}
isNewVip = this.checkNewVip(userInfo, vipInfo);
isNewVip = userUpdate_1.checkNewVip(userInfo, vipInfo);
if (isNewVip && !userInfo.member.newMember) {
// @ts-ignore
projection.$set.member = this.setNewVipUserData(userInfo.member);
......@@ -239,140 +241,79 @@ var UserService = /** @class */ (function (_super) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.userdao.update({ _id: _id }, this.formatUpdateUserProjection(projection))];
case 0: return [4 /*yield*/, this.userdao.update({ _id: _id }, utils_1.formatUpdateUserProjection(projection))];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* @desc 排行榜
* @param {查询条件} match
* @param {排序规则} sort
* @param {查询条数} limit
*/
UserService.prototype.getRank = function (match, sort, limit) {
return __awaiter(this, void 0, void 0, function () {
var data, activityId;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
data = this.context.data;
activityId = data.activityId;
return [4 /*yield*/, this.userdao.aggregate([
{ $match: __assign(__assign({}, match), { activityId: activityId }) },
{ $sort: sort },
{ $group: { _id: null, table: { $push: '$$ROOT' } } },
{ $unwind: { path: '$table', includeArrayIndex: 'no' } },
{
$project: {
_id: 0,
openId: '$table.openId',
userNick: '$table.userNick',
no: {
$add: ['$no', 1]
}
}
},
{ $limit: limit }
])];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* @desc 获取我的排名
* @param {查询条件} match
* @param {排序规则} sort
*/
UserService.prototype.getMyRank = function (match, sort) {
// 获取排名列表
UserService.prototype.getRank = function (sortValueKey, sortTimeKey, limit) {
if (limit === void 0) { limit = 200; }
return __awaiter(this, void 0, void 0, function () {
var _a, openId, data, activityId;
return __generator(this, function (_b) {
switch (_b.label) {
var activityId, list;
var _a, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_a = this.context, openId = _a.openId, data = _a.data;
activityId = data.activityId;
return [4 /*yield*/, this.userdao.aggregate([
{ $match: __assign(__assign({}, match), { activityId: activityId }) },
{ $sort: sort },
{ $group: { _id: null, table: { $push: '$$ROOT' } } },
{ $unwind: { path: '$table', includeArrayIndex: 'no' } },
{
$project: {
_id: 0,
openId: '$table.openId',
userNick: '$table.userNick',
no: {
$add: ['$no', 1]
}
}
activityId = this.context.data.activityId;
return [4 /*yield*/, this.userdao.find((_a = {
activityId: activityId
},
{ $match: { openId: openId } }
])];
case 1: return [2 /*return*/, _b.sent()];
_a[sortValueKey] = { $gt: 0 },
_a), {
projection: (_b = {}, _b[sortValueKey] = 1, _b.userNick = 1, _b.avatar = 1, _b._id = 0, _b),
sort: (_c = {}, _c[sortValueKey] = -1, _c[sortTimeKey] = 1, _c),
limit: limit
})];
case 1:
list = _d.sent();
return [2 /*return*/, list.map(function (v, i) {
return __assign(__assign({}, v), { userNick: format_1.formatUserNick(v.userNick), rank: i + 1 });
})];
}
});
});
};
/**
* 获取用户排名
* 获取用户排名
*
* @param {string} sortValueKey 排名字段
* @param {number} userValue
* @param {string} sortTimeKey
* @return {number} 排行
* @memberof UserService
*/
UserService.prototype.getUserRank = function (hotValue) {
UserService.prototype.getMyRank = function (sortValueKey, sortTimeKey, userValue) {
return __awaiter(this, void 0, void 0, function () {
var activityId, openId, sameScoreList, rank, gap, j;
return __generator(this, function (_a) {
switch (_a.label) {
var _a, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
activityId = this.context.data.activityId;
openId = this.context.openId;
return [4 /*yield*/, this.userdao.find({ hotValue: hotValue, activityId: activityId }, {
sort: { updateTime: 1 }
return [4 /*yield*/, this.userdao.find((_a = {}, _a[sortValueKey] = userValue, _a.activityId = activityId, _a), {
sort: (_b = {}, _b[sortTimeKey] = 1, _b)
})];
case 1:
sameScoreList = _a.sent();
rank = '未上榜';
sameScoreList = _d.sent();
gap = 0;
//说明有多个跟自己同分数的人
for (j = 0; j < sameScoreList.length; j++) {
if (sameScoreList[j].openId == openId) {
if (sameScoreList[j].openId === openId) {
gap = j;
}
}
return [4 /*yield*/, this.userdao.count({ hotValue: { $gt: hotValue }, activityId: activityId })];
return [4 /*yield*/, this.userdao.count((_c = {}, _c[sortValueKey] = { $gt: userValue }, _c.activityId = activityId, _c))];
case 2:
rank = _a.sent();
rank = _d.sent();
rank = rank + 1 + gap;
if (rank > 1000) {
rank = '1000+';
}
return [2 /*return*/, rank];
}
});
});
};
/**
* updateUser projection 格式化
*
* @param {object} projection
* @return {*}
* @memberof UserService
*/
UserService.prototype.formatUpdateUserProjection = function (projection) {
projection['$set'] = projection['$set'] || {};
projection['$set'].updateTime = Date.now();
// $push不存在属性 删除$push
if (projection['$push'] && !Object.keys(projection['$push']).length) {
delete projection['$push'];
}
// $pushAll不存在属性 删除$pushAll
if (projection['$pushAll'] && !Object.keys(projection['$pushAll']).length) {
delete projection['$pushAll'];
}
console.log(projection);
return projection;
};
/**
* @desc 根据用户主键id查找用户详情
* @param {用户的主键id} _id
......@@ -388,27 +329,6 @@ var UserService = /** @class */ (function (_super) {
});
});
};
/**
*判断是否新会员
*
* @param {IUserInfo} userInfo
* @param {IVipInfo} vipInfo
* @returns {boolean}
* @memberof UserService
*/
UserService.prototype.checkNewVip = function (userInfo, vipInfo) {
var flag = userInfo.member.flag;
var isVip = vipInfo.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;
}(base_service_1.default));
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,kCAAiF;AAGjF;IAA0B,+BAAW;IAEnC,qBAAY,OAA0B;QAAtC,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,OAAO,GAAG,IAAI,aAAO,CAAC,OAAO,EAAE,iBAAY,CAAC,CAAA;;IACnD,CAAC;IACD;;;OAGG;IACG,iCAAW,GAAjB;;;;;;wBACM,KAAmB,IAAI,CAAC,OAAO,EAA7B,MAAM,YAAA,EAAE,IAAI,UAAA,CAAiB;wBAC7B,UAAU,GAAK,IAAI,WAAT,CAAS;wBACZ,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAY,EAAE,MAAM,QAAA,EAA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e,GAArB,UAAsB,GAAW;;;;4BACxB,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,KAAA,EAAE,CAAC,EAAA;4BAA1C,sBAAO,SAAmC,EAAA;;;;KAC3C;IAED;;;;;;;OAOG;IACH,iCAAW,GAAX,UAAY,QAAmB,EAAE,OAAiB;QAEpC,IAAA,IAAI,GACZ,QAAQ,YADI,CACJ;QAEJ,IAAA,KAAK,GAAK,OAAO,MAAZ,CAAY;QAEzB,OAAO,CAAC,IAAI,IAAI,KAAK,CAAA;IACvB,CAAC;IAED,uCAAiB,GAAjB,UAAkB,MAAmB;QACnC,IAAM,KAAK,GAAG,gBAAQ,EAAE,CAAA;QACxB,6BACK,MAAM,KACT,SAAS,EAAE,IAAI,EACf,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE,EACxB,WAAW,EAAE,KAAK,IACnB;IACH,CAAC;IAED,0CAAoB,GAApB,UAAqB,MAAmB;QACtC,IAAM,KAAK,GAAG,gBAAQ,EAAE,CAAA;QACxB,6BACK,MAAM,KACT,SAAS,EAAE,IAAI,EACf,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EACtB,SAAS,EAAE,KAAK,IACjB;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AAzSD,CAA0B,sBAAW,GAySpC;AAED,kBAAe,WAAW,CAAA"}
\ No newline at end of file
{"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../src/service/user.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAAwC;AACxC,+CAAwC;AACxC,4BAAoC;AACpC,kCAA+D;AAC/D,0DAAyD;AACzD,kDAAwD;AACxD;IAA0B,+BAAW;IAEnC,qBAAY,OAA0B;QAAtC,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,OAAO,GAAG,IAAI,aAAO,CAAC,OAAO,EAAE,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A1C,sBAAO,SAAmC,EAAA;;;;KAC3C;IACH,kBAAC;AAAD,CAAC,AAlND,CAA0B,sBAAW,GAkNpC;AAED,kBAAe,WAAW,CAAA"}
\ No newline at end of file
......@@ -9,3 +9,5 @@ export * from './package/getUserOrderlist';
export * from './package/vip';
export * from './package/exportHandlers';
export * from './package/helper';
export * from './package/userUpdate';
export * from './package/format';
......@@ -25,4 +25,6 @@ __exportStar(require("./package/getUserOrderlist"), exports);
__exportStar(require("./package/vip"), exports);
__exportStar(require("./package/exportHandlers"), exports);
__exportStar(require("./package/helper"), exports);
__exportStar(require("./package/userUpdate"), exports);
__exportStar(require("./package/format"), exports);
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;AAEd,cAAc;AACd,uDAAoC;AAEpC,iBAAiB;AACjB,qDAAkC;AAElC,gBAAgB;AAChB,wDAAqC;AAErC,SAAS;AACT,uDAAoC;AAEpC,mDAAgC;AAEhC,iDAA8B;AAE9B,6DAA0C;AAE1C,gDAA6B;AAE7B,2DAAwC;AAExC,mDAAgC"}
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;AAEd,cAAc;AACd,uDAAoC;AAEpC,iBAAiB;AACjB,qDAAkC;AAElC,gBAAgB;AAChB,wDAAqC;AAErC,SAAS;AACT,uDAAoC;AAEpC,mDAAgC;AAEhC,iDAA8B;AAE9B,6DAA0C;AAE1C,gDAA6B;AAE7B,2DAAwC;AAExC,mDAAgC;AAEhC,uDAAoC;AAEpC,mDAAgC"}
\ No newline at end of file
......@@ -94,8 +94,7 @@ export const SHIP_STATUS = {
// 记录数据
export enum STAT_TYPE {
CLICK_INVITE = 1,
CLICK_FOLLOW_TASK
INITE_SUCCESS
}
export const appId = '${需要补充}'
......
......@@ -5,15 +5,17 @@ import { paramsCheck, userCheck, activityTimeCheck } from '../decorator/check'
import { services } from '../decorator/services'
import { resultsModel } from '../sdk'
import { getToday } from '../utils'
import { UserService, AccessService, TaskService } from '../service'
import { getToday, setNewVipUserData, checkNewVip } from '../utils'
import { UserService, AccessService, TaskService, StatService } from '../service'
import { registeInfos } from '../decorator/registeInfos'
import { STAT_TYPE } from '../constants'
export default class Share {
/**
* 获取邀请信息
*/
@paramsCheck(['activityId'])
@userCheck({ intercept: true })
@registeInfos(['userInfo', 'activityInfo'])
@services([UserService])
async getShareInfo(
......@@ -39,31 +41,34 @@ export default class Share {
*/
@paramsCheck(['activityId', 'inviteId'])
@activityTimeCheck
@userCheck({ intercept: true })
@registeInfos(['userInfo', 'vipInfo', 'activityInfo'])
@services([UserService, TaskService, AccessService])
@services([UserService, TaskService, StatService, AccessService])
async doHelp(
context: IContext<{
activityId: string
inviteId: string
}>,
{ userInfo, vipInfo, activityInfo }: IControllerInfos,
[userService, taskService]: [UserService, TaskService]
[userService, taskService, statService]: [UserService, TaskService, StatService, AccessService]
): Promise<IResult<boolean>> {
const { inviteId } = context.data
const { inviteId, activityId } = context.data
const { openId } = context
if (openId === inviteId) return resultsModel.error(CODE_TYPES.ERROR_NO_INVITE_SELF)
const inviteUserInfo: IUserInfo = await userService.getUserInfoByOpenId(inviteId)
// inviteId的用户信息查询不到, 则inviteId无效
if (!inviteUserInfo) return resultsModel.error(CODE_TYPES.ERROR_INVALID_INVITE_ID)
const { taskInfo } = taskService.getCompleteTaskByUserTaskInfo('invites', inviteUserInfo)
// 邀请成功列表有该用户信息
if (taskInfo.some(v => v.openId === openId)) {
return resultsModel.error(CODE_TYPES.ERROR_AREADY_INVITE_SUCCESS)
}
// 邀请成功有该用户信息
const userInviteSuccessCount = await statService.getStatCountByquery({
activityId,
openId,
type: STAT_TYPE.INITE_SUCCESS
})
if (userInviteSuccessCount) return resultsModel.error(CODE_TYPES.ERROR_AREADY_INVITE_SUCCESS)
// 获取活动基本信息
const { tasks } = activityInfo
......@@ -73,13 +78,13 @@ export default class Share {
}: ITasks = tasks
// 新会员
const isNewVip = userService.checkNewVip(userInfo, vipInfo)
const isNewVip = checkNewVip(userInfo, vipInfo)
// 新会员更新状态
if (isNewVip && !userInfo.member.newMember) {
await userService.updateUser(userInfo._id, {
$set: {
member: userService.setNewVipUserData(userInfo.member)
member: setNewVipUserData(userInfo.member)
}
})
}
......@@ -88,18 +93,21 @@ export default class Share {
const isValidShare = [isNewVip].every(v => !!v)
const today = getToday()
if (isValidShare) {
const { _id: inviteUserId } = inviteUserInfo
// 增加邀请人的待领取次数和邀请记录
await userService.updateUser(inviteUserId, {
$inc: {
'remainTimes.invites': value
},
$push: {
[`taskInfo.${today}.invites`]: { openId, createTime: Date.now() }
}
})
}
if (!isValidShare) return resultsModel.error(CODE_TYPES.ERROR_INVITE)
// 成功邀请
const { _id: inviteUserId } = inviteUserInfo
// 增加邀请人的待领取次数和邀请记录
await userService.updateUser(inviteUserId, {
$inc: {
'remainTimes.invites': value
},
$push: {
[`taskInfo.${today}.invites`]: { openId, createTime: Date.now() }
}
})
await statService.addStat(STAT_TYPE.INITE_SUCCESS, userInfo)
return resultsModel.success(true)
}
......
/** @format */
import { services, paramsCheck, activityTimeCheck, registeInfos } from '../decorator'
import { services, paramsCheck, activityTimeCheck, registeInfos, userCheck } from '../decorator'
import { resultsModel } from '../sdk'
import { UserService, AccessService } from '../service'
import { formatVipCbUrl, getShopVip } from '../utils/package/vip'
......@@ -61,4 +61,35 @@ export default class User {
return resultsModel.success(result)
}
/**
* 获取排行榜
*/
@paramsCheck(['activityId'])
@userCheck({ intercept: true })
@services([UserService])
async getRankList(
context: IContext<{
activityId: string
}>,
{ userInfo }: IControllerInfos,
[userService]: [UserService]
) {
const sortKey = 'score'
const sortTime = 'updateScoreTime'
const { userNick, avatar } = userInfo
const rank = await userService.getMyRank(sortKey, sortTime, userInfo[sortKey])
const list = await userService.getRank(sortKey, sortTime, 200)
return resultsModel.success({
userNick,
avatar,
rank,
score: userInfo[sortKey],
list
})
}
}
......@@ -68,6 +68,10 @@ export const BusinessError = {
code: `430008`,
defaultMsg: `自己不能给自己助力`
},
ERROR_INVITE: {
code: `430009`,
defaultMsg: `只有新会员才能助力哦~`
},
ERROR_FORBIDDEN_OPE: {
code: `530001`,
defaultMsg: `非法操作`
......
......@@ -8,7 +8,7 @@ import AwardsController from './controller/awards.controller'
import ShareController from './controller/share.controller'
import StatController from './controller/stat.controller'
const { login, getVipInfo } = new UserController()
const { login, getVipInfo, getRankList } = new UserController()
const {
getTaskList,
receiveTaskRewards,
......@@ -39,5 +39,6 @@ export default {
receiveEnamePrize,
doHelp,
getStats,
addStat
addStat,
getRankList
}
......@@ -41,4 +41,8 @@ export default class StatService {
createDay: getToday()
})
}
async getStatCountByquery(query: IMongoQuery) {
return await this.statdao.count(query)
}
}
......@@ -6,7 +6,17 @@
import { merge } from 'lodash'
import UserService from './user.service'
import { getToday, getUserOrderlist, logger, generateVipUrl, formatVipCbUrl, sleep } from '../utils'
import {
getToday,
getUserOrderlist,
logger,
generateVipUrl,
formatVipCbUrl,
sleep,
setNewVipUserData,
setNewFollowUserData,
checkNewVip
} from '../utils'
import { TASK_RATE_TYPE, TASK_STATUS } from '../constants'
export interface ITaskInfo {
......@@ -67,7 +77,7 @@ export default class TaskService extends UserService {
const { newMember } = member
const today = getToday()
const isNewVip = this.checkNewVip(userInfo, vipInfo)
const isNewVip = checkNewVip(userInfo, vipInfo)
const {
member: { value }
......@@ -80,7 +90,7 @@ export default class TaskService extends UserService {
}
if (isNewVip && !newMember) {
member = this.setNewVipUserData(member)
member = setNewVipUserData(member)
// @ts-ignore
projection.$set.member = member
......@@ -194,7 +204,7 @@ export default class TaskService extends UserService {
} = tasks || {}
// 更新follow信息
const followInfo: IFollowInfo = this.setNewFollowUserData(follow)
const followInfo: IFollowInfo = setNewFollowUserData(follow)
// 增加待领取次数
return await this.updateUser(_id, {
......
......@@ -7,9 +7,9 @@
import { BaseDao, TBAPIS } from '../sdk'
import BaseService from './base.service'
import { USER_DB_NAME } from '../db'
import { formatVipCbUrl, getToday, isUseVipMock, generateVipUrl } from '../utils'
import { VIP_MOCK } from '../vipMock'
import { sellerId } from '../constants'
import { getToday, formatUpdateUserProjection } from '../utils'
import { checkNewVip } from '../utils/package/userUpdate'
import { formatUserNick } from '../utils/package/format'
class UserService extends BaseService {
userdao: IBaseDao
constructor(context: IContext<IParams>) {
......@@ -126,7 +126,7 @@ class UserService extends BaseService {
}
// 之前进入活动非会员,现在进入会员,则视为新会员用户
const isNewVip = this.checkNewVip(userInfo, vipInfo)
const isNewVip = checkNewVip(userInfo, vipInfo)
if (isNewVip && !userInfo.member.newMember) {
// @ts-ignore
projection.$set.member = this.setNewVipUserData(userInfo.member)
......@@ -152,115 +152,66 @@ class UserService extends BaseService {
* @returns 若更新成功,返回为1; 若更新失败,返回为 0 或系统直接报错
*/
async updateUser(_id: string, projection: IUpdateQuery) {
return await this.userdao.update({ _id }, this.formatUpdateUserProjection(projection))
return await this.userdao.update({ _id }, formatUpdateUserProjection(projection))
}
/**
* @desc 排行榜
* @param {查询条件} match
* @param {排序规则} sort
* @param {查询条数} limit
*/
async getRank(match: Object, sort: Object, limit: number) {
const { data } = this.context
const { activityId } = data
return await this.userdao.aggregate([
{ $match: { ...match, activityId } },
{ $sort: sort },
{ $group: { _id: null, table: { $push: '$$ROOT' } } },
{ $unwind: { path: '$table', includeArrayIndex: 'no' } },
// 获取排名列表
async getRank(sortValueKey: string, sortTimeKey: string, limit: number = 200) {
let { activityId } = this.context.data
//获取排名
let list = await this.userdao.find<IUserInfo>(
{
$project: {
_id: 0,
openId: '$table.openId',
userNick: '$table.userNick',
no: {
$add: ['$no', 1]
}
}
activityId: activityId,
[sortValueKey]: { $gt: 0 }
},
{ $limit: limit }
])
}
/**
* @desc 获取我的排名
* @param {查询条件} match
* @param {排序规则} sort
*/
async getMyRank(match: Object, sort: Object) {
const { openId, data } = this.context
const { activityId } = data
return await this.userdao.aggregate([
{ $match: { ...match, activityId } },
{ $sort: sort },
{ $group: { _id: null, table: { $push: '$$ROOT' } } },
{ $unwind: { path: '$table', includeArrayIndex: 'no' } },
{
$project: {
_id: 0,
openId: '$table.openId',
userNick: '$table.userNick',
no: {
$add: ['$no', 1]
}
}
},
{ $match: { openId } }
])
projection: { [sortValueKey]: 1, userNick: 1, avatar: 1, _id: 0 },
sort: { [sortValueKey]: -1, [sortTimeKey]: 1 },
limit
}
)
return list.map((v, i) => {
return {
...v,
userNick: formatUserNick(v.userNick),
rank: i + 1
}
})
}
/**
* 获取用户排名
* 获取用户排名
*
* @param {string} sortValueKey 排名字段
* @param {number} userValue
* @param {string} sortTimeKey
* @return {number} 排行
* @memberof UserService
*/
async getUserRank(hotValue: number) {
async getMyRank(sortValueKey: string, sortTimeKey: string, userValue: number): Promise<number> {
let { activityId } = this.context.data
const { openId } = this.context
let sameScoreList = await this.userdao.find<IUserInfo>(
{ hotValue, activityId },
{ [sortValueKey]: userValue, activityId },
{
sort: { updateTime: 1 }
sort: { [sortTimeKey]: 1 }
}
)
let rank: string | number = '未上榜'
let rank: number
let gap = 0
//说明有多个跟自己同分数的人
for (let j = 0; j < sameScoreList.length; j++) {
if (sameScoreList[j].openId == openId) {
if (sameScoreList[j].openId === openId) {
gap = j
}
}
rank = await this.userdao.count({ hotValue: { $gt: hotValue }, activityId })
rank = await this.userdao.count({ [sortValueKey]: { $gt: userValue }, activityId })
rank = rank + 1 + gap
if (rank > 1000) {
rank = '1000+'
}
return rank
}
/**
* updateUser projection 格式化
*
* @param {object} projection
* @return {*}
* @memberof UserService
*/
formatUpdateUserProjection(projection: IUpdateQuery): IUpdateQuery {
projection['$set'] = projection['$set'] || {}
projection['$set'].updateTime = Date.now()
// $push不存在属性 删除$push
if (projection['$push'] && !Object.keys(projection['$push']).length) {
delete projection['$push']
}
// $pushAll不存在属性 删除$pushAll
if (projection['$pushAll'] && !Object.keys(projection['$pushAll']).length) {
delete projection['$pushAll']
}
console.log(projection)
return projection
}
/**
* @desc 根据用户主键id查找用户详情
* @param {用户的主键id} _id
......@@ -269,44 +220,6 @@ class UserService extends BaseService {
async getUserInfoById(_id: string) {
return await this.userdao.findOne({ _id })
}
/**
*判断是否新会员
*
* @param {IUserInfo} userInfo
* @param {IVipInfo} vipInfo
* @returns {boolean}
* @memberof UserService
*/
checkNewVip(userInfo: IUserInfo, vipInfo: IVipInfo): boolean {
const {
member: { flag }
} = userInfo
const { isVip } = vipInfo
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
......@@ -130,6 +130,8 @@ interface IFindProjection {
}
maxTimeMS?: number
upsert?: boolean
limit?: number
skip?: number
returnOriginal?: boolean
collation?: CollationDocument
}
......
......@@ -23,3 +23,7 @@ export * from './package/vip'
export * from './package/exportHandlers'
export * from './package/helper'
export * from './package/userUpdate'
export * from './package/format'
/**
* updateUser projection 格式化
*
* @format
* @param {object} projection
* @return {*}
* @memberof UserService
*/
export function formatUpdateUserProjection(projection: IUpdateQuery): IUpdateQuery {
projection['$set'] = projection['$set'] || {}
projection['$set'].updateTime = Date.now()
// $push不存在属性 删除$push
if (projection['$push'] && !Object.keys(projection['$push']).length) {
delete projection['$push']
}
console.log(projection)
return projection
}
// 用户昵称脱敏
export function formatUserNick(name: string) {
let newStr: string
if (name.length === 2) {
newStr = name.substr(0, 1) + '***' + name.substr(-1, 1)
} else if (name.length > 2) {
let char = '***'
newStr = name.substr(0, 1) + char + name.substr(-1, 1)
} else {
newStr = name + '***'
}
return newStr
}
/** @format */
import { getToday } from './getToday'
/**
* 判断是否新会员
*
* @format
* @param {IUserInfo} userInfo
* @param {IVipInfo} vipInfo
* @returns {boolean}
* @memberof UserService
*/
export function checkNewVip(userInfo: IUserInfo, vipInfo: IVipInfo): boolean {
const {
member: { flag }
} = userInfo
const { isVip } = vipInfo
return !flag && isVip
}
export function setNewVipUserData(member: IMemberInfo): IMemberInfo {
const today = getToday()
return {
...member,
newMember: true,
bememberTime: Date.now(),
bememberDay: today
}
}
export function setNewFollowUserData(follow: IFollowInfo): IFollowInfo {
const today = getToday()
return {
...follow,
newFollow: true,
followTime: Date.now(),
followDay: today
}
}
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