From a1d8096a0e5e064d56bb04ece6b1d1e0350023a5 Mon Sep 17 00:00:00 2001 From: "DESKTOP-4RNDQIC\\29019" <290198252@qq.com> Date: Wed, 17 Jun 2020 13:17:15 +0800 Subject: [PATCH] no message --- App/Controllers/Blog.php | 2 ++ App/Controllers/Doc.php | 16 +++++++++++++++- App/Models/Doc.php | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/App/Controllers/Blog.php b/App/Controllers/Blog.php index 5136bd9..9b65b15 100644 --- a/App/Controllers/Blog.php +++ b/App/Controllers/Blog.php @@ -47,6 +47,7 @@ class Blog extends Controller ]); } } + function articleAction() { if(sizeof($this->querys) != 0){ echo '
';
@@ -92,6 +93,7 @@ class Blog extends Controller
             View::renderTemplate("/blog/basic.html",['title'=>'test','index'=>false]);
         }
     }
+
     function donateAction(){
         View::renderTemplate("/blog/basic.html",
             [
diff --git a/App/Controllers/Doc.php b/App/Controllers/Doc.php
index 3011833..a56e9c8 100644
--- a/App/Controllers/Doc.php
+++ b/App/Controllers/Doc.php
@@ -33,6 +33,20 @@ class Doc extends \Core\Controller
        $ret = $docs->Count();
        $this->JsonResp(200,$ret,"OK");
     }
-    
+    // 查找文件名字
+    function articleSearchAction(){
+
+        if(isset($this->input->title)){
+            $docModel = new Models\Doc();
+            $titles = $docModel->titleLikeDoc($this->input->title);
+            $this->JsonResp(0,$titles,"OK");
+
+        }else{
+            $this->JsonResp(200,null,"error");
+        }
+
+
+
+    }
 
 }
\ No newline at end of file
diff --git a/App/Models/Doc.php b/App/Models/Doc.php
index 61c6701..4141b4a 100644
--- a/App/Models/Doc.php
+++ b/App/Models/Doc.php
@@ -75,6 +75,12 @@ class Doc extends  Model
         $recv = $stmt->fetchAll();
         return $recv;
     }
+    public function titleLikeDoc($title){
+        $db = static::getDB();
+        $stmt = $db->query('select * from doc where title like \'%%'.$title.'\'%% and doc.is_public = 0');
+        $recv = $stmt->fetchAll();
+        return $recv;
+    }
     public  function  Count(){
         $db = static::getDB();
         $stmt = $db->query('select count(*) from doc');