|
@@ -4,6 +4,7 @@ namespace app\admin\controller;
|
|
|
|
|
|
use app\admin\common\AdminController;
|
|
|
use app\common\api\NoticeApi;
|
|
|
+use app\admin\validate\Notice as NoticeValidate;
|
|
|
|
|
|
/**
|
|
|
* Description of Notice
|
|
@@ -28,12 +29,13 @@ class Notice extends AdminController {
|
|
|
public function add() {
|
|
|
if ($this->request->isPost()) {
|
|
|
try {
|
|
|
-
|
|
|
+ $param = $this->request->param();
|
|
|
+ validate(NoticeValidate::class)->check($param);
|
|
|
+ NoticeApi::update($this->request->param());
|
|
|
+ exit();
|
|
|
} catch (\think\exception $e) {
|
|
|
return json(["msg" => $e->getMessage()]);
|
|
|
}
|
|
|
- NoticeApi::update($this->request->param());
|
|
|
- exit();
|
|
|
}
|
|
|
return view();
|
|
|
}
|
|
@@ -44,7 +46,14 @@ class Notice extends AdminController {
|
|
|
*/
|
|
|
public function edit() {
|
|
|
if ($this->request->isPost()) {
|
|
|
- exit();
|
|
|
+ try {
|
|
|
+ $param = $this->request->param();
|
|
|
+ validate(NoticeValidate::class)->check($param);
|
|
|
+ NoticeApi::update($this->request->param());
|
|
|
+ exit();
|
|
|
+ } catch (\think\exception $e) {
|
|
|
+ return json(["msg" => $e->getMessage()]);
|
|
|
+ }
|
|
|
}
|
|
|
return view();
|
|
|
}
|