sugangqiang 2 years ago
parent
commit
31cb33aca6
1 changed files with 13 additions and 4 deletions
  1. 13 4
      app/admin/controller/Notice.php

+ 13 - 4
app/admin/controller/Notice.php

@@ -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();
     }