12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- 'use strict';
- const Controller = require('egg').Controller;
- class HomeController extends Controller {
- constructor(ctx) {
- super(ctx);
- this.createRule = {
- startTime: { type: 'number', min: 0, required: false }, // 开始时间的时间戳 包含
- endTime: { type: 'number', min: 0, required: false }, // 结束时间的时间戳 不包含(客户端处理结束时间 下一日 ,下一月第一日 ,下一年第一日)
- };
- }
- async index() {
- const { ctx } = this;
- ctx.body = 'hi, egg';
- }
- async getMenu() {
- const { ctx, service } = this;
- const payload = ctx.validate({});
- if (ctx.isDev()) {
- const data = [
- 'BR01', 'BR0101', 'BR0102', 'BR0103', 'BR0104',
- 'BR02', 'BR0201', 'BR0202', 'BR0203', 'BR03',
- 'BR0301', 'BR0302', 'BR0303', 'BR0304', 'BR0305', 'BR0306', 'BR0307',
- 'BR04', 'BR0401', 'BR0402', 'BR0403', 'BR0404',
- 'BR05', 'BR0501', 'BR0502', 'BR0503', 'BR0504', 'BR0505', 'BR0506',
- 'BR06', 'BR0601', 'BR0602', 'BR0603', 'BR0604',
- 'BR07', 'BR0701', 'BR0702',
- 'BR08', 'BR0801', 'BR0802', 'BR0803',
- 'BR09', 'BR0901', 'BR0902', 'BR0903',
- 'BR10', 'BR1001', 'BR1002', 'BR1003',
- 'BR11', 'BR1101', 'BR1102',
- 'BR12', 'BR1201', 'BR1202',
- 'BR13', 'BR1301', 'BR1302', 'BR1303',
- 'BR14', 'BR1401', 'BR1402', 'BR1403',
- 'BR15', 'BR1501', 'BR1502', 'BR1503',
- 'BR16', 'BR1601',
- 'BR17', 'BR1701', 'BR1702', 'BR1703', 'BR1704', 'BR1705', 'BR1706', 'BR1707', 'BR1708', 'BR1709', 'BR1710', 'BR1711', 'BR1712', 'BR1713', 'BR1714',
- 'BR18', 'BR1801', 'BR1802', 'BR1803', 'BR1804',
- 'BR19', 'BR1901',
- 'BR20', 'BR2001', 'BR2002', 'BR2003', 'BR2004',
- 'BR21', 'BR2101', 'BR2102', 'BR2103', 'BR2104',
- 'BR22', 'BR2201', 'BR2202', 'BR2203',
- 'BR23', 'BR2301',
- 'BR24', 'BR2401', 'BR2402', 'BR2403', 'BR2404', 'BR2405',
- ];
- ctx.success({ data });
- } else {
- const data = await service.otherService.rbac(payload);
- ctx.success({ data });
- }
- }
- async task() {
- const { ctx, service } = this;
- const { startTime, endTime } = ctx.validate(this.createRule);
- await service.statisticsService.task(null, startTime, endTime);
- ctx.body = 'complete';
- }
- }
- module.exports = HomeController;
|