Config.php 637 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\admin\controller;
  3. use app\BaseController;
  4. use app\common\model\ConfigModel;
  5. use think\App;
  6. use think\facade\View;
  7. class Config extends BaseController
  8. {
  9. private $model;
  10. public function __construct(App $app)
  11. {
  12. $this->model = new ConfigModel();
  13. parent::__construct($app);
  14. }
  15. public function index() {
  16. $config = $this->model->findById(1);
  17. if ($this->request->isAjax()) {
  18. $this->model->where('id', 1)->update($this->request->param());
  19. return $this->ok(true);
  20. }
  21. View::assign('config', $config);
  22. return view();
  23. }
  24. }