You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
801 B

8 months ago
'use strict';
const Controller = require('egg').Controller;
const _ = require("lodash");
class HomeController extends Controller {
//启动定时任务
async startSend() {
let { ctx } = this;
ctx.service.home.startSend(ctx.request.body);
ctx.body = {
haserror: false,
msg: `(${_.join(_.map(ctx.request.body, "key"), "、")})定时任务开始`,
}
ctx.status = 200
}
//初始化发送一次查询命令
async startSendOnce() {
let { ctx } = this;
let res = await ctx.service.home.startSendOnce(ctx.request.body);
ctx.body = res
ctx.status = 200
}
//关闭定时任务
async endSend() {
let { ctx } = this;
let res = await ctx.service.home.endSend();
ctx.body = res
ctx.status = 200
}
}
module.exports = HomeController;