Commit 82aef41d authored by qinhaitao's avatar qinhaitao

feat: 🎸 完善数据统计

parent d61b97d8
/** @format */
interface IStatsParams {
activityId: string;
startDay: string;
endDay: string;
}
/** @format */
export default class StatController {
/**
* 统计数据
*/
getStats(context: IContext<IParams>): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<any, false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any, true>>;
getStats(context: IContext<IStatsParams>): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<any[], true> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any, false>>;
}
export {};
......@@ -50,7 +50,7 @@ var StatController = /** @class */ (function () {
*/
StatController.prototype.getStats = function (context) {
return __awaiter(this, void 0, void 0, function () {
var _a, activityId, startDay, endDay, userDao, accessDao, oneDay, xlsxData, day, PV, UV, newUV, vipPV, noVipPV, vipUV, noVipUV, newVipUV, newFollowUV, keyValueMapper, tommorrow, buffer, result, e_1;
var _a, activityId, startDay, endDay, userDao, accessDao, oneDay, xlsxData, day, PV, UV, newUV, vipPV, noVipPV, vipUV, noVipUV, newVipUV, newFollowUV, keyValueMapper, tommorrow, buffer, e_1;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
......@@ -61,7 +61,7 @@ var StatController = /** @class */ (function () {
xlsxData = [];
_b.label = 1;
case 1:
_b.trys.push([1, 14, , 15]);
_b.trys.push([1, 13, , 14]);
day = startDay;
_b.label = 2;
case 2:
......@@ -118,7 +118,22 @@ var StatController = /** @class */ (function () {
activityId: activityId,
'member.follow': true,
'member.followDay': day
})];
})
// 签到任务
// const signTaskUV = await userDao.count({
// activityId,
// [`taskInfo.${day}.sign`]: {
// $exists: true
// }
// })
// 收藏商品
// const collectGoodsTaskUV = await userDao.count({
// activityId,
// [`taskInfo.${day}.collecctGoods`]: {
// $exists: true
// }
// })
];
case 11:
newFollowUV = _b.sent();
keyValueMapper = {
......@@ -132,6 +147,8 @@ var StatController = /** @class */ (function () {
未入会UV: noVipUV,
新入会UV: newVipUV,
新增关注UV: newFollowUV
// 收藏商品UV: collectGoodsTaskUV
// 签到任务UV: signTaskUV
};
if (day === startDay) {
xlsxData.push(Object.keys(keyValueMapper));
......@@ -148,23 +165,23 @@ var StatController = /** @class */ (function () {
data: xlsxData
}
]);
return [4 /*yield*/, context.cloud.file.uploadFile({
fileContent: buffer,
fileName: "\u6570\u636E\u7EDF\u8BA1" + startDay.replace(/\//g, '-') + "-" + endDay.replace(/\//g, '-') + ".xlsx"
})];
case 13:
result = _b.sent();
// let result = {}
console.log(xlsxData, 'xlsxData');
if (result.url) {
result.url = result.url.replace('http', 'https').replace('-internal', '');
}
return [2 /*return*/, sdk_1.resultsModel.success(result.url)];
case 14:
// let result = await context.cloud.file.uploadFile({
// fileContent: buffer,
// fileName: `数据统计${startDay.replace(/\//g, '-')}-${endDay.replace(/\//g, '-')}.xlsx`
// })
// console.log(xlsxData, 'xlsxData')
// if (result.url) {
// result.url = result.url.replace('http', 'https').replace('-internal', '')
// }
return [2 /*return*/, sdk_1.resultsModel.success(xlsxData)];
case 13:
e_1 = _b.sent();
console.log('上传文件出错', e_1);
// 打印日志
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.SYSTEM_ERROR, "\u4E0A\u4F20\u6587\u4EF6\u9519\u8BEF")];
case 15: return [2 /*return*/];
case 14: return [2 /*return*/];
}
});
});
......
{"version":3,"file":"stat.controller.js","sourceRoot":"","sources":["../../src/controller/stat.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4BAAoE;AACpE,8BAAmF;AACnF,0CAAyC;AACzC,gCAAiC;AAEjC,cAAc;AACd;IAAA;IA+GA,CAAC;IA9GC;;OAEG;IACG,iCAAQ,GAAd,UAAe,OAA0B;;;;;;wBACjC,KAAmC,OAAO,CAAC,IAAI,EAA7C,UAAU,gBAAA,EAAE,QAAQ,cAAA,EAAE,MAAM,YAAA,CAAiB;wBAE/C,OAAO,GAA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,OAAO,EAAE,GAAG,MAAM,CAAA;wBAChD,GAAG,GAAG,mBAAa,CAAC,0BAAoB,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC,CAAA;;;wBAGhE,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;4BACtB;gCACE,IAAI,EAAE,6BAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,SAAI,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAG;gCACzE,IAAI,EAAE,QAAQ;6BACf;yBACF,CAAC,CAAA;wBAEF,kBAAkB;wBAClB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;wBACjC,qDAAqD;wBACrD,yBAAyB;wBACzB,uFAAuF;wBACvF,KAAK;wBACL,oCAAoC;wBACpC,oBAAoB;wBACpB,8EAA8E;wBAC9E,IAAI;wBACJ,sBAAO,kBAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAA;;;wBAErC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAC,CAAC,CAAA;wBACxB,OAAO;wBACP,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,YAAY,EAAE,sCAAQ,CAAC,EAAA;;;;;KAE/D;IACH,qBAAC;AAAD,CAAC,AAjID,IAiIC"}
\ No newline at end of file
This diff is collapsed.
......@@ -7,5 +7,13 @@ var task_controller_1 = require("./controller/task.controller");
var base_controller_1 = require("./controller/base.controller");
var awards_controller_1 = require("./controller/awards.controller");
var share_controller_1 = require("./controller/share.controller");
exports.default = utils_1.exportHandlers([user_controller_1.default, task_controller_1.default, base_controller_1.default, awards_controller_1.default, share_controller_1.default]);
var stat_controller_1 = require("./controller/stat.controller");
exports.default = utils_1.exportHandlers([
user_controller_1.default,
task_controller_1.default,
base_controller_1.default,
awards_controller_1.default,
share_controller_1.default,
stat_controller_1.default
]);
//# 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,iCAAwC;AACxC,gEAAyD;AACzD,gEAAyD;AACzD,gEAAyD;AACzD,oEAA6D;AAC7D,kEAA2D;AAE3D,kBAAe,sBAAc,CAAC,CAAC,yBAAc,EAAE,yBAAc,EAAE,yBAAc,EAAE,2BAAgB,EAAE,0BAAe,CAAC,CAAC,CAAA"}
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,iCAAwC;AACxC,gEAAyD;AACzD,gEAAyD;AACzD,gEAAyD;AACzD,oEAA6D;AAC7D,kEAA2D;AAC3D,gEAAyD;AAEzD,kBAAe,sBAAc,CAAC;IAC5B,yBAAc;IACd,yBAAc;IACd,yBAAc;IACd,2BAAgB;IAChB,0BAAe;IACf,yBAAc;CACf,CAAC,CAAA"}
\ No newline at end of file
......@@ -107,6 +107,21 @@ class BaseDao {
})
return result
}
/**
* 聚合查询
* @param query
* @param options
*/
async aggregate(query) {
let result = await CURD_REQUEST({
db: this.db,
TABLE: this.TABLE,
type: `aggregate`,
query: query || {}
})
return result
}
}
module.exports = BaseDao
......@@ -11,7 +11,7 @@ const request = async (path, params) => {
})
if (!res.data.data) {
console.log(`调用${path}${JSON.stringify(params)}\n返回结果`, res.data)
return false
return res.data.data
}
return res.data.data
}
......
......@@ -5,12 +5,18 @@ import { resultsModel, dateFormatter, transformBeijingDate, BaseDao } from '../s
import { CODE_TYPES } from '../constants'
import * as xlsx from 'node-xlsx'
interface IStatsParams {
activityId: string
startDay: string
endDay: string
}
/** @format */
export default class StatController {
/**
* 统计数据
*/
async getStats(context: IContext<IParams>) {
async getStats(context: IContext<IStatsParams>) {
const { activityId, startDay, endDay } = context.data
const userDao: IBaseDao = new BaseDao(context, USER_DB_NAME)
......@@ -71,6 +77,22 @@ export default class StatController {
'member.followDay': day
})
// 签到任务
// const signTaskUV = await userDao.count({
// activityId,
// [`taskInfo.${day}.sign`]: {
// $exists: true
// }
// })
// 收藏商品
// const collectGoodsTaskUV = await userDao.count({
// activityId,
// [`taskInfo.${day}.collecctGoods`]: {
// $exists: true
// }
// })
const keyValueMapper = {
时间: day,
访问PV: PV,
......@@ -82,6 +104,8 @@ export default class StatController {
未入会UV: noVipUV,
新入会UV: newVipUV,
新增关注UV: newFollowUV
// 收藏商品UV: collectGoodsTaskUV
// 签到任务UV: signTaskUV
}
if (day === startDay) {
......@@ -101,16 +125,16 @@ export default class StatController {
])
// let result = {}
let result = await context.cloud.file.uploadFile({
fileContent: buffer,
fileName: `数据统计${startDay.replace(/\//g, '-')}-${endDay.replace(/\//g, '-')}.xlsx`
})
console.log(xlsxData, 'xlsxData')
if (result.url) {
result.url = result.url.replace('http', 'https').replace('-internal', '')
}
return resultsModel.success(result.url)
// let result = await context.cloud.file.uploadFile({
// fileContent: buffer,
// fileName: `数据统计${startDay.replace(/\//g, '-')}-${endDay.replace(/\//g, '-')}.xlsx`
// })
// console.log(xlsxData, 'xlsxData')
// if (result.url) {
// result.url = result.url.replace('http', 'https').replace('-internal', '')
// }
return resultsModel.success(xlsxData)
} catch (e) {
console.log('上传文件出错', e)
// 打印日志
......
......@@ -41,7 +41,6 @@ export default class Task {
const vipTask = taskService.initVipTask(updatedUserInfo, vipInfo, tasks)
// 关注店铺
const followTask = taskService.initFollowTask(updatedUserInfo, tasks)
// 签到任务
const signTask = taskService.initSignTask(updatedUserInfo, tasks)
// 下单任务
......
......@@ -6,5 +6,13 @@ import TaskController from './controller/task.controller'
import BaseController from './controller/base.controller'
import AwardsController from './controller/awards.controller'
import ShareController from './controller/share.controller'
import StatController from './controller/stat.controller'
export default exportHandlers([UserController, TaskController, BaseController, AwardsController, ShareController])
export default exportHandlers([
UserController,
TaskController,
BaseController,
AwardsController,
ShareController,
StatController
])
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