async getList() { const { ctx } = this; const query = ctx.request.query; const pageNo = query.pageNo; const pageSize = query.pageSize || this.app.config.pageSize; const email = query.email; const result = await ctx.service.emails.getList(pageNo, pageSize, email); 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, }); }
// 用户漏斗分析列表 async getAnalysislist() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; const beginTime = query.beginTime; const endTime = query.endTime; const pageNo = query.pageNo; const ip = query.ip; const pageSize = query.pageSize || this.app.config.pageSize; if (!appId) throw new Error('用户漏斗分析列表:appId不能为空'); const result = await ctx.service.web.analysis.getAnalysislist(appId, beginTime, endTime, ip, pageNo, pageSize); ctx.body = this.app.result({ data: result, }); }
// 单个页面列表(简单版本) async getPagesForType() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; const url = query.url; const speedType = query.type || 1; const pageNo = query.pageNo; const pageSize = query.pageSize; if (!appId) throw new Error('单个页面性能列表:appId不能为空'); if (!url) throw new Error('单个页面性能列表:url不能为空'); const result = await ctx.service.web.pages.getPagesForType(appId, url, speedType, pageNo, pageSize); ctx.body = this.app.result({ data: result, }); }
// 获得单个ERROR资源列表信息 async getOneErrorList() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; const url = query.url; const category = query.category || 'resource'; const pageNo = query.pageNo || 1; const pageSize = query.pageSize || this.app.config.pageSize; const beginTime = query.beginTime; const endTime = query.endTime; if (!appId) throw new Error('获得单个ERROR资源列表信息:appId不能为空'); if (!url) throw new Error('获得单个ERROR资源列表信息:url地址不能为空'); const result = await ctx.service.wx.errors.getOneErrorList(appId, url, category, pageNo, pageSize, beginTime, endTime); 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; const beginTime = query.beginTime; const endTime = query.endTime; 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, beginTime, endTime); ctx.body = this.app.result({ data: result, }); }
// 获得单个api的性能列表数据 async getOneAjaxList() { 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; const beginTime = query.beginTime; const endTime = query.endTime; const type = query.type; if (!appId) throw new Error('单个AJAX平均性能数据:appId不能为空'); if (!url) throw new Error('单个AJAX平均性能数据:api地址不能为空'); const result = await ctx.service.web.ajaxs.getOneAjaxList(appId, url, pageNo, pageSize, beginTime, endTime, type); ctx.body = this.app.result({ data: result, }); }
// get /devices async index() { const ctx = this.ctx const params = ctx.request.query let pageList = {} if (params.page) { pageList.page = parseInt(params.page) delete params.page } if (params.pageSize) { pageList.pageSize = parseInt(params.pageSize) delete params.pageSize } ctx.body = await ctx.model.Device.getList({params, ...pageList}) }
// 根据某个页面获得资源列表 async getResourceForType() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; const url = query.url; const speedType = query.type || 1; const pageNo = query.pageNo; const pageSize = query.pageSize; if (!appId) throw new Error('单个页面资源性能列表:appId不能为空'); if (!url) throw new Error('单个页面资源性能列表:url不能为空'); const result = await ctx.service.web.resource.getResourceForType(appId, url, speedType, pageNo, pageSize); ctx.body = this.app.result({ data: result, }); }
// 用户漏斗分析列表 async getAnalysislist() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; const beginTime = query.beginTime; const endTime = query.endTime; const pageNo = query.pageNo; const ip = query.ip; const pageSize = query.pageSize || this.app.config.pageSize; if (!appId) throw new Error('用户漏斗分析列表:appId不能为空'); const result = await ctx.service.wx.analysis.getAnalysislist(appId, beginTime, endTime, ip, pageNo, pageSize); ctx.body = this.app.result({ data: result, }); }
// 获得单个ERROR资源列表信息 async getOneErrorList() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; const url = query.url; const category = query.category || 'resource'; const pageNo = query.pageNo || 1; const pageSize = query.pageSize || this.app.config.pageSize; const beginTime = query.beginTime; const endTime = query.endTime; if (!appId) throw new Error('获得单个ERROR资源列表信息:appId不能为空'); if (!url) throw new Error('获得单个ERROR资源列表信息:url地址不能为空'); const result = await ctx.service.web.errors.getOneErrorList(appId, url, category, pageNo, pageSize, beginTime, endTime); ctx.body = this.app.result({ data: result, }); }
// get /users async index() { const ctx = this.ctx const params = ctx.request.query let pageList = {} if (params.page) { pageList.page = parseInt(params.page) delete params.page } if (params.pageSize) { pageList.pageSize = parseInt(params.pageSize) delete params.pageSize } ctx.body = await ctx.model.User.getList({params, ...pageList}) }
// 单个页面列表(简单版本) async getPagesForType() { const { ctx } = this; const query = ctx.request.query; const appId = query.appId; const url = query.url; const speedType = query.type || 1; const pageNo = query.pageNo; const pageSize = query.pageSize; if (!appId) throw new Error('单个页面性能列表:appId不能为空'); if (!url) throw new Error('单个页面性能列表:url不能为空'); const result = await ctx.service.wx.pages.getPagesForType(appId, url, speedType, pageNo, pageSize); ctx.body = this.app.result({ data: result, }); }
// 获得单个api的性能列表数据 async getOneAjaxList() { 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; const beginTime = query.beginTime; const endTime = query.endTime; const type = query.type; if (!appId) throw new Error('单个AJAX平均性能数据:appId不能为空'); if (!url) throw new Error('单个AJAX平均性能数据:api地址不能为空'); const result = await ctx.service.wx.ajaxs.getOneAjaxList(appId, url, pageNo, pageSize, beginTime, endTime, type); 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, }); }