// 单个error详情信息 async getErrorDetail() { const { ctx } = this; const query = ctx.request.query; const id = query.id; const appId = query.appId; if (!id) throw new Error('单个error详情信息:id不能为空'); if (!appId) throw new Error('单个error详情信息:appId不能为空'); const result = await ctx.service.web.errors.getErrorDetail(appId, id); ctx.body = this.app.result({ data: result, }); }
// 对数据进行分组 groupData(datas, type, query, beginTime, endTime) { if (!datas && !datas.length) return; datas.forEach(item => { // pvuvip this.savePvUvIpData(item, beginTime, type, query); // top排行 this.ctx.service.web.analysis.saveRealTimeTopTask(item, type, beginTime, endTime); }); }
// 平均AJAX性能列表 async getAverageAjaxList() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; if (!appId) throw new Error('平均AJAX性能列表:appId不能为空'); const result = await ctx.service.web.ajaxs.getAverageAjaxList(ctx); ctx.body = this.app.result({ data: result, }); }
// 获得单个api的性能列表数据 async getOneResourceList() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; const url = query.url; const pageNo = query.pageNo || 1; const pageSize = query.pageSize || this.app.config.pageSize; if (!appId) throw new Error('单个Resource性能列表数据:appId不能为空'); if (!url) throw new Error('单个Resource性能列表数据:api地址不能为空'); const result = await ctx.service.web.resource.getOneResourceList(appId, url, pageNo, pageSize); ctx.body = this.app.result({ data: result, }); }
// top datas async getTopDatas() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; const beginTime = query.beginTime; const endTime = query.endTime; const type = query.type || 1; if (!appId) throw new Error('top页面:appId不能为空'); const result = await ctx.service.web.analysis.getTopDatas(appId, beginTime, endTime, type); ctx.body = this.app.result({ data: result, }); }
// 单个用户行为轨迹列表 async getAnalysisOneList() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; const markuser = query.markuser; if (!appId) throw new Error('单个用户行为轨迹列表:appId不能为空'); if (!markuser) throw new Error('单个用户行为轨迹列表:markuser不能为空'); const result = await ctx.service.web.analysis.getAnalysisOneList(appId, markuser); ctx.body = this.app.result({ data: result, }); }
// 获得error分类列表 async getAverageErrorList() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; if (!appId) throw new Error('获得error分类列表:appId不能为空'); const result = await ctx.service.web.errors.getAverageErrorList(ctx); ctx.body = this.app.result({ data: result, }); }
// 根据mark_page获得用户系统信息 async getEnvironmentForPage() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; const markPage = query.markPage; if (!appId) throw new Error('根据mark_page获得用户系统信息:appId不能为空'); if (!markPage) throw new Error('根据mark_page获得用户系统信息:markPage不能为空'); const result = await ctx.service.web.environment.getEnvironmentForPage(appId, markPage); ctx.body = this.app.result({ data: result, }); }
// 获得历史概况 async getHistoryPvUvIplist() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; if (!appId) throw new Error('pvuvip获得历史概况:appId不能为空'); const result = await ctx.service.web.pvuvip.getHistoryPvUvIplist(appId); ctx.body = this.app.result({ data: result, }); }
// 获得单个ajax详情信息 async getOneAjaxDetail() { const { ctx } = this; const query = ctx.request.query; const id = query.id; const appId = query.appId; if (!id) throw new Error('获得单个ajax详情信息:id不能为空'); if (!appId) throw new Error('获得单个ajax详情信息:appId不能为空'); const result = await ctx.service.web.ajaxs.getOneAjaxDetail(appId, id); ctx.body = this.app.result({ data: result, }); }
// 单个页面性能数据列表 async getOnePageList() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; const url = query.url; if (!appId) throw new Error('单个页面性能列表:appId不能为空'); if (!url) throw new Error('单个页面性能列表:url不能为空'); const result = await ctx.service.web.pages.getOnePageList(ctx); ctx.body = this.app.result({ data: result, }); }
// 获得resource平均性能列表 async getAverageResourceList() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; if (!appId) throw new Error('获得resource平均性能列表:appId不能为空'); const result = await ctx.service.web.resource.getAverageResourceList(ctx); ctx.body = this.app.result({ data: result, }); }
// 获得单个Resource详情信息 async getOneResourceDetail() { const { ctx } = this; const query = ctx.request.query; const id = query.id; const appId = query.appId; if (!id) throw new Error('获得单个Resource详情信息:id不能为空'); if (!appId) throw new Error('获得单个Resource详情信息:appId不能为空'); const result = await ctx.service.web.resource.getOneResourceDetail(appId, id); ctx.body = this.app.result({ data: result, }); }
// 平均页面性能列表 async getAveragePageList() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; if (!appId) throw new Error('平均页面性能列表:appId不能为空'); const result = await ctx.service.web.pages.getAveragePageList(ctx); ctx.body = this.app.result({ data: result, }); }
// 单个页面详情 async getPageDetails() { const { ctx } = this; const query = ctx.request.query; const id = query.id; const appId = query.appId; if (!id) throw new Error('单个页面详情:id不能为空'); if (!appId) throw new Error('单个页面详情:appId不能为空'); const result = await ctx.service.web.pages.getPageDetails(appId, id); ctx.body = this.app.result({ data: result, }); }