Generate.php 884 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace catchAdmin\system\controller;
  3. use catcher\base\CatchController;
  4. use catcher\CatchResponse;
  5. use catcher\generate\CreateModule;
  6. use catcher\generate\Generator;
  7. use think\Request;
  8. class Generate extends CatchController
  9. {
  10. public function save(Request $request, Generator $generator)
  11. {
  12. return CatchResponse::success($generator->done($request->param()));
  13. }
  14. /**
  15. * 预览
  16. *
  17. * @time 2020年04月29日
  18. * @param Request $request
  19. * @param Generator $generator
  20. * @return \think\response\Json
  21. */
  22. public function preview(Request $request, Generator $generator)
  23. {
  24. return CatchResponse::success($generator->preview($request->param()));
  25. }
  26. public function createModule(Request $request, CreateModule $module)
  27. {
  28. return CatchResponse::success($module->generate($request->post()));
  29. }
  30. }