System.php 959 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. declare (strict_types = 1);
  3. /**
  4. * +----------------------------------------------------------------------
  5. * | 管理员日志控制器
  6. * +----------------------------------------------------------------------
  7. */
  8. namespace app\sys\controller;
  9. // 引入框架内置类
  10. use think\facade\View;
  11. use app\common\model\System as SystemModel;
  12. class System extends Base
  13. {
  14. public function index()
  15. {
  16. $data = SystemModel::find(1);
  17. View::assign('data', $data);
  18. return View::fetch();
  19. }
  20. public function save($id = 0)
  21. {
  22. if ($this->request->isPost()) {
  23. $params = $this->request->param();
  24. try {
  25. SystemModel::update($params, ['id' => 1]);
  26. } catch (\Exception $e) {
  27. $msg = $e->getMessage();
  28. $this->error("错误提示:" . $msg);
  29. }
  30. $this->success('操作成功', 'sys/system/index');
  31. }
  32. }
  33. }