Service.php 937 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace app\admin\controller\wwh;
  3. use app\common\controller\Backend;
  4. use think\Db;
  5. /**
  6. *
  7. *
  8. * @icon fa fa-circle-o
  9. */
  10. class Service extends Backend
  11. {
  12. /**
  13. * 查看
  14. */
  15. public function index()
  16. {
  17. $data = Db::name('wwh_service')->where('id', 1)->find();
  18. $this->assign('data', $data);
  19. return $this->view->fetch();
  20. }
  21. /**
  22. * 服务策略修改
  23. */
  24. public function serviceedit()
  25. {
  26. $s=[
  27. 'content'=>input('content'),
  28. ];
  29. $test = Db::name('wwh_service')->where('id', 1)->find();
  30. if (empty($test)) {
  31. $data = Db::name('wwh_service')->insert($s);
  32. } else {
  33. $data = Db::name('wwh_service')->where('id', 1)->setField($s);
  34. }
  35. if ($data) {
  36. $this->success('保存成功');
  37. } else {
  38. $this->error('未检测到数据变动');
  39. }
  40. }
  41. }