home.js 662 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. const os = require('os');
  4. class HomeController extends Controller {
  5. async index() {
  6. const { ctx } = this;
  7. ctx.body = 'hi';
  8. await this.ctx.service.disk.sendWarningEmail();
  9. }
  10. async diskInfo() {
  11. const res = await this.ctx.service.disk.diskInfo();
  12. this.ctx.ok({ data: res });
  13. }
  14. async toDir() {
  15. const res = await this.ctx.service.disk.toDir(this.ctx.request.body);
  16. this.ctx.ok({ data: res });
  17. }
  18. async delFile() {
  19. const res = await this.ctx.service.disk.delFile(this.ctx.request.body);
  20. this.ctx.ok({ data: res });
  21. }
  22. }
  23. module.exports = HomeController;