123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\admin\controller\setting;
-
-
- use app\admin\logic\NoticeSettingLogic;
- use app\common\basics\AdminBase;
- use app\common\enum\NoticeEnum;
- use app\common\server\JsonServer;
- use think\Db;
-
-
- class NoticeSetting extends AdminBase
- {
-
-
-
- public function index()
- {
- if ($this->request->isAjax()) {
- $get = $this->request->get();
- $type = $get['type'] ?? NoticeEnum::NOTICE_USER;
- return JsonServer::success('获取成功', NoticeSettingLogic::lists($type));
- }
- return view();
- }
-
-
-
-
-
- public function set()
- {
- $id = $this->request->get('id');
- $type = $this->request->get('type');
- if ($this->request->isAjax()) {
- $post = $this->request->post();
- NoticeSettingLogic::set($post);
- return JsonServer::success('操作成功');
- }
- return view('set_'.$type, [
- 'info' => NoticeSettingLogic::info($id, $type),
- 'type' => $type
- ]);
- }
-
-
-
- public function record()
- {
- if($this->request->isAjax()) {
- $get = $this->request->get();
- $data = NoticeSettingLogic::record($get);
- return JsonServer::success('', $data);
- }
- $param = $this->request->get();
- return view('', ['param' => $param]);
- }
-
-
-
- public function delRecord()
- {
- $id = $this->request->post('id', '', 'intval');
- if(empty($id)) {
- return JsonServer::error('参数缺失,删除失败');
- }
- $res = Db::name('notice')->delete($id);
- if(!$res) {
- return JsonServer::error('删除失败');
- }
- return JsonServer::success('删除成功');
- }
- }
|