控制台应用,yzncms本身基于tp5.1框架,里面的队列用不了,bug,坑
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Yzncms [ 御宅男工作室 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2018 http://yzncms.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 御宅男 <530765310@qq.com>
  10. // +----------------------------------------------------------------------
  11. // +----------------------------------------------------------------------
  12. // | 表单后台管理
  13. // +----------------------------------------------------------------------
  14. namespace app\admin\controller\formguide;
  15. use app\admin\model\formguide\Models;
  16. use app\common\controller\Adminbase;
  17. class Formguide extends Adminbase
  18. {
  19. //模板存放目录
  20. protected $filepath, $tpl;
  21. protected $modelValidate = true;
  22. //是否开启模型场景验证
  23. protected $modelSceneValidate = true;
  24. protected function initialize()
  25. {
  26. parent::initialize();
  27. //模块安装后,模板安装在Default主题下!
  28. $this->filepath = TEMPLATE_PATH . (empty(config('site.theme')) ? "default" : config('site.theme')) . DS . "index" . DS . "formguide" . DS;
  29. $this->modelClass = new Models;
  30. }
  31. //首页
  32. public function index()
  33. {
  34. if ($this->request->isAjax()) {
  35. $data = $this->modelClass->where(['module' => 'formguide'])->select();
  36. return json(["code" => 0, "data" => $data]);
  37. } else {
  38. return $this->fetch();
  39. }
  40. }
  41. //添加表单
  42. public function add()
  43. {
  44. $show_template = [];
  45. $this->tpl = str_replace($this->filepath, "", glob($this->filepath . 'show*'));
  46. $this->tpl = str_replace("." . config("template.view_suffix"), "", $this->tpl);
  47. foreach ($this->tpl as $v) {
  48. $show_template[$v] = $v;
  49. }
  50. $this->assign('show_template', $show_template);
  51. return parent::add();
  52. }
  53. //编辑表单
  54. public function edit()
  55. {
  56. $show_template = [];
  57. $this->tpl = str_replace($this->filepath, "", glob($this->filepath . 'show*'));
  58. $this->tpl = str_replace("." . config("template.view_suffix"), "", $this->tpl);
  59. foreach ($this->tpl as $v) {
  60. $show_template[$v] = $v;
  61. }
  62. $this->assign('show_template', $show_template);
  63. return parent::edit();
  64. }
  65. }