Parcourir la source

Merge branch 'single' of http://39.100.182.42:3000/huwhois/blog_tp6 into single

huwhois il y a 9 mois
Parent
commit
53d3157117
100 fichiers modifiés avec 1108 ajouts et 4609 suppressions
  1. 0 2
      app/api/common.php
  2. 0 25
      app/api/route/app.php
  3. 1 16
      app/command/FileConsole.php
  4. 0 64
      app/command/MakeController.php
  5. 0 64
      app/command/MakeModel.php
  6. 86 0
      app/command/TagArticleConsole.php
  7. 93 0
      app/common.php
  8. 33 82
      app/controller/Article.php
  9. 18 19
      app/controller/Base.php
  10. 3 12
      app/controller/Index.php
  11. 52 34
      app/controller/sys/Article.php
  12. 2 24
      app/controller/sys/Base.php
  13. 11 11
      app/controller/sys/Category.php
  14. 72 134
      app/controller/sys/FileManager.php
  15. 6 4
      app/controller/sys/GuestBook.php
  16. 2 2
      app/controller/sys/Login.php
  17. 3 2
      app/controller/sys/SysLog.php
  18. 7 6
      app/controller/sys/SysRole.php
  19. 5 4
      app/controller/sys/SysUser.php
  20. 4 4
      app/controller/sys/System.php
  21. 0 96
      app/controller/sys/common.php
  22. 0 17
      app/controller/sys/config/app.php
  23. 0 9
      app/controller/sys/config/view.php
  24. 0 8
      app/controller/sys/event.php
  25. 0 15
      app/controller/sys/listener/SysUserLog.php
  26. 0 5
      app/controller/sys/middleware.php
  27. 1 1
      app/event.php
  28. 0 21
      app/facade/ControllerUtils.php
  29. 0 21
      app/facade/ModelFacade.php
  30. 0 20
      app/facade/VueFacade.php
  31. 14 7
      app/middleware/Admin.php
  32. 23 10
      app/model/Article.php
  33. 10 1
      app/model/ArticleDolikeLog.php
  34. 19 7
      app/model/Category.php
  35. 0 66
      app/model/FileManager.php
  36. 2 4
      app/model/SysLog.php
  37. 15 0
      app/model/SysMenu.php
  38. 14 1
      app/model/SysUser.php
  39. 41 1
      app/model/System.php
  40. 6 40
      app/model/Tag.php
  41. 44 11
      app/model/TagArticle.php
  42. 0 173
      app/service/FileService.php
  43. 0 77
      app/utils/AliyunSmsUtils.php
  44. 0 82
      app/utils/ControllerUtils.php
  45. 9 9
      app/utils/FileUtils.php
  46. 0 155
      app/utils/ModelUtils.php
  47. 1 1
      app/utils/ReUtils.php
  48. 0 115
      app/utils/ValidateUtils.php
  49. 0 120
      app/utils/ZipUtils.php
  50. 0 64
      app/utils/stubs/controller.stub
  51. 0 110
      app/utils/stubs/form.vue.stub
  52. 0 152
      app/utils/stubs/index.vue.stub
  53. 0 18
      app/utils/stubs/model.stub
  54. 0 21
      app/utils/stubs/validate.stub
  55. 2 1
      composer.json
  56. 11 9
      composer.lock
  57. 4 4
      config/app.php
  58. 1 2
      config/console.php
  59. 25 2
      public/static/css/index.css
  60. 3 1
      public/static/plugins/.gitignore
  61. 1 0
      public/static/plugins/layer/2.4/layer.js
  62. BIN
      public/static/plugins/layer/2.4/skin/default/icon-ext.png
  63. BIN
      public/static/plugins/layer/2.4/skin/default/icon.png
  64. BIN
      public/static/plugins/layer/2.4/skin/default/loading-0.gif
  65. BIN
      public/static/plugins/layer/2.4/skin/default/loading-1.gif
  66. BIN
      public/static/plugins/layer/2.4/skin/default/loading-2.gif
  67. 6 0
      public/static/plugins/layer/2.4/skin/layer.css
  68. 1 0
      public/static/plugins/laypage/1.2/laypage.js
  69. 21 0
      public/static/plugins/laypage/1.2/skin/laypage.css
  70. 10 55
      public/static/sys/js/admin.js
  71. 55 33
      route/app.php
  72. 0 2
      temp/.gitignore
  73. 2 2
      view/404.html
  74. 3 7
      view/article/archive.html
  75. 0 84
      view/article/article.bak.html
  76. 8 25
      view/article/index.html
  77. 0 45
      view/article/lists.bak.html
  78. 3 3
      view/article/read.html
  79. 31 0
      view/article/search.html
  80. 4 1
      view/article/tag.html
  81. 3 7
      view/article/time.html
  82. 10 5
      view/aside.html
  83. 192 0
      view/index/about.html
  84. 0 138
      view/index/error.html
  85. 0 189
      view/index/guest_book.html
  86. 15 13
      view/index/index.html
  87. 6 4
      view/layout.html
  88. 0 63
      view/sys/article/ckeditor4.html
  89. 0 33
      view/sys/article/ckeditor5.html
  90. 2 2
      view/sys/article/index.html
  91. 3 4
      view/sys/article/save.html
  92. 62 18
      view/sys/article/savemd.html
  93. 0 404
      view/sys/article/savemdbak.html
  94. 7 17
      view/sys/category/index.html
  95. 20 30
      view/sys/category/save.html
  96. 0 136
      view/sys/file_manager/database_picture.html
  97. 0 81
      view/sys/file_manager/directory_picture.html
  98. 0 462
      view/sys/file_manager/explorer.html
  99. 0 415
      view/sys/file_manager/index.html
  100. 0 345
      view/sys/file_manager/uploadimg.html

+ 0 - 2
app/api/common.php

@@ -1,2 +0,0 @@
-<?php
-// 这是系统自动生成的公共文件

+ 0 - 25
app/api/route/app.php

@@ -1,25 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-use think\facade\Route;
-
-Route::pattern([
-    'name' => '\w+',
-    'id' => '\d+',
-    'cid' => '\d+',
-    'page' => '\d+',
-    'year' => '\d+',
-    'month' => '\d+',
-    'day' => '\d+',
-]); 
-
-Route::get('menu', 'index/menu');
-Route::get('list', 'index/list');
-Route::get('/read/:id', 'index/read');

+ 1 - 16
app/command/FileConsole.php

@@ -71,7 +71,7 @@ class FileConsole extends Command
     }
 
     /**
-     * 建立文件管理目录索引(递归遍历目录)
+     * 图片添加水印
      */
     public function markwater($dir, $savepath = 'test/cpw', $watermark = "test/watermark2.png")
     {
@@ -135,19 +135,4 @@ class FileConsole extends Command
             }
         }
     }
-
-    /**
-     * 清除无效目录索引
-     */
-    public function clear($dir = '')
-    {
-        $list = FileManager::select();
-        
-        foreach ($list as $value) {
-            $file = app()->getRootPath() . 'public/' . $value->filepath;
-            if (!is_file($file)) {
-                FileManager::destroy($value->fileid);
-            }
-        }
-    }
 }

+ 0 - 64
app/command/MakeController.php

@@ -1,64 +0,0 @@
-<?php
-
-declare (strict_types = 1);
-
-namespace app\common\command;
-
-// 引入框架内置类
-use think\console\Input;
-use think\console\Output;
-use think\console\input\Argument;
-use think\console\input\Option;
-use think\console\Command;
-
-use app\facade\ControllerUtils;
-
-class MakeController extends Command
-{
-    protected $type = "Model";
-
-    protected function configure()
-    {
-        $this->setName('makecontroller')
-            ->addArgument('name', Argument::OPTIONAL, "console name")
-            ->setDescription('Create a new model class');
-    }
-
-    protected function execute(Input $input, Output $output)
-    {
-        $name = trim($input->getArgument('name'));
-
-        $classname = $this->getClassName($name);
-
-        try {
-            ControllerUtils::makeModel($classname);
-            $output->writeln('<info>' . $this->type . ':' . $classname . ' created successfully.</info>');
-        } catch (\Exception $e) {
-            $output->writeln('<error>' . $e->getMessage() . '</error>');
-        }
-    }
-
-    protected function getClassName($name)
-    {
-        if (strpos($name, '\\') !== false) {
-            return $name;
-        }
-
-        if (strpos($name, '@')) {
-            [$app, $name] = explode('@', $name);
-        } else {
-            $app = '';
-        }
-
-        if (strpos($name, '/') !== false) {
-            $name = str_replace('/', '\\', $name);
-        }
-
-        return $this->getNamespace($app) . '\\' . $name;
-    }
-
-    protected function getNamespace(string $app): string
-    {
-        return 'app' . ($app ? '\\' . $app : '') . '\\controller';
-    }
-}

+ 0 - 64
app/command/MakeModel.php

@@ -1,64 +0,0 @@
-<?php
-
-declare (strict_types = 1);
-
-namespace app\common\command;
-
-// 引入框架内置类
-use think\console\Input;
-use think\console\Output;
-use think\console\input\Argument;
-use think\console\input\Option;
-use think\console\Command;
-
-use app\facade\ModelUtils;
-
-class MakeModel extends Command
-{
-    protected $type = "Model";
-
-    protected function configure()
-    {
-        $this->setName('makemodel')
-            ->addArgument('name', Argument::OPTIONAL, "console name")
-            ->setDescription('Create a new model class');
-    }
-
-    protected function execute(Input $input, Output $output)
-    {
-        $name = trim($input->getArgument('name'));
-
-        $classname = $this->getClassName($name);
-
-        try {
-            ModelUtils::makeModel($classname);
-            $output->writeln('<info>' . $this->type . ':' . $classname . ' created successfully.</info>');
-        } catch (\Exception $e) {
-            $output->writeln('<error>' . $e->getMessage() . '</error>');
-        }
-    }
-
-    protected function getClassName($name)
-    {
-        if (strpos($name, '\\') !== false) {
-            return $name;
-        }
-
-        if (strpos($name, '@')) {
-            [$app, $name] = explode('@', $name);
-        } else {
-            $app = '';
-        }
-
-        if (strpos($name, '/') !== false) {
-            $name = str_replace('/', '\\', $name);
-        }
-
-        return $this->getNamespace($app) . '\\' . $name;
-    }
-
-    protected function getNamespace(string $app): string
-    {
-        return 'app' . ($app ? '\\' . $app : '') . '\\model';
-    }
-}

+ 86 - 0
app/command/TagArticleConsole.php

@@ -0,0 +1,86 @@
+<?php
+
+declare (strict_types = 1);
+
+namespace app\command;
+
+// 引入框架内置类
+use think\console\Input;
+use think\console\Output;
+use think\console\input\Argument;
+use think\console\Command;
+use think\facade\Db;
+
+use app\model\Tag;
+use app\model\Article;
+use app\model\TagArticle;
+
+class TagArticleConsole extends Command
+{
+    protected function configure()
+    {
+        $this->setName('tagindex')
+            ->addArgument('name', Argument::OPTIONAL, "console name")
+            ->setDescription('Create a new tag index');
+    }
+
+    protected function execute(Input $input, Output $output)
+    {
+        $name = trim($input->getArgument('name'));
+
+        $name = $name ?: 'thinkphp';
+
+        $this->$name();
+    }
+
+    public function thinkphp()
+    {
+        echo "hello thinkphp";
+    }
+
+    public function makeTagArticleIndex()
+    {
+        // 查找所有keywords
+        $keywordsList = Db::table("hu_article")->field('id,cid,keywords')->select();
+
+        $i = $j = 0;
+        foreach ($keywordsList as $value) {
+            $id = $value['id'];
+            $cid = $value['cid'];
+            $keywords = $value['keywords'];
+            $tags = explode(",",$keywords);
+            foreach ($tags as $val) {
+                $tagname = trim($val);
+                if ($tagname) {
+                    $tag = Tag::where('tagname', $tagname)->findOrEmpty();
+                    if ($tag->isEmpty()) {
+                        $tag->tagname = $tagname;
+                        $tag->nums = 1;
+                        $tag->save();
+                        TagArticle::create([
+                            'tid' => $tag->id,
+                            'aid' => $id,
+                            'cid' => $cid
+                        ]);
+                        $i++;
+                        $j++;
+                    } else {
+                        $tagArticle = TagArticle::where('aid', $id)->where('tid', $tag->id)->findOrEmpty();
+                        if ($tagArticle->isEmpty()) {
+                            $tagArticle->aid = $id;
+                            $tagArticle->cid = $cid;
+                            $tagArticle->tid = $tag->id;
+                            $tagArticle->save();
+                            
+                            $tag->nums += 1;
+                            $tag->save();
+                            $j++;
+                        }
+                    }
+                }
+            }
+        }
+
+        echo "新增标签:" . $i . "\n" . "新增标签关联文章" . $j . "\n";
+    }
+}

+ 93 - 0
app/common.php

@@ -74,3 +74,96 @@ function generate_stochastic_string($length = 16)
     return substr(str_shuffle($permitted_chars), 0, $length);
 }
 
+/**
+ * PHP格式化字节大小
+ * @param number $size      字节数
+ * @param string $delimiter 数字和单位分隔符
+ * @return string            格式化后的带单位的大小
+ */
+function format_bytes(int $size, string $delimiter = ''): string
+{
+    $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
+    for ($i = 0; $size >= 1024 && $i < 5; $i++) {
+        $size = (int) $size / 1024;
+    }
+    return round($size, 2) . $delimiter . $units[$i];
+}
+
+/**
+ * 使用递归遍历获取文件夹的大小
+ */
+function get_dir_size($dirname)
+{
+    static $tot; //这里把$tot定义为静态的,表示$tot全局只有这一个变量
+    $ds = opendir($dirname); //创建一个目录资源, 传入的目录就是资源
+    while ($file = readdir($ds)) { //从目录中读取到条目
+        //这里的$path 表示这个路径下的文件夹,如果不这么去定义,里边执行递归语句的时候,找不到是那个文件夹
+        $path = $dirname . "/" . $file;
+
+        //判断,如果是 . 或者 ..的目录就过滤掉
+        if ($file != "." && $file != "..") {
+            if (is_dir($path)) { //判断如果找到的是目录
+                get_dir_size($path); //如果得到是文件夹,然后递归调用一次方法传入的$path文件夹路径就是判断得到的文件夹赋值给$dirname
+            } else {
+                $tot += filesize($path);
+            }
+        }
+    }
+    return $tot;
+}
+
+/**
+ * 递归删除文件夹
+ */
+function deldir($path)
+{
+    //如果是目录则继续
+    if (is_dir($path)) {
+        //扫描一个文件夹内的所有文件夹和文件并返回数组
+        $p = scandir($path);
+        foreach ($p as $val) {
+            //排除目录中的.和..
+            if ($val != "." && $val != "..") {
+                //如果是目录则递归子目录,继续操作
+                if (is_dir($path . $val)) {
+                    //子目录中操作删除文件夹和文件
+                    deldir($path . $val . DIRECTORY_SEPARATOR);
+                    //目录清空后删除空文件夹
+                    @rmdir($path . $val . DIRECTORY_SEPARATOR);
+                } else {
+                    //如果是文件直接删除
+                    unlink($path . $val);
+                }
+            }
+        }
+    }
+}
+
+/**
+ * 遍历获取目录下的指定类型的文件
+ * @param $path
+ * @param array $files
+ * @return array
+ */
+function getfiles($path, $allowFiles, &$files = array())
+{
+    if (!is_dir($path)) return null;
+    if (substr($path, strlen($path) - 1) != '/') $path .= '/';
+    $handle = opendir($path);
+    while (false !== ($file = readdir($handle))) {
+        if ($file != '.' && $file != '..') {
+            $path2 = $path . $file;
+            if (is_dir($path2)) {
+                getfiles($path2, $allowFiles, $files);
+            } else {
+                if (preg_match("/\.(" . $allowFiles . ")$/i", $file)) {
+                    $files[] = array(
+                        'url' => substr($path2, strlen($_SERVER['DOCUMENT_ROOT'])),
+                        'mtime' => filemtime($path2)
+                    );
+                }
+            }
+        }
+    }
+    return $files;
+}

+ 33 - 82
app/controller/Article.php

@@ -14,53 +14,29 @@ namespace app\controller;
 use think\facade\View;
 use think\exception\HttpException;
 
-use app\model\Category as CategoryModel;
 use app\model\Article as ArticleModel;
-use app\model\ArticleBrowerHistory;
-use app\model\ArticleTags as ArticleTagsModel;
 use app\model\ArticleDolikeLog;
 use app\model\Tag;
 use app\model\TagArticle;
 use app\utils\ParsedownUtils;
 
 /**
- * 文章管理  
+ * 文章
  */
 class Article extends Base
 {
-    protected $modelName = "Article";
-
     public function index()
     {
         $params = $this->app->request->param();
 
         $list = ArticleModel::queryPage($params);
 
-        $category = CategoryModel::find($params['cid']);
-
-        if ($category) {
-            $baseUrl = $category->url;
-        } else {
-            $baseUrl = '/index/all';
-        }
-
         View::assign([
-            'baseUrl'  => $baseUrl,
-            'list' => $list->all(),
-            'total' => $list->total(),
-            'limit' => $list->listRows(),
-            'page' => $list->currentPage(),
-            'lastPage' => $list->lastPage(),
-            'pagelist' => $list->render(),
-            'cid' => $params['cid'],
+            'list' => $list,
+            'cid' => $params['cid']
         ]);
 
-        $html = View::fetch();
-        // if ($this->html) {
-        //     $this->makeHtmlFile($html);
-        // }
-
-        return $html;
+        return View::fetch();
     }
 
     /**
@@ -74,30 +50,6 @@ class Article extends Base
             throw new HttpException(404, '页面不存在');
         }
 
-        $ip = $this->request->ip();
-        $time = time();
-        $abh = ArticleBrowerHistory::getByIpAid($ip, $id);
-
-        if (!$abh) {
-            $data->hits += 1;
-            
-            $data->isAutoWriteTimestamp(false)->save();
-
-            ArticleBrowerHistory::create([
-                'ip' => $ip,
-                'aid'=> $id,
-                'create_time' => $time
-            ]);
-        } else {
-            $createTime = $abh->create_time;
-
-            if ($createTime + 24*3600 < $time) {
-                $data->hits += 1;
-            
-                $data->isAutoWriteTimestamp(false)->save();
-            }
-        }
-
         $prev_next = ArticleModel::getNextPrev($id, $data->cid);
 
         if ($data->content_type == 1) {
@@ -117,9 +69,7 @@ class Article extends Base
         $this->seo['des'] = $data->summary;
         View::assign('seo',  $this->seo);
 
-        $html = View::fetch();
-
-        return $html;
+        return View::fetch();
     }
 
     /**
@@ -167,7 +117,7 @@ class Article extends Base
             throw new HttpException(404, '标签不存在');
         }
 
-        $list = TagArticle::queryList($tag->tagid);
+        $list = TagArticle::queryList($tag->id);
 
         View::assign([
             'list' => $list,
@@ -182,30 +132,21 @@ class Article extends Base
      */
     public function archive($year = 0, $month = 0)
     {
-        $yearMonth = $year . '-' . $month;
-
         if ($year == 0 || $month == 0) {
             throw new HttpException(404, '日期格式不正确');
         }
+        $yearMonth = $year . '-' . $month;
 
-        $list = ArticleModel::queryPage(['yearMonth' => $yearMonth]);
+        $params = $this->app->request->param();
+
+        $list = ArticleModel::queryPage($params);
 
         View::assign([
-            'list' => $list->all(),
-            'total' => $list->total(),
-            'limit' => $list->listRows(),
-            'page' => $list->currentPage(),
-            'lastPage' => $list->lastPage(),
-            'pagelist' => $list->render(),
+            'list' => $list,
             'yearMonth'  => $yearMonth
         ]);
 
-        $html = View::fetch();
-        // if ($this->html) {
-        //     $this->makeHtmlFile($html);
-        // }
-
-        return $html;
+        return View::fetch();
     }
 
     /**
@@ -213,20 +154,30 @@ class Article extends Base
      */
     public function time()
     {
-        $params = ['order' => 'update_time desc'];
+        $params = $this->app->request->param();
+
         $list = ArticleModel::queryPage($params);
 
-        View::assign([
-            'list' => $list->all(),
-            'total' => $list->total(),
-            'limit' => $list->listRows(),
-            'page' => $list->currentPage(),
-            'lastPage' => $list->lastPage(),
-            'pagelist' => $list->render(),
-        ]);
+        View::assign('list', $list);
 
-        $html = View::fetch();
+        return View::fetch();
+    }
 
-        return $html;
+    /**
+     * 文章搜索
+     */
+    public function search()
+    {
+        $key = $this->app->request->has('key') ? $this->app->request->param('key') : "";
+        
+        if ($key != "") {
+            $params = $this->app->request->param();
+            $list = ArticleModel::queryPage($params);
+            View::assign('list', $list);
+        }
+
+        View::assign("key", $key);
+
+        return View::fetch();
     }
 }

+ 18 - 19
app/controller/Base.php

@@ -12,12 +12,12 @@ namespace app\controller;
 
 use app\BaseController;
 use think\facade\View;
-use think\facade\Config;
 use think\App;
+use think\facade\Cache;
+use think\facade\Env;
 
-use app\model\Article;
 use app\model\Category;
-use think\facade\Env;
+use app\model\System;
 
 class Base extends BaseController
 {
@@ -39,20 +39,17 @@ class Base extends BaseController
     public function __construct(App $app)
     {
         parent::__construct($app);
-        
-        // 控制器初始化
-        $this->initialize();
     }
 
     // 初始化
     protected function initialize()
     {
-        // SEO标题
-        $system = \app\model\System::find(1);
+        $system = System::cache('system', 3600)->find(1);
+
         $this->seo = [
-            'title' => $system->title,
-            'key' => $system->key,
-            'des' => $system->des,
+            'title' => $system['title'],
+            'key' => $system['key'],
+            'des' => $system['des']
         ];
 
         View::assign('seo', $this->seo);
@@ -60,15 +57,17 @@ class Base extends BaseController
         if (Env::get('app.app_env', false)=='dev') {
             View::assign('bdtongji', "");
         } else {
-            View::assign('bdtongji', $system->tongji);
+            View::assign('bdtongji', $system['tongji']);
+        }
+
+        // 栏目
+        $categoryList = Cache::get('category_list');
+
+        if (!$categoryList) {
+            $categoryList = Category::getList();
+            Cache::set("category_list",$categoryList, 3600);
         }
 
-        // 栏目菜单(nav)
-        $categories = Category::getList(['is_nav'=>1]);
-        View::assign('categories', $categories);
-        
-        // 一般栏目
-        $cate_lists = Category::getList(['type'=>1]);
-        View::assign('cate_lists', $cate_lists);
+        View::assign('categoryList', $categoryList);
     }
 }

+ 3 - 12
app/controller/Index.php

@@ -16,6 +16,7 @@ use think\facade\View;
 use app\controller\Base;
 use app\model\Article;
 use app\model\GuestBook;
+use app\utils\ReUtils;
 
 class Index extends Base
 {
@@ -32,14 +33,6 @@ class Index extends Base
         return View::fetch();
     }
 
-    public function guestBook()
-    {
-        $list = GuestBook::order('id desc')->paginate();
-        View::assign('list', $list);
-
-        return View::fetch();
-    }
-
     public function saveGuestBook()
     {
         $param = $this->request->param('', '', ['strip_tags', 'htmlspecialchars']);
@@ -62,11 +55,9 @@ class Index extends Base
                 'time' => time(),
             ]);
             $bgu->datetime = date("Y-m-d", $bgu->time);
-            return json(['msg' => "保存成功", 'code' => 0, 'data' => $bgu]);
+            return ReUtils::result($bgu);
         } catch (\Exception $e) {
-            $msg = $e->getMessage();
-
-            return json(['msg' => $msg, 'code' => 1]);
+            return ReUtils::error($e->getMessage());
         }
     }
 }

+ 52 - 34
app/controller/sys/Article.php

@@ -12,19 +12,15 @@ declare(strict_types=1);
 namespace app\controller\sys;
 
 // 引入框架内置类
-
-use app\facade\FileFacade;
 use think\Exception;
 use think\facade\Db;
-use think\facade\Config;
 use think\facade\View;
 
-
 use app\model\Category as CategoryModel;
 use app\model\Article as ArticleModel;
-use app\facade\FileUtils;
+use app\model\TagArticle as TagArticleModel;
+use app\utils\FileUtils;
 use app\utils\ReUtils;
-use app\model\FileManager as FileManagerModel;
 
 class Article extends Base
 {
@@ -63,29 +59,42 @@ class Article extends Base
                 $this->error("标题不能为空");
             }
 
-            $params['content'] =  isset($params['content']) ? $params['content'] : '';
-            if ($content_type == 0) {
-                $username = $this->getSysUser()->username;
-                $params['content'] = $this->saveRomteImage($params['content'], (int)$params['id'], (int) $params['cjid'], $username);
+            if ($params['titlepic'] && preg_match('/(http[s]:\/\/.*)/isU', $params['titlepic'])) {
+                $params['titlepic'] = FileUtils::downloadUrlImg($params['titlepic']);
             }
 
+            $params['content'] =  isset($params['content']) ? $params['content'] : '';
+
+            $params['content'] = $this->saveRomteImage($params['content']);
+
             $params['keywords'] = trim($params['keywords']);
 
             try {
                 if ($params['id'] != 0) {
-                    ArticleModel::update($params);
+                    $oldKeywords = ArticleModel::getKeywordsById((int) $params['id']);
+                    $article = ArticleModel::update($params);
+                    $oldTags = explode(",", $oldKeywords);
+                    $newTags = explode(",", $article->keywords);
+
+                    $addTas = array_diff($newTags, $oldTags);
+                    $subTas = array_diff($oldTags, $newTags);
+
+                    TagArticleModel::saveArticleTag($addTas, (int) $article->id, (int)$article->cid);
+                    TagArticleModel::delArticleTag($subTas, (int) $article->id);
                 } else {
                     $params['userid'] = $this->getSysUser()->userid;
-                    $params['username'] = $this->getSysUser()->nickname;
+                    $params['username'] = $this->getSysUser()->nickname != "" ? $this->getSysUser()->nickname : $this->getSysUser()->username;
                     unset($params['id']);
-                    ArticleModel::create($params);
+                    $article = ArticleModel::create($params);
+
+                    $tags = explode(",", $article->keywords);
+
+                    TagArticleModel::saveArticleTag($tags, (int) $article->id, (int) $article->cid);
                 }
             } catch (\Exception $e) {
-                $msg = $e->getMessage();
-
-                $this->error("错误提示:" . $msg);
+                $this->error("错误提示:" . $e->getMessage());
             }
-            $this->success('操作成功', (string) url('index?cid=' . $params['cid']));
+            $this->success('操作成功', (string) url('/sys/article/index'));
         } else {
             if ($id) {
                 $data = ArticleModel::find($id);
@@ -94,11 +103,10 @@ class Article extends Base
                 $data->content_type = $content_type;
             }
 
-            $data->cjid = time();
-
             $categories = CategoryModel::field('id, parent_id, name')->select();
 
             View::assign('category_tree', list_tree($categories));
+
             View::assign('data', $data);
 
             $template = $content_type ? 'savemd' : 'save';
@@ -107,7 +115,7 @@ class Article extends Base
         }
     }
 
-    protected function saveRomteImage($content, $infoid = 0, $cjid = 0, $username = 'system')
+    protected function saveRomteImage($content)
     {
         $content = stripslashes($content);
         $img_array = [];
@@ -119,21 +127,10 @@ class Article extends Base
         $img_arrays = array_unique($img_array[1]);
 
         foreach ($img_arrays as $value) {
-            $file = FileFacade::downloadUrlImg($value);
+            $filename = FileUtils::downloadUrlImg($value);
 
-            $savename = \think\facade\Filesystem::disk('public')->putFile('/', $file);
-
-            FileManagerModel::saveFileInfo($file, $savename, $file->getOriginalName, $infoid, $cjid, $username);
-
-            // 删除临时文件
-            @unlink($file->getRealPath());
-
-            $filename = Config::get('filesystem.disks.public.url') . '/' . str_replace('\\', '/', $savename);
-
-            // dump($filename);
             $content = str_replace($value, $filename, $content);
         }
-
         return $content;
     }
 
@@ -146,14 +143,35 @@ class Article extends Base
 
         $idss = implode(',', $ids);
 
-        $sql = "update " . $tablename . " set cid=". $cid ." where id IN (" . $idss . ");";
+        $sql = "update " . $tablename . " set cid=" . $cid . " where id IN (" . $idss . ");";
 
         try {
             Db::execute($sql);
         } catch (Exception $e) {
-            return ReUtils::error();
+            return ReUtils::error($e->getMessage());
         }
 
         return ReUtils::success();
     }
+
+    /**
+     * 删除
+     * @param int|array $id  info id
+     * @return array
+     */
+    public function delete($id)
+    {
+        if ($this->request->isPost()) {
+            if (ArticleModel::destroy($id)) {
+                if (is_array($id)) {
+                    TagArticleModel::where('aid',"IN",$id)->delete();
+                } else {
+                    TagArticleModel::where('aid',"=",$id)->delete();
+                }
+                return ReUtils::success();
+            } else {
+                return ReUtils::error();
+            }
+        }
+    }
 }

+ 2 - 24
app/controller/sys/Base.php

@@ -100,12 +100,12 @@ abstract class Base
 
         $menus = $rid !=null ? SysMenu::getUserMenuList($rid) : [];
 
-        $controller =  strtolower(preg_replace('/(?<=[a-z])([A-Z])/', '_$1', Request::controller()));
+        $controller =  str_replace("sys.", "", strtolower(preg_replace('/(?<=[a-z])([A-Z])/', '_$1', Request::controller())));
 
         $action = strtolower(preg_replace('/(?<=[a-z])([A-Z])/', '_$1', Request::action()));
 
         $route =  $controller . '/' . $action;
-        
+
         $breadCrumb = SysMenu::getBreadCrumb($route);
 
         // layer open
@@ -115,28 +115,6 @@ abstract class Base
             View::assign('layer', false);
         }
 
-        // // pjax
-        // if (Request::has('_pjax')) {
-        //     View::assign(['pjax' => true]);
-        // } else {
-        //     View::assign(['pjax' => false]);
-        // }
-
-        // 内容管理,获取栏目列表
-        // if (class_exists('\app\model\Cate')) {
-        //     $cates = \app\model\Cate::getList();
-        // }
-        // View::assign(['cates' => unlimitedForLayer($cates['data'] ?? [])]);
-
-        // index应用地址
-        // $domainBind = Config::get('app.domain_bind');
-        // if ($domainBind) {
-        //     $domainBindKey = array_search('index', $domainBind);
-        //     $domainBindKey = $domainBindKey == '*' ? 'www.' : ($domainBindKey ? $domainBindKey . '.' : '');
-        //     $indexUrl      = Request::scheme() . '://' . $domainBindKey . Request::rootDomain() . '/';
-        // }
-        // View::assign(['indexUrl' => $indexUrl ?? '/']);
-
         // 查询系统设置
         $system       = \app\model\System::find(1);
         $this->system = $system;

+ 11 - 11
app/controller/sys/Category.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 /**
  * +----------------------------------------------------------------------
@@ -12,20 +13,22 @@ namespace app\controller\sys;
 use think\facade\View;
 
 use app\model\Category as CategoryModel;
+use app\utils\ReUtils;
 
 class Category extends Base
 {
     protected  $modelName = "Category";
+    protected $types = ['一般', '目录', '链接'];
 
     public function index()
     {
-        $list = CategoryModel::getList(['order'=>'id DESC']);
+        $list = CategoryModel::getList(['order' => 'id DESC']);
 
         $list = list_tree($list, 'id', 'parent_id');
 
         View::assign('list', $list);
 
-        View::assign('types', ['','一般','目录','单页','锚点','链接']);
+        View::assign('types', $this->types);
 
         return View::fetch();
     }
@@ -41,12 +44,11 @@ class Category extends Base
             $data = CategoryModel::find($id);
         } else {
             $data = new CategoryModel();
-            $data->is_nav = 1;
         }
 
         View::assign('data', $data);
 
-        $list = list_tree(CategoryModel::select());
+        $list = CategoryModel::selectOne();
 
         View::assign('list', $list);
 
@@ -71,12 +73,10 @@ class Category extends Base
                 } else {
                     CategoryModel::create($params);
                 }
+                return ReUtils::success();
             } catch (\Exception $e) {
-                $msg = $e->getMessage();
-
-                $this->error("错误提示:" . $msg);
+                return ReUtils::error($e->getMessage());
             }
-            $this->success('操作成功', (string)url('index'));
         }
     }
 
@@ -85,13 +85,13 @@ class Category extends Base
     {
         if ($this->app->request->isPost()) {
             if (CategoryModel::where('parent_id', $id)->value('id')) {
-                return ['code' => 0, 'msg' => '子栏目不为空, 若要删除请先清空子栏目'];
+                return ReUtils::error('子栏目不为空, 若要删除请先清空子栏目');
             }
 
             if (CategoryModel::destroy($id)) {
-                return ['code' => 0,'msg'=>'删除成功'];
+                return ReUtils::success();
             } else {
-                return ['code' => 1,'msg'=>'删除失败'];
+                return ReUtils::error();
             }
         }
     }

+ 72 - 134
app/controller/sys/FileManager.php

@@ -25,14 +25,11 @@ use think\file\UploadedFile;
 use app\common\service\FileService;
 use app\model\FileManager as FileManagerModel;
 use app\facade\FileFacade;
+use app\utils\ReUtils;
 
 class FileManager extends Base
 {
     protected $modelName = 'FileManager';
-    protected $t_suffix = '_thumb';
-    protected $width = 400;  // 缩略图高度
-    protected $height = 300;
-    protected $storage_path = 'public/storage';
     
     public function index()
     {
@@ -65,35 +62,78 @@ class FileManager extends Base
                     )->check(['file' => $file]);
 
                     $savename = \think\facade\Filesystem::disk('public')->putFile('/', $file);
-
-                    $savename = str_replace('\\', '/', $savename);
-                    $infoid   = (int) $this->request->param('infoid');
-                    $cjid     = (int) $this->request->param('cjid');
-                    $username = $this->getSysUser()->username;
                     
-                    FileManagerModel::saveFileInfo($file, $savename, $file->getOriginalName(), $infoid, $cjid, $username);
+                    $urlpath = Config::get('filesystem.disks.public.url');
+
+                    $pictureurl = str_replace("\\", "/", $urlpath . '/' . $savename);
 
                     return json([
                         'uploaded' => 1,
                         'fileName' => basename($savename),
-                        'url' => Config::get('filesystem.disks.public.url') . '/' . $savename
+                        'url' => $pictureurl
                     ]);
                 } catch (\think\exception\ValidateException $e) {
                     $this->error($e->getMessage());
                     return json([
-                        'uploaded' => 1,
+                        'uploaded' => 0,
                         'error' =>  ['message' => $e->getMessage()]
                     ]);
                 }
             } else {
                 return json([
-                    'uploaded' => 1,
+                    'uploaded' => 0,
                     'error' =>  ['message' => '图片不能为空']
                 ]);
             }
         }
     }
 
+    /**
+     * 本地图片上传
+     * @param file upload_file   上传的文件
+     */
+    public function uploadImage()
+    {
+        if ($this->request->isPost()) {
+            $file = $this->request->file('upload_file');
+
+            if ($file) {
+                try {
+                    validate(
+                        [
+                            'file' => [
+                                // 限制文件大小(单位b),这里限制为4M
+                                'fileSize' => 4 * 1024 * 1024,
+                                // 限制文件后缀,多个后缀以英文逗号分割
+                                'fileExt'  => 'jpg,png,gif,jpeg,webp,jfif'
+                            ]
+                        ],
+                        [
+                            'file.fileSize' => '文件太大',
+                            'file.fileExt' => '不支持的文件后缀',
+                        ]
+                    )->check(['file' => $file]);
+
+                    $savename = \think\facade\Filesystem::disk('public')->putFile('/', $file);
+
+                    $urlpath = Config::get('filesystem.disks.public.url');
+
+                    $pictureurl = str_replace("\\", "/", $urlpath . '/' . $savename);
+
+                    return ReUtils::result([
+                        'filename' => $pictureurl
+                    ]);
+                } catch (ValidateException $e) {
+                    return ReUtils::error($e->getMessage());
+                } catch (Exception $e) {
+                    return ReUtils::error($e->getMessage());
+                }
+            } else {
+                return ReUtils::error('图片不能为空');
+            }
+        }
+    }
+
     /**
      * 文件上传
      */
@@ -131,22 +171,9 @@ class FileManager extends Base
                 $url = Config::get('filesystem.disks.public.url');
 
                 foreach ($uploadFiles as $file) {
-                    $fileinfo = new FileManagerModel();
-                    
-                    $fileinfo->title         = $file->getOriginalName();
-                    $fileinfo->filesize      = $file->getSize();
-                    $fileinfo->filetime      = $file->getCTime();
-                    $fileinfo->fileextension = $file->extension();
-                    $fileinfo->username      = $this->getSysUser()->username;
-                    $fileinfo->hash_md5      = $file->md5();
-                    
                     $savename = \think\facade\Filesystem::disk('public')->putFile('/', $file);
-                    
-                    $fileinfo->filepath = $url . '/' . $savename;
-
-                    $fileinfo->save();
 
-                    $savenames[] = $fileinfo->filepath;
+                    $savenames[] = $url . '/' . $savename;
                 }
 
                 return json(['code' => 0, 'msg'=>'上传成功', 'filename'=>$savenames]);
@@ -158,59 +185,6 @@ class FileManager extends Base
         }
     }
 
-    /**
-     * 本地图片上传
-     * @file upload_file   上传的文件
-     * @param string  $img_id   图片ipnut text id 默认值 picture
-     * @param boolean $thumb    是否制作缩略图
-     * @param int $width        缩略图最大宽
-     * @param int $height       缩略图最大高
-     * @param int $id           信息ID
-     * @param int $cjid         信息临时ID
-     * @param bool $saveoriginal   生成缩略图后是否保存原图 默认保存 saveoriginal
-     */
-    public function uploadLocalImg(string $img_id = 'picture', $thumb = false, $width = 400, $height = 300,
-        $original = false, $id = 0, $cjid = 0)
-    {
-        if ($this->request->isPost()) {
-            $file = $this->request->file('upload_file');
-
-            if ($file) {
-                try {
-                    validate(
-                        [
-                            'file' => [
-                                // 限制文件大小(单位b),这里限制为4M
-                                'fileSize' => 4 * 1024 * 1024,
-                                // 限制文件后缀,多个后缀以英文逗号分割
-                                'fileExt'  => 'jpg,png,gif,jpeg,webp,jfif'
-                            ]
-                        ],
-                        [
-                            'file.fileSize' => '文件太大',
-                            'file.fileExt' => '不支持的文件后缀',
-                        ]
-                    )->check(['file' => $file]);
-
-                    $result = $this->dealUploadImg($file, $thumb, $width, $height, $original, $id, $cjid);
-
-                    return json([
-                        'code'    => 0,
-                        'img_id'  => $img_id,
-                        'picname' => $result['picname'],
-                        'thumb'   => $result['thumbname']
-                    ]);
-                } catch (ValidateException $e) {
-                    $this->error($e->getMessage());
-                } catch (Exception $e) {
-                    $this->error($e->getMessage());
-                }
-            } else {
-                $this->error('图片不能为空');
-            }
-        }
-    }
-
     /**
      * 网络图片上传
      * @paran string url_file   网络图片地址
@@ -221,7 +195,7 @@ class FileManager extends Base
      * @param int $height       缩略图最大高
      * @param bool $overwrite   生成缩略图后是否保存原图
      */
-    public function uploadUrlImg(string $img_id = 'picture', $thumb = false, $width = 400, $height = 300,
+    public function uploadUrlImage(string $img_id = 'picture', $thumb = false, $width = 400, $height = 300,
         $original = false, $id = 0, $cjid = 0)
     {
         if ($this->request->isPost()) {
@@ -230,8 +204,23 @@ class FileManager extends Base
             if ($urlImg) {
                 try {
                     $file = FileFacade::downloadUrlImg($urlImg);
-                    
-                    $result = $this->dealUploadImg($file, $thumb, $width, $height, $original, $id, $cjid);
+                                        
+                    $urlpath = Config::get('filesystem.disks.public.url');
+
+                    $username = $this->getSysUser()->username;
+            
+                    $savename =  str_replace('\\', '/', $file->hashName());
+            
+                    $originalName = $file->getOriginalName();
+            
+                    $thumbname = "";
+            
+                    \think\facade\Filesystem::disk('public')->putFileAs('/', $file, $savename);
+
+                    $result = [
+                        'picname'   => $savename,
+                        'thumbname' => $thumbname,
+                    ];
 
                     // 删除临时文件
                     @unlink($file->getRealPath());
@@ -250,55 +239,4 @@ class FileManager extends Base
             }
         }
     }
-
-
-
-    /**
-     * 处理上传的图片
-     */
-    protected function dealUploadImg(UploadedFile $file, $thumb, $width, $height, $original, $id, $cjid): array
-    {
-        $urlpath = Config::get('filesystem.disks.public.url');
-
-        $username = $this->getSysUser()->username;
-
-        $savename =  str_replace('\\', '/', $file->hashName());
-
-        $originalName = $file->getOriginalName();
-
-        $thumbname = "";
-
-        if ($thumb == true) {
-            $image = Image::open($file);
-            
-            $image->thumb($width, $height, 1);
-
-            $ext = $file->extension();
-            
-            if ($original == true) {
-                \think\facade\Filesystem::disk('public')->putFileAs('/', $file, $savename);
-                
-                $thumbname = str_replace('.' . $ext, '',  $savename) . $this->t_suffix . '.' . $ext;
-
-                $savepath = str_replace('\\', '/', Config::get('filesystem.disks.public.root') . '/' . $thumbname);
-
-                $image->save($savepath);
-                
-                FileManagerModel::saveFileInfo($savepath, $thumbname, $originalName, $id, $cjid, $username);
-
-                $thumbname = $urlpath . '/' . $thumbname;
-            } else {
-                $image->save(Config::get('filesystem.disks.public.root') . '/' . $savename);
-            }
-        } else {
-            \think\facade\Filesystem::disk('public')->putFileAs('/', $file, $savename);
-        }
-
-        $fileinfo = FileManagerModel::saveFileInfo($file, $savename, $originalName, $id, $cjid, $username);
-        
-        return [
-            'picname'   => $fileinfo->filepath,
-            'thumbname' => $thumbname,
-        ];
-    }
 }

+ 6 - 4
app/controller/sys/GuestBook.php

@@ -4,6 +4,7 @@ namespace app\controller\sys;
 
 use think\facade\View;
 use app\model\GuestBook as GuestBookModel;
+use app\utils\ReUtils;
 
 class GuestBook extends Base
 {
@@ -24,17 +25,18 @@ class GuestBook extends Base
     }
 
     /**
-     * 状态修改 1,正常; 0,非正常
+     * 标记状态修改 1,正常; 0,非正常
      */
-    public static function mark($id)
+    public function status(int $id)
     {
         try {
             $info       = GuestBookModel::find($id);
             $info->mark = 1 - $info['mark'];
             $info->save();
-            return json(['code' => 0, 'msg' => '修改成功!', 'mark'=>$info->mark]);
+
+            return ReUtils::success();
         } catch (\Exception $e) {
-            return json(['code' => 1, 'msg' => $e->getMessage()]);
+            return ReUtils::error($e->getMessage());
         }
     }
 

+ 2 - 2
app/controller/sys/Login.php

@@ -27,7 +27,7 @@ class Login
         if (Session::has('adminuser')) {
             return redirect((string)url('/sys/index/index'));
         }
-        $restore_url = Session::has('restore') ? Session::get('restore'): (string)url('index/index');
+        $restore_url = Session::has('restore') ? Session::get('restore'): (string)url('/sys/index/index');
 
         View::assign('restore_url', $restore_url);
 
@@ -42,6 +42,6 @@ class Login
     // 退出登录
     public function logout(){
         Session::delete('adminuser');
-        return redirect((string) url('login/index'));
+        return redirect((string) url('/sys/login/index'));
     }
 }

+ 3 - 2
app/controller/sys/SysLog.php

@@ -10,6 +10,7 @@ namespace app\controller\sys;
 // 引入框架内置类
 use think\facade\View;
 
+use app\utils\ReUtils;
 use app\model\SysLog as SysLogModel;
 
 class SysLog extends Base
@@ -27,9 +28,9 @@ class SysLog extends Base
     {
         if ($this->app->request->isPost()) {
             if (SysLogModel::destroy($id)) {
-                return ['code' => 1,'msg'=>'删除成功'];
+                return ReUtils::success();
             } else {
-                return ['code' => 0,'msg'=>'删除失败'];
+                return ReUtils::error();
             }
         }
     }

+ 7 - 6
app/controller/sys/SysRole.php

@@ -6,6 +6,7 @@ use think\facade\View;
 use app\model\SysMenu;
 use app\model\SysUser;
 use app\model\SysRole as SysRoleModel;
+use app\utils\ReUtils;
 use think\facade\Session;
 
 class SysRole extends Base
@@ -83,23 +84,23 @@ class SysRole extends Base
 
             if (is_array($id)) {
                 if (in_array('1', $id)) {
-                    return ['status'=>0,'msg'=>'超级管理员无法删除'];
+                    return ReUtils::error("超级管理员无法删除");
                 }
                 if (in_array($U_role_id, $id)) {
-                    return ['status'=>0,'msg'=>'当前登录用户角色无法删除'];
+                    return ReUtils::error("当前登录用户角色无法删除");
                 }
             } else {
                 if ($id == 1) {
-                    return ['status'=>0,'msg'=>'超级管理员无法删除'];
+                    return ReUtils::error("超级管理员无法删除");
                 }
                 if ($id == $U_role_id) {
-                    return ['status'=>0,'msg'=>'当前登录用户角色无法删除'];
+                    return ReUtils::error("当前登录用户角色无法删除");
                 }
             }
             if (SysRoleModel::destroy($id)) {
-                return ['code' => 1,'msg'=>'操作成功'];
+                return ReUtils::success();
             } else {
-                return ['code' => 0,'msg'=>'操作失败'];
+                return ReUtils::error();
             }
         }
     }

+ 5 - 4
app/controller/sys/SysUser.php

@@ -11,6 +11,7 @@ namespace app\controller\sys;
 use think\facade\View;
 use think\facade\Config;
 
+use app\utils\ReUtils;
 use app\model\SysUser as SysUserModel;
 use app\model\SysRole as SysRoleModel;
 
@@ -109,17 +110,17 @@ class SysUser extends Base
         if ($this->app->request->isAjax()) {
             if (is_array($id)) {
                 if (in_array(session('uid'), $id)) {
-                    return ['code'=>0,'msg'=>'当前登录用户无法删除'];
+                    return ReUtils::error('当前登录用户无法删除');
                 }
             } else {
                 if ($id == session('uid')) {
-                    return ['code'=>0,'msg'=>'当前登录用户无法删除'];
+                    return ReUtils::error('当前登录用户无法删除');
                 }
             }
             if (SysUserModel::destroy($id)) {
-                return ['code' => 1,'msg'=>'删除成功'];
+                return ReUtils::success();
             } else {
-                return ['code' => 0,'msg'=>'删除失败'];
+                return ReUtils::error();
             }
         }
     }

+ 4 - 4
app/controller/sys/System.php

@@ -11,6 +11,7 @@ namespace app\controller\sys;
 use think\facade\View;
 
 use app\model\System as SystemModel;
+use app\utils\ReUtils;
 
 class System extends Base
 {
@@ -31,12 +32,11 @@ class System extends Base
 
             try {
                 SystemModel::update($params, ['id' => 1]);
-            } catch (\Exception $e) {
-                $msg = $e->getMessage();
 
-                $this->error("错误提示:" . $msg);
+                return ReUtils::success();
+            } catch (\Exception $e) {
+                return ReUtils::error($e->getMessage());
             }
-            $this->success('操作成功', 'sys/system/index');
         }
     }
 }

+ 0 - 96
app/controller/sys/common.php

@@ -1,96 +0,0 @@
-<?php
-// 这是系统自动生成的公共文件
-
-/**
- * PHP格式化字节大小
- * @param number $size      字节数
- * @param string $delimiter 数字和单位分隔符
- * @return string            格式化后的带单位的大小
- */
-function format_bytes(int $size, string $delimiter = ''): string
-{
-    $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
-    for ($i = 0; $size >= 1024 && $i < 5; $i++) {
-        $size = (int) $size / 1024;
-    }
-    return round($size, 2) . $delimiter . $units[$i];
-}
-
-/**
- * 使用递归遍历获取文件夹的大小
- */
-function get_dir_size($dirname)
-{
-    static $tot; //这里把$tot定义为静态的,表示$tot全局只有这一个变量
-    $ds = opendir($dirname); //创建一个目录资源, 传入的目录就是资源
-    while ($file = readdir($ds)) { //从目录中读取到条目
-        //这里的$path 表示这个路径下的文件夹,如果不这么去定义,里边执行递归语句的时候,找不到是那个文件夹
-        $path = $dirname . "/" . $file;
-
-        //判断,如果是 . 或者 ..的目录就过滤掉
-        if ($file != "." && $file != "..") {
-            if (is_dir($path)) { //判断如果找到的是目录
-                get_dir_size($path); //如果得到是文件夹,然后递归调用一次方法传入的$path文件夹路径就是判断得到的文件夹赋值给$dirname
-            } else {
-                $tot += filesize($path);
-            }
-        }
-    }
-    return $tot;
-}
-
-/**
- * 递归删除文件夹
- */
-function deldir($path)
-{
-    //如果是目录则继续
-    if (is_dir($path)) {
-        //扫描一个文件夹内的所有文件夹和文件并返回数组
-        $p = scandir($path);
-        foreach ($p as $val) {
-            //排除目录中的.和..
-            if ($val != "." && $val != "..") {
-                //如果是目录则递归子目录,继续操作
-                if (is_dir($path . $val)) {
-                    //子目录中操作删除文件夹和文件
-                    deldir($path . $val . DIRECTORY_SEPARATOR);
-                    //目录清空后删除空文件夹
-                    @rmdir($path . $val . DIRECTORY_SEPARATOR);
-                } else {
-                    //如果是文件直接删除
-                    unlink($path . $val);
-                }
-            }
-        }
-    }
-}
-
-/**
- * 遍历获取目录下的指定类型的文件
- * @param $path
- * @param array $files
- * @return array
- */
-function getfiles($path, $allowFiles, &$files = array())
-{
-    if (!is_dir($path)) return null;
-    if (substr($path, strlen($path) - 1) != '/') $path .= '/';
-    $handle = opendir($path);
-    while (false !== ($file = readdir($handle))) {
-        if ($file != '.' && $file != '..') {
-            $path2 = $path . $file;
-            if (is_dir($path2)) {
-                getfiles($path2, $allowFiles, $files);
-            } else {
-                if (preg_match("/\.(" . $allowFiles . ")$/i", $file)) {
-                    $files[] = array(
-                        'url' => substr($path2, strlen($_SERVER['DOCUMENT_ROOT'])),
-                        'mtime' => filemtime($path2)
-                    );
-                }
-            }
-        }
-    }
-    return $files;
-}

+ 0 - 17
app/controller/sys/config/app.php

@@ -1,17 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | 应用设置
-// +----------------------------------------------------------------------
-
-return [
-    // 应用Trace
-    'app_trace'              => true,
-    // 是否开启权限认证
-    'auth_on'               => true,
-    // 默认分页显示数量
-    'page_size'             => 20,
-    // 版本信息
-    'sys_version'          => '0.1',
-    // 默认密码
-    'default_password' => 'qwe123',
-];

+ 0 - 9
app/controller/sys/config/view.php

@@ -1,9 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | 模板设置
-// +----------------------------------------------------------------------
-
-return [
-    // 开启模板布局
-    'layout_on'    => true,
-];

+ 0 - 8
app/controller/sys/event.php

@@ -1,8 +0,0 @@
-<?php
-// 这是系统自动生成的event定义文件
-return [
-    'listen'  =>    [
-        'SysLog'    =>    ['app\admin\listener\SysUserLog'],
-        // 更多事件监听
-    ],
-];

+ 0 - 15
app/controller/sys/listener/SysUserLog.php

@@ -1,15 +0,0 @@
-<?php
-declare (strict_types = 1);
-
-namespace app\sys\listener;
-
-use app\model\SysLog;
-
-class SysUserLog
-{
-    public function handle($admin)
-    {
-        // 事件监听处理
-        SysLog::record($admin);
-    }
-}

+ 0 - 5
app/controller/sys/middleware.php

@@ -1,5 +0,0 @@
-<?php
-// 这是系统自动生成的middleware定义文件
-return [
-
-];

+ 1 - 1
app/event.php

@@ -9,7 +9,7 @@ return [
         'HttpRun'  => [],
         'HttpEnd'  => [],
         'LogLevel' => [],
-        'LogWrite' => [],
+        'LogWrite' => []
     ],
 
     'subscribe' => [

+ 0 - 21
app/facade/ControllerUtils.php

@@ -1,21 +0,0 @@
-<?php
-declare(strict_types=1);
-
-namespace app\facade;
-
-use think\Facade;
-
-/**
- * @see \app\utils\ControllerUtils
- * @package app\facade
- * @mixin \app\utils\ControllerUtils
- * @method static void makeModel()
- * @method static string codeModel()
- */
-class ControllerFacade extends Facade
-{
-    protected static function getFacadeClass()
-    {
-        return 'app\utils\ControllerUtils';
-    }
-}

+ 0 - 21
app/facade/ModelFacade.php

@@ -1,21 +0,0 @@
-<?php
-declare(strict_types=1);
-
-namespace app\facade;
-
-use think\Facade;
-
-/**
- * @see \app\utils\ModelUtils
- * @package app\facade
- * @mixin \app\utils\ModelUtils
- * @method static void makeModel()
-* @method static string codeModel()
- */
-class ModelFacade extends Facade
-{
-    protected static function getFacadeClass()
-    {
-        return 'app\utils\ModelUtils';
-    }
-}

+ 0 - 20
app/facade/VueFacade.php

@@ -1,20 +0,0 @@
-<?php
-declare(strict_types=1);
-
-namespace app\facade;
-
-use think\Facade;
-
-/**
- * @see \app\utils\VueUtils
- * @package app\facade
- * @mixin \app\utils\VueUtils
- * @method static string codeModel()
- */
-class VueFacade extends Facade
-{
-    protected static function getFacadeClass()
-    {
-        return 'app\utils\VueUtils';
-    }
-}

+ 14 - 7
app/middleware/Admin.php

@@ -13,6 +13,7 @@ use think\facade\Config;
 use think\facade\Session;
 use think\facade\Request;
 use think\exception\HttpResponseException;
+use think\facade\View;
 
 class Admin
 {
@@ -48,9 +49,8 @@ class Admin
         ];
         
         $action = Request::action();
-
-        if ($action != 'index' && !in_array($route, $allow)) {
-            \app\model\SysLog::record();
+        if ($action != 'index' && !in_array($route, $allow) && !(Request::isGet())) {
+            \app\model\SysLog::record($route);
         }
     }
 
@@ -78,7 +78,8 @@ class Admin
             'index/index',      // 首页
             'index/usedspace',      //  使用空间
             'index/clearcache',      // 清除缓存
-            'file_manager/uploadimg',      // 图片上传
+            'file_manager/uploadImage',      // 图片上传
+            'file_manager/ckeditorUploadImage',      // 图片上传
         ];
 
         // 查询所有不验证的方法并放入白名单
@@ -122,11 +123,17 @@ class Admin
         $type = Request::isJson() || Request::isAjax() ? 'json' : 'html';;
 
         if ('html' == strtolower($type)) {
-            $type = 'view';
             $dispatch_error_tmpl = app()->getRootPath().'/vendor/liliuwei/thinkphp-jump/src/tpl/dispatch_jump.tpl';
-            $response = Response::create($dispatch_error_tmpl, $type)->assign($result)->header([]);
+            
+            View::assign($result);
+        
+            View::engine()->layout(false);
+            
+            $data = View::fetch($dispatch_error_tmpl);
+
+            $response = Response::create($data, $type);
         } else {
-            $response = Response::create($result, $type)->header([]);
+            $response = Response::create($result, $type);
         }
 
         throw new HttpResponseException($response);

+ 23 - 10
app/model/Article.php

@@ -11,9 +11,11 @@ use think\facade\Config;
 
 class Article extends Base
 {
+    protected $pk = 'id';
+
     protected $schema = [
-        "id"          => "int",
-        "cid"         => "int",
+        "id"          => "integer",
+        "cid"         => "integer",
         "title"       => "varchar",
         "writer"      => "varchar",
         "source"      => "varchar",
@@ -21,14 +23,14 @@ class Article extends Base
         "keywords"    => "varchar",
         "summary"     => "varchar",
         "content"     => "varchar",
-        "discussed"   => "int",
-        "status"      => "int",
-        "top"         => "int",
-        "sort"       => "int",
-        "hits"        => "int",
-        "likes"       => "int",
-        "content_type"=> "int",
-        "userid"      => "int",
+        "discussed"   => "integer",
+        "status"      => "integer",
+        "top"         => "integer",
+        "sort"       => "integer",
+        "hits"        => "integer",
+        "likes"       => "integer",
+        "content_type"=> "integer",
+        "userid"      => "integer",
         "username"    => "varchar",
         "create_time" => "int",
         "update_time" => "int"
@@ -81,6 +83,12 @@ class Article extends Base
             $where[] = ['create_time','between', [$days['firstday'], $days['lastday']]];
         }
 
+        if (!empty($params['year']) && !empty($params['month'])) {
+            $days = month_frist_and_last_day($params['year'], $params['month']);
+
+            $where[] = ['create_time','between', [$days['firstday'], $days['lastday']]];
+        }
+
         $limit = empty($params['limit']) ? Config::get('app.page_size', 20) : (int)$params['limit'];
         
         $order = ['id desc'];
@@ -169,4 +177,9 @@ class Article extends Base
 
         return $timeList;
     }
+
+    public static function getKeywordsById(int $id) {
+        $article = self::where("id", $id)->find();
+        return $article->keywords;
+    }
 }

+ 10 - 1
app/model/ArticleDolikeLog.php

@@ -3,5 +3,14 @@ namespace app\model;
 
 class ArticleDolikeLog extends \think\Model
 {
-    
+    protected $pk = 'id';
+
+    protected $schema = [
+        "id"          => "int",
+        "aid"         => "int",
+        "ip"          => "varchar",
+        "create_time" => "int"
+    ];
+
+    protected $autoWriteTimestamp = false;
 }

+ 19 - 7
app/model/Category.php

@@ -8,19 +8,17 @@ namespace app\model;
  */
 class Category extends Base
 {
+    protected $pk = 'id';
+
     protected $schema = [
         "id"          => "int",
         "parent_id"   => "int",
         "name"        => "varchar",
         "url"         => "varchar",
         "route"       => "varchar",
-        "tablename"   => "varchar",
-        "template"    => "varchar",
         "type"        => "int",
         "is_nav"      => "int",
-        "remark"       => "varchar",
         "sort"        => "int",
-        'status'      => "varchar",
         "title"       => "varchar",
         "keywords"    => "varchar",
         "description" => "varchar",
@@ -44,8 +42,7 @@ class Category extends Base
 
         $order = isset($param['order']) ? (string) $param['order'] : "sort ASC,id DESC";
 
-        return self::where($where)->field("id,parent_id,name,url,route,tablename,template,type,is_nav,remark,sort,title,keywords,
-            description,is_blank,create_time,update_time")->order($order)->select();
+        return self::where($where)->field("id,parent_id,name,url,route,type,is_nav,sort,is_blank,create_time")->order($order)->select();
     }
 
     // 导航状态修改 1,显示; 0,不显示
@@ -53,11 +50,26 @@ class Category extends Base
     {
         try {
             $info         = self::find($id);
-            $info->is_nav = 1 - $info['is_nav'];
+            $info->is_nav = -1 - $info['is_nav'];
             $info->save();
             return json(['code' => 0, 'msg' => '修改成功!', 'is_nav'=>$info->is_nav]);
         } catch (\Exception $e) {
             return json(['code' => 1, 'msg' => $e->getMessage()]);
         }
     }
+
+    public static function selectOne()
+    {
+        $list = self::where('type', 1)->field("id, parent_id,name")->select();
+
+        $top = new static([
+            "id"=> 0,
+            "parent_id" => -1,
+            "name" => "顶级栏目"
+        ]);
+
+        $list->push($top);
+
+        return list_tree($list, 'id', 'parent_id', 'child', -1);
+    }
 }

+ 0 - 66
app/model/FileManager.php

@@ -1,66 +0,0 @@
-<?php
-declare(strict_types=1);
-
-namespace app\model;
-
-use think\facade\Config;
-
-class FileManager extends \think\Model
-{
-    protected $pk = "fileid";
-
-    protected $schema = [
-        'fileid'        => "int",      // '文件id'
-        'filename'      => "varchar",  // '文件名称'
-        'filesize'      => "int",      // '文件大小字节'
-        'filetime'      => "int",      // '文件上传时间'
-        'filepath'      => "varchar",  // '文件路径'
-        'fileextension' => "varchar",  // '文件扩展名'
-        'title'         => "varchar",  // '文件title'
-        'type'          => "int",      // '0为附件,1为图片,2为Flash文件,3为多媒体文件'
-        'onclick'       => "int",      // '下载量'
-        'username'      => "varchar",  // '上传者'
-        'cid'           => "int",      // '栏目ID'
-        'infoid'        => "int",      // '信息ID', 
-        'cjid'          => "int",       // '信息临时ID'
-        'hash_md5'       => "varcahr"       // hash值(MD5)
-    ];
-
-    protected $autoWriteTimestamp = false;
-
-    public static function queryPage(array $param = [])
-    {
-        $limit = (int)$param['limit'];
-
-        $where = [];
-
-        return self::where($where)->field('fileid,filename,filesize,filetime,filepath,fileextension,title,username')->paginate(['list_rows'=>$limit, 'query' => $param]);
-    }
-
-    public static function saveFileInfo(\think\File $file)
-    {
-        $fileinfo = self::where('hash_md5', $file->md5())->find();
-
-        $publicRootPath = str_replace('\\', '/', Config::get('filesystem.disks.public.root'));
-
-        $publicUrlPath =  Config::get('filesystem.disks.public.url');
-
-        if ($fileinfo == null) {
-            $fileinfo = new static();
-        } elseif ($publicRootPath . $fileinfo->filepath == $file->getPathname())  { // 路径不同的文件
-            $fileinfo = new static();
-        }
-
-        $fileinfo->filename       = $file->getFilename();
-        $fileinfo->filesize       = $file->getSize();
-        $fileinfo->filetime       = $file->getCTime();
-        $fileinfo->filepath       = $publicUrlPath . str_replace($publicRootPath, '', $file->getPathname());
-        $fileinfo->fileextension  = $file->getExtension();
-        $fileinfo->username       = 'system';
-        $fileinfo->hash_md5       = $file->md5();
-
-        $fileinfo->save();
-        
-        return $fileinfo;
-    }
-}

+ 2 - 4
app/model/SysLog.php

@@ -25,7 +25,7 @@ class SysLog extends Model
     }
 
     // 管理员日志记录
-    public static function record()
+    public static function record($route = "")
     {
         // 入库信息
         $userid   = Session::get('adminuser.userid', 0);
@@ -37,9 +37,7 @@ class SysLog extends Model
         $userAgent = Request::server('HTTP_USER_AGENT');
 
         // 标题处理
-        $route = strtolower(preg_replace('/(?<=[a-z])([A-Z])/', '_$1', Request::controller())) . '/' . strtolower(preg_replace('/(?<=[a-z])([A-Z])/', '_$1', Request::action()));
-        
-        $active =  \app\model\SysMenu::where('url', $route)->find();
+        $active = \app\model\SysMenu::where('url', $route)->find();
 
         $title =  $active != null ? $active['name'] : "";
 

+ 15 - 0
app/model/SysMenu.php

@@ -6,6 +6,21 @@ use think\facade\Db;
 
 class SysMenu extends Model
 {
+    protected $pk = 'id';
+
+    protected $schema = [
+        "id" => "int",
+        "pid" => "int",
+        "name" => "varchar",
+        "url" => "varchar",
+        "type" => "tinyint",
+        "method" => "tinyint",
+        "icon" => "varchar",
+        "sort" => "smallint",
+        "open" => "tinyint",
+        "index_button" => "tinyint"
+    ];
+
     public static function getUserMenuList($rid)
     {
         if ($rid === 1) {   // 超级管理员

+ 14 - 1
app/model/SysUser.php

@@ -78,6 +78,19 @@ class SysUser extends Base
             }
         }
     }
+    
+    // 状态修改 1,正常; 2,非正常
+    public static function state(int $id)
+    {
+        try {
+            $info         = self::find($id);
+            $info->status = -1 - $info['status'];
+            $info->save();
+            return json(['code' => 0, 'msg' => '修改成功!', 'status'=>$info->status]);
+        } catch (\Exception $e) {
+            return json(['code' => 1, 'msg' => $e->getMessage()]);
+        }
+    }
 
     public static function checkLogin()
     {
@@ -116,7 +129,7 @@ class SysUser extends Base
             return json(['code' => 2, 'msg' => '用户名/密码不正确']);
         }
 
-        if ($info->status == 1) {
+        if ($info->status === 0) {
             // 更新登录IP,登录时间和更新次数
             $perTime = $info->per_time;
             $perIp = $info->per_ip;

+ 41 - 1
app/model/System.php

@@ -1,9 +1,11 @@
 <?php
+
 /**
  * +----------------------------------------------------------------------
- * | 管理员登录日志模型
+ *管理员登录日志模型
  * +----------------------------------------------------------------------
  */
+
 namespace app\model;
 
 // 引入框架内置类
@@ -11,4 +13,42 @@ use think\Model;
 
 class System extends Model
 {
+    protected $pk = 'id';
+
+    protected $schema = [
+        "id" => "int", // "编号  "
+        "create_time" => "int", // "创建时间    "
+        "update_time" => "int", // "更新时间    "
+        "name" => "varchar", // "网站名称    "
+        "logo" => "varchar", // "网站LOGO    "
+        "icp" => "varchar", // "备案号"
+        "copyright" => "varchar", // "版权信息    "
+        "url" => "varchar", // "网站地址    "
+        "address" => "varchar", // "公司地址    "
+        "contacts" => "varchar", // "联系人"
+        "tel" => "varchar", // "联系电话    "
+        "mobile_phone" => "varchar", // "手机号码    "
+        "fax" => "varchar", // "传真号码    "
+        "email" => "varchar", // "邮箱账号    "
+        "qq" => "varchar", // "QQ    "
+        "qrcode" => "varchar", // "二维码"
+        "title" => "varchar", // "SEO标题     "
+        "key" => "varchar", // "SEO关键字   "
+        "des" => "varchar", // "SEO描述     "
+        "tongji" => "varchar", // "统计代码    "
+        "mobile" => "tinyint", // "手机端"
+        "code" => "tinyint", // "后台验证码  "
+        "message_code" => "tinyint", // "前台验证码  "
+        "message_send_mail" => "tinyint", // "留言邮件提醒"
+        "template_opening" => "tinyint", // "模板修改备份"
+        "template" => "varchar", // "模板目录    "
+        "html" => "varchar", // "Html目录    "
+        "other" => "varchar", // "其他  "
+        "upload_driver" => "tinyint", // "上传驱动    "
+        "upload_file_size" => "varchar", // "文件限制    "
+        "upload_file_ext" => "varchar", // "文件格式    "
+        "upload_image_size" => "varchar", // "图片限制    "
+        "upload_image_ext" => "varchar", // "图片格式    "
+        "editor" => "tinyint" // "编辑器"
+    ];
 }

+ 6 - 40
app/model/Tag.php

@@ -7,53 +7,19 @@ use app\model\Base;
 
 class Tag extends Base
 {
-    protected $pk = 'tagid';
+    protected $pk = 'id';
 
     protected $schema = [
-        "tagid"       => "int",
+        "id"       => "int",
         "tagname"     => "varchar",
         "nums"        => "int",
-        "create_time" => "int",
-        "update_time" => "int"
+        "create_time" => "int"
     ];
+    // 关闭自动写入update_time字段
+    protected $updateTime = false;
 
     public static function queryList($tagname)
     {
-        return self::where('tagname','LIKE', '%'.$tagname.'%')->field('tagid, tagname')->select();
-    }
-
-    public static function saveTags(array $tags, int $infoid = 0, int $cid = 0)
-    {
-        foreach ($tags as  $tagname) {
-            $tag = self::where('tagname', $tagname)->find();
-
-            if ($tag == null) {
-                $tag = new static;
-                $tag->tagname = $tagname;
-            }
-            $tag->nums += 1;
-            $tag->save();
-
-            TagArticle::create([
-                'infoid' => $infoid,
-                'cid'    => $cid,
-                'tagid'  => $tag->tagid
-            ]);
-        }
-    }
-
-    public static function decNums(array $tags, int $infoid=0)
-    {
-        foreach ($tags as  $tagname) {
-            $tag = self::where('tagname', $tagname)->find();
-
-            if ($tag != null) {
-                $tag->nums = $tag->nums - 1;
-                
-                $tag->save();
-
-                TagArticle::where(['infoid'=>$infoid, 'tagid'=>$tag->tagid])->delete();
-            }
-        }
+        return self::where('tagname','LIKE', '%'.$tagname.'%')->field('id, tagname, nums')->select();
     }
 }

+ 44 - 11
app/model/TagArticle.php

@@ -1,41 +1,74 @@
 <?php
+
 declare(strict_types=1);
 
 namespace app\model;
 
-use think\facade\Config;
 use think\facade\Db;
 
 use app\model\Base;
-use app\model\Article;
+use app\model\Tag;
 
 class TagArticle extends Base
 {
-    protected $pk = 'atid';
+    protected $pk = 'id';
 
     protected $schema = [
-        'atid'   => "int",
-        "infoid" => "int",
-        "cid"    => "int",
-        "tagid"  => "int",
+        'id'   => "int",  // 主键id
+        "tid"  => "int",  // 标签id
+        "aid" => "int",   // 文章id
+        "cid"    => "int", // 栏目id
     ];
 
     protected $autoWriteTimestamp = false;
 
     public function article()
     {
-        return $this->belongsTo('Article', 'infoid')->bind(['id','title','titlepic','summary','hits','create_time','username']);
+        return $this->belongsTo('Article', 'aid')->bind(['title', 'titlepic', 'summary', 'hits', 'create_time', 'username']);
     }
 
     public function category()
     {
-        return $this->belongsTo('Category', 'cid')->bind(['category_url'=>'url','category_name'=>'name']);
+        return $this->belongsTo('Category', 'cid')->bind(['category_url' => 'url', 'category_name' => 'name']);
     }
 
     public static function queryList($tagid)
     {
-        $limit = (int) Config::get('app.page_size', 20);
+        return self::with(['article', 'category'])->where('tid', $tagid)->order('aid DESC')->paginate();
+    }
+
+    public static function saveArticleTag(array $tags, int $aid, int $cid)
+    {
+        foreach ($tags as  $tagname) {
+            $tag = Tag::where('tagname', $tagname)->findOrEmpty();
+            if ($tag->isEmpty()) {
+                $tag->tagname = $tagname;
+            }
+            $tag->nums += 1;
+            $tag->save();
+
+            self::create([
+                'tid' => $tag->id,
+                'aid' => $aid,
+                'cid' => $cid
+            ]);
+        }
+    }
+
+    public static function delArticleTag(array $tags, int $aid)
+    {
+        foreach ($tags as  $tagname) {
+            $tag = Tag::where('tagname', $tagname)->findOrEmpty();
+
+            if ($tag != null) {
+                $tag->nums = $tag->nums - 1;
+                
+                $tag->nums = $tag->nums > 0 ? $tag->nums : 0;
+
+                $tag->save();
 
-        return self::with(['article','category'])->where('tagid', $tagid)->order('infoid DESC')->limit($limit)->paginate();
+                self::where(['aid'=>$aid, 'tid'=>$tag->id])->delete();
+            }
+        }
     }
 }

+ 0 - 173
app/service/FileService.php

@@ -1,173 +0,0 @@
-<?php
-declare(strict_types=1);
-
-/**
- * 文件 service
- *
- * @version      0.0.1
- * @author      by huwhois
- * @time        2021/12/28
- */
-
-namespace app\common\service;
-
-use think\Image;
-use think\Exception;
-use think\File;
-use think\image\Exception as ImageException;
-use think\facade\Config;
-
-class FileService
-{
-    /**
-     * 图片添加水印
-     * @param File $file  要处理的文件
-     * @param int $type  水印类型 0 图片水印, 1 文字水印 
-     * @param string $waterimg  图片水印内容
-     * @param string $watertext  文字水印内容
-     * @param string $fonttype  水印文字类型
-     * @param int $fontsize  水印文字大小
-     * @param string $fontcolor  水印文字颜色
-     * @return Image  返回图片对象
-     */
-    public function waterMark(Image $image, int $type = 0, string $watermark = '', string $watertext = '', 
-        string $fonttype = '', int $fontsize = 0, string $fontcolor = '#ffffff30'): Image
-    {
-        if ($type == 0) {
-            $watermark = $watermark ?: Config::get('filesystem.water.watermark');
-            $image->water($watermark);
-        } else {
-            $watetext = $watertext ?: Config::get('filesystem.water.watertext');
-            $fonttype = $fonttype ?: Config::get('filesystem.water.fonttype');
-            $fontsize = $fontsize ?: (int) Config::get('filesystem.water.fontsize');
-            $fontcolor = $fontcolor ?: (int) Config::get('filesystem.water.fontcolor');
-
-            $image->text($watetext, $fonttype, $fontsize, $fontcolor);
-        }
-
-        return $image;
-    }
-
-    /**
-     * 生成缩略图
-     * @param Image $image  要处理的文件
-     * @param int $width 缩略图宽值, 默认 384px;
-     * @param int $height 缩略图高值, 默认 224px;
-     * @param int $type 缩略图裁剪方式, 默认值 1,固定尺寸缩放; 其他: 1,等比例缩放;2,缩放后填充;3,居中裁剪;4,左上角裁剪;5,右下角裁剪
-     * @param string $t_suffix  缩略图后缀
-     * @return Image  返回图片对象
-     */
-    public function thumbnail(Image $image, string $thumbname, int $width = 384, int $height = 224, int $type = 1)
-    {
-        $image->thumb($width, $height, $type)->save('./storage/' . $thumbname);
-
-        return $image;
-    }
-
-    /**
-     * 保存远程图片到本地
-     */
-    public function downloadUrlImg(string $url)
-    {
-        $ch = curl_init($url);
-        curl_setopt($ch, CURLOPT_HEADER, 0);
-        curl_setopt($ch, CURLOPT_NOBODY, 0); // 只取body头
-        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
-        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
-        curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- 
-        $package = curl_exec($ch);
-        $httpinfo = curl_getinfo($ch);
-        
-        curl_close($ch);
-
-        $imageAll = array_merge(array(
-            'imgBody' => $package
-        ), $httpinfo);
-        if ($httpinfo['download_content_length'] > 4 * 1024 * 1024) {
-            throw new Exception("文件太大", 1);
-        }
-
-        $type = null;
-
-        switch ($imageAll['content_type']) {
-            case 'image/gif':
-                $type = "gif";
-                break;
-            case 'image/webp':
-                $type = "webp";
-                break;
-            case 'image/jpeg':
-                $type = "jpg";
-                break;
-            case 'image/png':
-                $type = "png";
-                break;
-            default:
-                $type = null;
-                break;
-        }
-
-        // 腾讯公众号图片
-        if(strpos($url,'qpic.cn') !== false){
-            $urls = parse_url($url);
-        
-            if (isset($urls['query'])) {
-                $query_arr = [];
-                
-                parse_str($urls['query'], $query_arr);
-        
-                $type = isset($query_arr['wx_fmt']) ? $query_arr['wx_fmt'] : null;
-        
-                $type = $type == 'jpeg' ? 'jpg' : $type;
-            }
-        }
-
-        if (!$type) {
-            throw new Exception("不支持的文件后缀", 1);
-        }
-
-        $temp = app()->getRuntimePath() . 'temp';
-
-        if (!file_exists($temp)) {
-            mkdir($temp, 0755);
-        }
-
-        $tempname = $temp . '/php.' . $type;
-
-        file_put_contents($tempname, $imageAll["imgBody"]);
-
-        return new File($tempname);
-    }
-
-    /**
-     * 遍历获取目录下的指定类型的文件
-     * @param $path
-     * @param $allowFiles  png|jpg|jpeg|gif|bmp|webp
-     * @param array $files
-     * @return array
-     */
-    public function getFiles($path, $allowFiles = 'png|jpg|jpeg|gif|bmp|webp', &$files = array())
-    {
-        if (!is_dir($path)) return null;
-        if (substr($path, strlen($path) - 1) != '/') $path .= '/';
-        $handle = opendir($path);
-        while (false !== ($file = readdir($handle))) {
-            if ($file != '.' && $file != '..') {
-                $path2 = $path . $file;
-                if (is_dir($path2)) {
-                    self::getFiles($path2, $allowFiles, $files);
-                } else {
-                    if (preg_match("/\.(" . $allowFiles . ")$/i", $file)) {
-                        $files[] = array(
-                            'url' => substr($path2, strlen(app()->getRootPath().'/public') - 1),
-                            'mtime' => filemtime($path2)
-                        );
-                    }
-                }
-            }
-        }
-        return $files;
-    }
-}

+ 0 - 77
app/utils/AliyunSmsUtils.php

@@ -1,77 +0,0 @@
-<?php
-
-// This file is auto-generated, don't edit it. Thanks.
-namespace app\utils;
-
-use think\facade\Env;
-
-use AlibabaCloud\SDK\Dysmsapi\V20170525\Dysmsapi;
-use AlibabaCloud\Tea\Utils\Utils;
-
-use Darabonba\OpenApi\Models\Config;
-use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\SendSmsRequest;
-use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
-use app\model\SmsLog;
-
-class AliyunSmsUtils {
-
-    /**
-     * 使用AK&SK初始化账号Client
-     * @param string $accessKeyId
-     * @param string $accessKeySecret
-     * @return Dysmsapi Client
-     */
-    public static function createClient($accessKeyId, $accessKeySecret){
-        $config = new Config([
-            // 必填,您的 AccessKey ID
-            "accessKeyId" => $accessKeyId,
-            // 必填,您的 AccessKey Secret
-            "accessKeySecret" => $accessKeySecret
-        ]);
-        // 访问的域名
-        $config->endpoint = "dysmsapi.aliyuncs.com";
-        return new Dysmsapi($config);
-    }
-
-    /**
-     * 发送验证码
-     */
-    public static function sendSms($phone, $code)
-    {
-        $access_key_id = Env::get('aliyun.access_key_id');
-        # 必填,您的 AccessKey Secret
-        $access_key_secret = Env::get('aliyun.access_key_secret');
-        # 短信签名名称
-        $sign_name = Env::get('aliyun.sign_name');
-        # 短信模板CODE
-        $template_code = Env::get('aliyun.template_code');
-
-        $client = self::createClient($access_key_id, $access_key_secret);
-
-        $sendSmsRequest = new SendSmsRequest([
-            "signName" => $sign_name,
-            "templateCode" => $template_code,
-            "phoneNumbers" => $phone,
-            "templateParam" => "{\"code\":\"$code\"}"
-        ]);
-
-        $runtime = new RuntimeOptions([]);
-
-        $resp = $client->sendSmsWithOptions($sendSmsRequest, $runtime);
-
-        @SmsLog::create([
-            "phone" => $phone,  // 
-            "sign_name" => $sign_name,  // 签名
-            "template_code" => $template_code,  // 模板id
-            "template_param" => "{\"code\":\"$code\"}",  // 变量
-            "message" => $resp->body->message,  // 返回值信息
-            "request_id" => $resp->body->requestId,  // 请求id
-            "biz_id" => $resp->body->bizId,  // 回执id
-            "code" => $resp->body->code,  // 发送状态
-            "send_time" => date("Y-m-d H:i:s"),  // 发送时间
-        ]);
-
-        return $resp;
-    }
-}
-

+ 0 - 82
app/utils/ControllerUtils.php

@@ -1,82 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace app\utils;
-
-// 引入框架内置类
-use think\facade\Db;
-use think\facade\Config;
-
-/**
- * 模型 utils
- *
- * @version      0.0.1
- * @author      by huwhois
- * @time        2022/08/10
- */
-class ControllerUtils
-{
-    protected $namespace;
-    protected $class;
-
-    protected function getPathName(string $name): string
-    {
-        $name = substr($name, 4);
-
-        return app()->getBasePath() . ltrim(str_replace('\\', '/', $name), '/') . '.php';
-    }
-
-    protected function getStub(): string
-    {
-        return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'controller.stub';
-    }
-
-    /**
-     * 构建Class文件
-     * @return string
-     */
-    protected function buildClass()
-    {
-        $stub = file_get_contents($this->getStub());
-
-        return str_replace(['{%namespace%}', '{%className%}'], [
-            $this->namespace,
-            $this->class
-        ], $stub);
-    }
-
-    /**
-     * 生成 Model 文件
-     * @param  string $name 类目,包含命名空间
-     * @param string $connections 数据库配置, 默认 mysql
-     */
-    public function makeModel(string $name, string $connections = 'mysql')
-    {
-        $pathname = $this->getPathName($name);
-
-        if (is_file($pathname)) {
-            throw new \Exception("Model :' . $name . ' already exists!</error>", 1);
-        }
-
-        if (!is_dir(dirname($pathname))) {
-            mkdir(dirname($pathname), 0755, true);
-        }
-
-        file_put_contents($pathname, $this->codeModel($name, $connections));
-    }
-
-    /**
-     * 生成 Model 不生成文件
-     * @param  string $name 类目,包含命名空间
-     * @return string
-     */
-    public function codeModel(string $name)
-    {
-        $this->namespace = trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\');
-
-        $this->class = str_replace($this->namespace . '\\', '', $name);
-
-        return $this->buildClass();
-    }
-}

+ 9 - 9
app/utils/FileUtils.php

@@ -100,8 +100,6 @@ class FileUtils
 
         $type = null;
 
-        $originalName = "";
-
         switch ($imageAll['content_type']) {
             case 'image/gif':
                 $type = "gif";
@@ -139,19 +137,21 @@ class FileUtils
             throw new Exception("不支持的文件后缀", 1);
         }
 
-        $originalName = pathinfo($url, PATHINFO_EXTENSION) ? basename($url) : basename($url) . '.' . $type;
+        $rootpath = Config::get('filesystem.disks.public.root');
 
-        $temp =  app()->getRuntimePath() . 'temp';
+        $filepath = date("Ymd");
 
-        if (!file_exists($temp)) {
-            mkdir($temp, 0755);
+        if (!file_exists($rootpath . "/" . $filepath)) {
+            mkdir($rootpath . "/" . $filepath, 0755);
         }
+
+        $savename = $filepath . "/" . md5(microtime(true). substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), 0, 6)). "." . $type;
         
-        $tempname = $temp . DIRECTORY_SEPARATOR . 'php' . substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), 0, 6) . '.tmp';
+        $filename = Config::get('filesystem.disks.public.url') . '/' . $savename;
 
-        file_put_contents($tempname, $imageAll["imgBody"]);
+        file_put_contents($rootpath . "/" . $savename, $imageAll["imgBody"]);
 
-        return new UploadedFile($tempname, $originalName, $imageAll["content_type"]);
+        return $filename;
     }
 
     /**

+ 0 - 155
app/utils/ModelUtils.php

@@ -1,155 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace app\utils;
-
-// 引入框架内置类
-use think\facade\Db;
-use think\facade\Config;
-
-/**
- * 模型 utils
- *
- * @version      0.0.1
- * @author      by huwhois
- * @time        2022/08/10
- */
-class ModelUtils
-{
-    protected $namespace;
-    protected $class;
-    protected $tableName;
-    protected $databaseName;
-
-    protected function getPathName(string $name): string
-    {
-        $name = substr($name, 4);
-
-        return app()->getBasePath() . ltrim(str_replace('\\', '/', $name), '/') . '.php';
-    }
-
-    protected function getStub(): string
-    {
-        return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'model.stub';
-    }
-
-    /**
-     * 获取表的主键
-     * @return string
-     */
-    protected function getPrimarykey()
-    {
-        $sql = "SELECT COLUMN_NAME AS pk FROM information_schema.KEY_COLUMN_USAGE WHERE TABLE_NAME = '" . $this->tableName . "' AND table_schema = '.$this->databaseName.' AND CONSTRAINT_NAME = 'PRIMARY'";
-
-        $res = Db::query($sql);
-
-        $pk = empty($res) ? '' : $res[0]['pk'];
-
-        return $pk;
-    }
-
-    /**
-     * 获取表的所有字段信息
-     * @return array
-     */
-    protected function getColumns(string $tableName = '', string $database = '')
-    {
-        $sql = "SELECT column_name,column_comment,data_type FROM information_schema.COLUMNS WHERE TABLE_NAME = '" . $this->tableName . "' AND table_schema = '" . $this->databaseName . "'";
-
-        // echo $sql . "\n";
-
-        $res = Db::query($sql);
-
-        $columns = empty($res) ? [] : $res;
-
-        return $columns;
-    }
-
-    /**
-     * 构建Class文件
-     * @return string
-     */
-    protected function buildClass()
-    {
-        $stub = file_get_contents($this->getStub());
-
-        $primarykey = "";
-
-        $pk = $this->getPrimarykey();
-
-        if ($pk != "" && $pk != "id") {
-            $primarykey = 'protected $pk = "' . $pk . '";';
-        }
-
-        $schemas = '';
-        $autoWriteTimestamp = '';
-        $create_time = false;
-        $update_time = false;
-
-        $columns = $this->getColumns();
-
-        foreach ($columns as $column) {
-            $schemas .= "\n" . '        "' . $column['column_name'] . '" => "' . $column['data_type'] . '",  // ' . $column['column_comment'];
-
-            if ($column['column_name'] == 'create_time') {
-                $create_time = true;
-            }
-
-            if ($column['column_name'] == 'update_time') {
-                $update_time = true;
-            }
-        }
-
-        if (!$create_time || !$update_time) {
-            $autoWriteTimestamp = 'protected $autoWriteTimestamp = false;';
-        }
-
-        return str_replace(['{%namespace%}', '{%className%}', '{%primarykey%}', '{%schemas%}', '{%autoWriteTimestamp%}'], [
-            $this->namespace,
-            $this->class,
-            $primarykey,
-            $schemas,
-            $autoWriteTimestamp
-        ], $stub);
-    }
-
-    /**
-     * 生成 Model 文件
-     * @param  string $name 类目,包含命名空间
-     * @param string $connections 数据库配置, 默认 mysql
-     */
-    public function makeModel(string $name, string $connections = 'mysql')
-    {
-        $pathname = $this->getPathName($name);
-
-        if (is_file($pathname)) {
-            throw new \Exception("Model :' . $name . ' already exists!</error>", 1);
-        }
-
-        if (!is_dir(dirname($pathname))) {
-            mkdir(dirname($pathname), 0755, true);
-        }
-
-        file_put_contents($pathname, $this->codeModel($name, $connections));
-    }
-
-    /**
-     * 生成 Model 不生成文件
-     * @param  string $name 类目,包含命名空间
-     * @param string $connections 数据库配置, 默认 mysql
-     * @return string
-     */
-    public function codeModel(string $name, string $connections = 'mysql')
-    {
-        $this->namespace = trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\');
-
-        $this->class = str_replace($this->namespace . '\\', '', $name);
-
-        $this->tableName = Config::get('database.connections.'.$connections.'.prefix') . strtolower(preg_replace('/(?<=[a-z])([A-Z])/', '_$1', $this->class));
-
-        $this->databaseName = Config::get('database.connections.'.$connections.'.database');
-
-        return $this->buildClass();
-    }
-}

+ 1 - 1
app/utils/ReUtils.php

@@ -62,7 +62,7 @@ class ReUtils
      * @param array   $header 发送的Header信息
      * @return Response
      */
-    public static function result($data, int $code = 0, $msg = '', string $type = '', array $header = []): Response
+    public static function result($data, int $code = 0, $msg = 'success', string $type = '', array $header = []): Response
     {
         $result = [
             'code' => $code,

+ 0 - 115
app/utils/ValidateUtils.php

@@ -1,115 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace app\utils;
-
-// 引入框架内置类
-use think\facade\Db;
-use think\facade\Config;
-
-/**
- * 验证 utils
- *
- * @version      0.0.1
- * @author      by huwhois
- * @time        20228/10
- */
-class ValidateUtils
-{
-    protected $namespace;
-    protected $class;
-    protected $tableName;
-    protected $databaseName;
-
-    protected function getPathName(string $name): string
-    {
-        $name = substr($name, 4);
-
-        return app()->getBasePath() . ltrim(str_replace('\\', '/', $name), '/') . '.php';
-    }
-
-    protected function getStub(): string
-    {
-        return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'validate.stub';
-    }
-
-    /**
-     * 获取表的所有字段信息
-     * @return array
-     */
-    protected function getColumns()
-    {
-        $sql = "SELECT column_name,column_comment,data_type FROM information_schema.COLUMNS WHERE TABLE_NAME = '" . $this->tableName . "' AND table_schema = '" . $this->databaseName . "'";
-
-        // echo $sql . "\n";
-
-        $res = Db::query($sql);
-
-        $columns = empty($res) ? [] : $res;
-
-        return $columns;
-    }
-
-    /**
-     * 构建Class文件
-     * @return string
-     */
-    protected function buildClass()
-    {
-        $stub = file_get_contents($this->getStub());
-
-        $schemas = '';
-
-        $columns = $this->getColumns();
-
-        foreach ($columns as $column) {
-            $schemas .= "\n" . '        "' . $column['column_name'] . '" => "require",';
-        }
-
-        return str_replace(['{%namespace%}', '{%className%}', '{%schemas%}'], [
-            $this->namespace,
-            $this->class,
-            $schemas
-        ], $stub);
-    }
-
-    /**
-     * 生成 Model 文件
-     * @param  string $name 类目,包含命名空间
-     * @param string $connections 数据库配置, 默认 mysql
-     */
-    public function makeModel(string $name, string $connections = 'mysql')
-    {
-        $pathname = $this->getPathName($name);
-
-        if (is_file($pathname)) {
-            throw new \Exception("Valiate :' . $name . ' already exists!</error>", 1);
-        }
-
-        if (!is_dir(dirname($pathname))) {
-            mkdir(dirname($pathname), 0755, true);
-        }
-
-        file_put_contents($pathname, $this->codeModel($name, $connections));
-    }
-
-    /**
-     * 生成 Model 不生成文件
-     * @param  string $name 类目,包含命名空间
-     * @param string $connections 数据库配置, 默认 mysql
-     * @return string
-     */
-    public function codeModel(string $name, string $connections = 'mysql')
-    {
-        $this->namespace = trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\');
-
-        $this->class = str_replace($this->namespace . '\\', '', $name);
-
-        $this->tableName = Config::get('database.connections.'.$connections.'.prefix') . strtolower(preg_replace('/(?<=[a-z])([A-Z])/', '_$1', $this->class));
-
-        $this->databaseName = Config::get('database.connections.'.$connections.'.database');
-
-        return $this->buildClass();
-    }
-}

+ 0 - 120
app/utils/ZipUtils.php

@@ -1,120 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace app\utils;
-
-use ZipArchive;
-
-class ZipUtils
-{
-    public function packZip($source, $dest)
-    {
-        //判断zip扩展是否加载或者文件目录是否存在
-        if (!extension_loaded('zip') || !file_exists($source)) {
-            return false;
-        }
-        //创建一个zip打包文件
-        $zip = new ZipArchive();
-
-        if (!$zip->open($dest, ZipArchive::CREATE)) {
-            return false;
-        }
-
-        $source = str_replace('\\', '/', realpath($source));
-        
-        if (is_dir($source) === true) {
-            //创建件一个目录迭代器
-            $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source));
-
-            foreach ($files as $file) {
-                $file = str_replace('\\', '/', $file);
-                //忽略当前目录和上级目录
-                if (in_array(substr($file, strrpos($file, '/') + 1), array('.', '..'))) {
-                    continue;
-                }
-                if (is_dir($file) === true) {
-                    //创建一个子目录
-                    $zip->addEmptyDir(str_replace($source . '/', '', $file . '/'));
-                } else if (is_file($file) === true) {
-                    //创建一个子文件
-                    $zip->addFromString(str_replace($source . '/', '', $file), file_get_contents($file));
-                } else if (is_file($source) === true) {
-                    //创建文件根目录下的文件
-                    $zip->addFromString(basename($source), file_get_contents($source));
-                }
-            }
-            $zip->close();
-        }
-    }
-
-    protected function addFileToZip(string $path,  ZipArchive $zip)
-    {
-        $handler = opendir($path); //打开当前文件夹由$path指定。
-        while (($filename = readdir($handler)) !== false) {
-            if ($filename != "." && $filename != "..") { //文件夹文件名字为'.'和‘..’,不要对他们进行操作
-                if (is_dir($path . "/" . $filename)) {
-                    $this->addFileToZip($path . "/" . $filename, $zip);
-                } else {
-                    $zip->addFile($path . "/" . $filename);
-                }
-            }
-        }
-        @closedir($handler);
-    }
-
-
-    /**
-     * 删除临时路径
-     * @param $path
-     */
-    public function deleteDir($path)
-    {
-        if (is_dir($path)) {
-            //
-            $dirs = scandir($path);
-            foreach ($dirs as $dir) {
-                if ($dir != '.' | $dir != '..') {
-                    $sonDir = $path . '/' . $dir;
-                    if (is_dir($sonDir)) {
-                        $this->deleteDir($sonDir);
-                        @rmdir($sonDir);
-                    } else {
-                        @unlink($sonDir);
-                    }
-                }
-            }
-            @rmdir($path);
-        }
-    }
-
-    /**
-     * 文件下载
-     * @param $file
-     */
-    public function downLoad($file)
-    {
-        if (file_exists($file)) {
-            $openFile = fopen($file, 'r');
-            //返回文件类型
-            Header('Content-type: application/octet-iostream');
-            //返回文件的字节大小
-            Header('Accept-Range: bytes');
-            //返回文件大小
-            Header('Accept-Length: ' . $file);
-            //这里对客户端弹出的对话框,对应的文件名
-            Header('Content-disposition: filename=' . substr($file, strrpos($file, '/') + 1));
-            $buffer = 1024;
-            while (!feof($openFile)) {
-                $file_data = fread($openFile, $buffer);
-                echo $file_data;
-            }
-            fclose($file);
-
-            @unlink($file);
-        } else {
-
-            echo '下载文件不存在';
-        }
-    }
-}

+ 0 - 64
app/utils/stubs/controller.stub

@@ -1,64 +0,0 @@
-<?php
-declare (strict_types = 1);
-
-namespace {%namespace%};
-
-use think\Request;
-
-class {%className%}
-{
-    /**
-     * 显示资源列表
-     *
-     * @return \think\Response
-     */
-    public function index()
-    {
-        //
-    }
-
-    /**
-     * 保存新建的资源
-     *
-     * @param  \think\Request  $request
-     * @return \think\Response
-     */
-    public function save(Request $request)
-    {
-        //
-    }
-
-    /**
-     * 显示指定的资源
-     *
-     * @param  int  $id
-     * @return \think\Response
-     */
-    public function read($id)
-    {
-        //
-    }
-
-    /**
-     * 保存更新的资源
-     *
-     * @param  \think\Request  $request
-     * @param  int  $id
-     * @return \think\Response
-     */
-    public function update(Request $request, $id)
-    {
-        //
-    }
-
-    /**
-     * 删除指定资源
-     *
-     * @param  int  $id
-     * @return \think\Response
-     */
-    public function delete($id)
-    {
-        //
-    }
-}

+ 0 - 110
app/utils/stubs/form.vue.stub

@@ -1,110 +0,0 @@
-<template>
-  <el-dialog
-    :title="!dataForm.id ? '新增' : '修改'"
-    :close-on-click-modal="false"
-    :visible.sync="visible">
-    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
-#foreach($column in $columns)
-#if($column.columnName != $pk.columnName)
-    <el-form-item label="${column.comments}" prop="${column.attrname}">
-      <el-input v-model="dataForm.${column.attrname}" placeholder="${column.comments}"></el-input>
-    </el-form-item>
-#end
-#end
-    </el-form>
-    <span slot="footer" class="dialog-footer">
-      <el-button @click="visible = false">取消</el-button>
-      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
-    </span>
-  </el-dialog>
-</template>
-
-<script>
-  export default {
-    data () {
-      return {
-        visible: false,
-        dataForm: {
-#foreach($column in $columns)
-#if($column.columnName == $pk.columnName)
-          ${column.attrname}: 0,
-#else
-          ${column.attrname}: ''#if($velocityCount != $columns.size()),#end
-
-#end
-#end
-        },
-        dataRule: {
-#foreach($column in $columns)
-#if($column.columnName != $pk.columnName)
-          ${column.attrname}: [
-            { required: true, message: '${column.comments}不能为空', trigger: 'blur' }
-          ]#if($velocityCount != $columns.size()),#end
-
-#end
-#end
-        }
-      }
-    },
-    methods: {
-      init (id) {
-        this.dataForm.${pk.attrname} = id || 0
-        this.visible = true
-        this.$nextTick(() => {
-          this.$refs['dataForm'].resetFields()
-          if (this.dataForm.${pk.attrname}) {
-            this.$http({
-              url: #[[this.$http.adornUrl]]#(`/${moduleName}/${pathName}/info/#[[$]]#{this.dataForm.${pk.attrname}}`),
-              method: 'get',
-              #[[params: this.$http.adornParams()]]#
-            }).then(({data}) => {
-              if (data && data.code === 0) {
-#foreach($column in $columns)
-#if($column.columnName != $pk.columnName)
-                this.dataForm.${column.attrname} = data.${classname}.${column.attrname}
-#end
-#end
-              }
-            })
-          }
-        })
-      },
-      // 表单提交
-      dataFormSubmit () {
-        #[[this.$refs['dataForm'].validate((valid) => {]]#
-          if (valid) {
-            this.$http({
-              url: #[[this.$http.adornUrl]]#(`/${moduleName}/${pathName}/${!this.dataForm.${pk.attrname} ? 'save' : 'update'}`),
-              method: 'post',
-              #[[data: this.$http.adornData({]]#
-#foreach($column in $columns)
-#if($column.columnName == $pk.columnName)
-                '${column.attrname}': this.dataForm.${column.attrname} || undefined,
-#else
-                '${column.attrname}': this.dataForm.${column.attrname}#if($velocityCount != $columns.size()),#end
-
-#end
-#end
-              })
-            }).then(({data}) => {
-              if (data && data.code === 0) {
-                #[[this.$message({]]#
-                  message: '操作成功',
-                  type: 'success',
-                  duration: 1500,
-                  onClose: () => {
-                    this.visible = false
-                    #[[this.$emit('refreshDataList')]]#
-                  }
-                })
-              } else {
-                #[[this.$message.error(data.msg)]]#
-              }
-            })
-          }
-        })
-      }
-    }
-  }
-</script>
-

+ 0 - 152
app/utils/stubs/index.vue.stub

@@ -1,152 +0,0 @@
-<template>
-  <div class="app-container">
-    <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
-      <el-form-item>
-        <el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
-      </el-form-item>
-      <el-form-item>
-        <el-button @click="getDataList()">查询</el-button>
-        <el-button v-if="isAuth('{%moduleName%}:{%className%}:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
-        <el-button v-if="isAuth('{%moduleName%}:{%className%}:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
-      </el-form-item>
-    </el-form>
-    <el-table
-      :data="dataList"
-      border
-      v-loading="dataListLoading"
-      @selection-change="selectionChangeHandle"
-      style="width: 100%;">
-      <el-table-column
-        type="selection"
-        header-align="center"
-        align="center"
-        width="50">
-      </el-table-column>
-        {%schemas%}
-      <el-table-column
-        fixed="right"
-        header-align="center"
-        align="center"
-        width="150"
-        label="操作">
-        <template slot-scope="scope">
-          <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.{%primarykey%})">修改</el-button>
-          <el-button type="text" size="small" @click="deleteHandle(scope.row.{%primarykey%})">删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    <el-pagination
-      @size-change="sizeChangeHandle"
-      @current-change="currentChangeHandle"
-      :current-page="pageIndex"
-      :page-sizes="[10, 20, 50, 100]"
-      :page-size="pageSize"
-      :total="totalPage"
-      layout="total, sizes, prev, pager, next, jumper">
-    </el-pagination>
-    <!-- 弹窗, 新增 / 修改 -->
-    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
-  </div>
-</template>
-
-<script>
-  import AddOrUpdate from './{%className%}-add-or-update'
-  export default {
-    data () {
-      return {
-        dataForm: {
-          key: ''
-        },
-        dataList: [],
-        pageIndex: 1,
-        pageSize: 10,
-        totalPage: 0,
-        dataListLoading: false,
-        dataListSelections: [],
-        addOrUpdateVisible: false
-      }
-    },
-    components: {
-      AddOrUpdate
-    },
-    activated () {
-      this.getDataList()
-    },
-    methods: {
-      // 获取数据列表
-      getDataList () {
-        this.dataListLoading = true
-        this.$http({
-          url: this.$http.adornUrl('/{%moduleName%}/{%className%}/index'),
-          method: 'get',
-          params: this.$http.adornParams({
-            'page': this.pageIndex,
-            'limit': this.pageSize,
-            'key': this.dataForm.key
-          })
-        }).then(({res}) => {
-          if (res && res.code === 0) {
-            this.dataList = res.data.data
-            this.totalPage = res.data.total
-          } else {
-            this.dataList = []
-            this.totalPage = 0
-          }
-          this.dataListLoading = false
-        })
-      },
-      // 每页数
-      sizeChangeHandle (val) {
-        this.pageSize = val
-        this.pageIndex = 1
-        this.getDataList()
-      },
-      // 当前页
-      currentChangeHandle (val) {
-        this.pageIndex = val
-        this.getDataList()
-      },
-      // 多选
-      selectionChangeHandle (val) {
-        this.dataListSelections = val
-      },
-      // 新增 / 修改
-      addOrUpdateHandle (id) {
-        this.addOrUpdateVisible = true
-        this.$nextTick(() => {
-          this.$refs.addOrUpdate.init(id)
-        })
-      },
-      // 删除
-      deleteHandle (id) {
-        var ids = id ? [id] : this.dataListSelections.map(item => {
-          return item.{%primarykey%}
-        })
-        this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          this.$http({
-            url: this.$http.adornUrl('/{%moduleName%}/{%className%}/delete'),
-            method: 'post',
-            data: this.$http.adornData(ids, false)
-          }).then(({data}) => {
-            if (data && data.code === 0) {
-              this.$message({
-                message: '操作成功',
-                type: 'success',
-                duration: 1500,
-                onClose: () => {
-                  this.getDataList()
-                }
-              })
-            } else {
-              this.$message.error(data.msg)
-            }
-          })
-        }).catch(() => {})
-      }
-    }
-  }
-</script>

+ 0 - 18
app/utils/stubs/model.stub

@@ -1,18 +0,0 @@
-<?php
-declare (strict_types = 1);
-
-namespace {%namespace%};
-
-use think\Model;
-
-/**
- * @mixin \think\Model
- */
-class {%className%} extends Model
-{
-    {%primarykey%}
-    protected $schema = [{%schemas%}
-    ];
-
-    {%autoWriteTimestamp%}    
-}

+ 0 - 21
app/utils/stubs/validate.stub

@@ -1,21 +0,0 @@
-<?php
-declare (strict_types = 1);
-
-namespace {%namespace%};
-
-use think\Validate;
-
-/**
- * @mixin \think\Validate
- */
-class {%className%} extends Validate
-{
-    /**
-     * 定义验证规则
-     * 格式:'字段名' =>  ['规则1','规则2'...]
-     *
-     * @var array
-     */
-    protected $rule = [{%schemas%}
-    ];   
-}

+ 2 - 1
composer.json

@@ -25,7 +25,8 @@
         "topthink/think-orm": "^2.0",
         "liliuwei/thinkphp-jump": "^1.5",
         "topthink/think-image": "^1.0",
-        "erusev/parsedown": "^1.8.0-beta-7"
+        "topthink/think-view": "^1.0.14",
+        "erusev/parsedown": "1.8.0-beta-7"
     },
     "require-dev": {
         "symfony/var-dumper": "^4.2",

+ 11 - 9
composer.lock

@@ -4,20 +4,20 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "bd9adf001985b31c91e1f340b6b0fa64",
+    "content-hash": "57e4da45ff3d3998491c6d8567203e13",
     "packages": [
         {
             "name": "erusev/parsedown",
-            "version": "1.7.4",
+            "version": "1.8.0-beta-7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/erusev/parsedown.git",
-                "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3"
+                "reference": "fe7a50eceb4a3c867cc9fa9c0aa906b1067d1955"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
-                "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
+                "url": "https://api.github.com/repos/erusev/parsedown/zipball/fe7a50eceb4a3c867cc9fa9c0aa906b1067d1955",
+                "reference": "fe7a50eceb4a3c867cc9fa9c0aa906b1067d1955",
                 "shasum": ""
             },
             "require": {
@@ -52,9 +52,9 @@
             ],
             "support": {
                 "issues": "https://github.com/erusev/parsedown/issues",
-                "source": "https://github.com/erusev/parsedown/tree/1.7.x"
+                "source": "https://github.com/erusev/parsedown/tree/1.8.0-beta-7"
             },
-            "time": "2019-12-30T22:54:17+00:00"
+            "time": "2019-03-17T18:47:21+00:00"
         },
         {
             "name": "league/flysystem",
@@ -1246,12 +1246,14 @@
     ],
     "aliases": [],
     "minimum-stability": "stable",
-    "stability-flags": [],
+    "stability-flags": {
+        "erusev/parsedown": 10
+    },
     "prefer-stable": false,
     "prefer-lowest": false,
     "platform": {
         "php": ">=7.1.0"
     },
     "platform-dev": [],
-    "plugin-api-version": "2.2.0"
+    "plugin-api-version": "2.3.0"
 }

+ 4 - 4
config/app.php

@@ -40,11 +40,11 @@ return [
     // 显示错误信息
     'show_error_msg'   => false,
     // 默认分页显示数量
-    'page_size'             => 20,
+    'page_size'        => 20,
     // 版本信息
-    'sys_version'          => '0.1',
+    'sys_version'      => '0.1',
     // 默认密码
-    'default_password' => 'qwe123',
+    'default_password' => env('app.default_password', ""),
     // 是否开启权限认证
-    'auth_on'               => true,
+    'auth_on'          => true,
 ];

+ 1 - 2
config/console.php

@@ -6,7 +6,6 @@ return [
     // 指令定义
     'commands' => [
         'fileconsole' => 'app\command\FileConsole',
-        'makemodel' => 'app\command\MakeModel',
-        'makecontroller' => 'app\command\MakeController',
+        'tagarticleconsole' => 'app\command\TagArticleConsole'
     ],
 ];

+ 25 - 2
public/static/css/index.css

@@ -71,7 +71,7 @@ aside { width: 32%; float: right }
 .paihang ul li { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; line-height: 26px }
 footer { width: 100%; text-align: center; background: #FFF; padding: 10px 0; line-height: 26px; border-top: #333 1px solid; }
 /*list*/
-.place { margin: 10px 0; width: 100%; overflow: hidden; background: #fff; }
+.place { margin: 10px 0;padding: 30px 20px; width: 100%; overflow: hidden; background: #fff; }
 .place a { display: block; float: left; padding: 5px 0; background: #fff; margin: 0 10px; width: 100px; text-align: center }
 .pagelist { text-align: center; color: #666; width: 100%; clear: both; margin: 25px 0 10px 0; padding-top: 20px }
 .pagelist a { color: #666; margin: 0 2px 10px; border: 1px solid #fff; padding: 5px 10px; background: #FFF; display: inline-block; }
@@ -178,7 +178,30 @@ code:not(.language-plaintext,.language-php,.language-c,.language-js,.language-ja
     background-color: #f9f2f4;
 }
 
+.search_place {
+    margin: 10px 0;padding: 30px 20px; width: 100%; overflow: hidden; background: #fff; 
+}
+.search_place input.input-key {
+    width: 66%;
+    padding: 4px;
+    height: 36px;
+    line-height: 36px;
+    font-size: 18px;
+}
+.search_place input.input-submit {
+    margin-left: 2%;
+    padding: 4px;
+    width: 14%;
+    height: 48px;
+    line-height: 48px;
+    font-size: 18px;
+}
+
+
 /* 分页 */
+div.page {
+    text-align: center;
+}
 .pagination {
     display: inline-block;
     padding-left: 0;
@@ -206,7 +229,7 @@ li.disabled {
 }
 
 .pagination li a {
-    color: #3399d5;
+    color: #000;
 }
 
 .pagination li:first-child {

+ 3 - 1
public/static/plugins/.gitignore

@@ -1,7 +1,9 @@
-/ckeditor/ckeditor4
 /h-ui
 /h-ui.admin
 /Hui-iconfont
+<<<<<<< HEAD
 /layer
 /laypage
 /Swiper
+=======
+>>>>>>> 12a23a8ae7cd9871a9ece818a1ef3f502a7edd39

Fichier diff supprimé car celui-ci est trop grand
+ 1 - 0
public/static/plugins/layer/2.4/layer.js


BIN
public/static/plugins/layer/2.4/skin/default/icon-ext.png


BIN
public/static/plugins/layer/2.4/skin/default/icon.png


BIN
public/static/plugins/layer/2.4/skin/default/loading-0.gif


BIN
public/static/plugins/layer/2.4/skin/default/loading-1.gif


BIN
public/static/plugins/layer/2.4/skin/default/loading-2.gif


Fichier diff supprimé car celui-ci est trop grand
+ 6 - 0
public/static/plugins/layer/2.4/skin/layer.css


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 0
public/static/plugins/laypage/1.2/laypage.js


+ 21 - 0
public/static/plugins/laypage/1.2/skin/laypage.css

@@ -0,0 +1,21 @@
+/*!
+ laypage默认样式
+*/
+.laypage_main{font-size:0; clear:both; color:#666}
+.laypage_main *{display:inline-block; vertical-align: top; font-size:12px}
+.laypage_main a{height:26px; line-height:26px; text-decoration:none; color:#666}
+.laypage_main a, .laypage_main span{margin:0 3px 6px; padding:0 10px}
+.laypage_main span{height:26px; line-height:26px}
+.laypage_main input, .laypage_main button{ border:1px solid #ccc; background-color:#fff}
+.laypage_main input{width:40px; height:26px; line-height:26px; margin:0 5px; padding:0 5px}
+.laypage_main button{height:28px; line-height:28px; margin-left:5px; padding:0 10px; color:#666}
+
+/* 默认皮肤 */
+.laypageskin_default a{border:1px solid #ddd; background-color:#fff}
+.laypageskin_default a:hover{ background-color:#5a98de; border-color:#5a98de; color:#fff}
+.laypageskin_default span{height:28px; line-height:28px; color:#999}
+.laypageskin_default .laypage_curr{font-weight:700; color:#666}
+
+/* 一般用于信息流加载 */
+.laypageskin_flow{text-align:center}
+.laypageskin_flow .page_nomore{color:#999}

+ 10 - 55
public/static/sys/js/admin.js

@@ -69,61 +69,6 @@ function pwdFormat6MixNew(pwd) {
     return pwd.match(/^[a-zA-Z]\w{5,17}$/) ? true : false;
 }
 
-// 改变状态
-function status(obj, id) {
-    $.post('status', {
-        'id': parseInt(id)
-    }, function (res) {
-        if (res.code == 0) {
-            topalert({
-                type: 0,
-                content: res.msg,
-                speed: 1000
-            });
-            if (res.status == 1) {
-                var img_str = '<a href="javascript:;" onclick="status(this,' + id + ')" title="正常"><span class="f-20 c-primary"><i class="Hui-iconfont">&#xe601;</i></span></a>';
-            } else {
-                var img_str = '<a href="javascript:;" onclick="status(this,' + id + ')" title="停用"><span class="f-20 c-primary"><i class="Hui-iconfont">&#xe677;</i></span></a>';
-            }
-            $(obj).parents('td.td-status').append(img_str);
-            $(obj).remove();
-        } else {
-            topalert({
-                type: 1,
-                content: res.msg,
-                speed: 1000
-            });
-            return false;
-        }
-    }, 'json');
-}
-
-// 排序
-$(".input-sort").change(function () {
-    var sort = $(this).val();
-    var id = $(this).data('id');
-
-    $.post('sort', {
-        'id': id,
-        'sort': sort
-    }, function (data) {
-        if (data.code == 0) {
-            topalert({
-                type: 0,
-                content: data.msg,
-                speed: 2000
-            });
-        } else {
-            topalert({
-                type: 1,
-                content: data.msg,
-                speed: 2000
-            });
-            return false;
-        }
-    }, 'json');
-});
-
 // 删除条目
 function del(obj, id) {
     layer.confirm('确认要删除吗?', function (index) {
@@ -224,6 +169,16 @@ function topalert(options, callback) {
 }
 
 $(function () {
+    // 全选
+    $("input[name='allcheck']").change(function (e, x) {
+        // console.log(this.checked);
+        if (this.checked) {
+            $('.text-c input[name="checkbox[]"]').prop("checked", true);
+        } else {
+            $('.text-c input[name="checkbox[]"]').prop("checked", false);
+        }
+    })
+
     // 图片预览
     $('.pictureview').hover(function () {
         console.log($(this).children('img').attr('src'));

+ 55 - 33
route/app.php

@@ -9,8 +9,8 @@
 // | Author: liu21st <liu21st@gmail.com>
 // +----------------------------------------------------------------------
 use think\facade\Route;
+use think\facade\Cache;
 use app\model\Category;
-use think\facade\Template;
 use app\model\SysMenu;
 
 Route::pattern([
@@ -23,45 +23,46 @@ Route::pattern([
     'day' => '\d+',
 ]); 
 
-Route::get('/index', 'index/index/index');
-Route::get('/', 'index/index/index');
+Route::get('/index', 'index/index');
+Route::get('/', 'index/index');
 Route::view('/404', '404');
-Route::get('/about', 'index/index/about')->append(['_aside' => true]);
-Route::get('/guest_book', 'index/index/guestBook');
-Route::post('/save_guest_book', 'index/index/saveGuestBook');
+Route::get('/about', 'index/about')->append(['_aside' => true]);
+Route::get('/guest_book', 'index/guestBook');
+Route::post('/save_guest_book', 'index/saveGuestBook');
 
-Route::get('/tags/:name', 'index/article/tag');
-Route::get('/tag/:name', 'index/article/tag');
-Route::get('/all-<page?>', 'index/article/index')->append(['cid' => 0]);
-Route::post('/dolike', 'index/article/dolike');
-Route::get('/detail/<id>-<name>', 'index/article/read');
-Route::get('/:year/<month>-<day>/:id', 'index/article/read');
-Route::get('/:year/<month>-<page?>', 'index/article/archive');
+Route::get('/search', 'article/search');
+Route::get('/tag/:name', 'article/tag');
+Route::get('/<year>-<month>', 'article/archive');
+Route::get('/:id', 'article/read');
+Route::post('/dolike', 'article/dolike');
 
-$list = Category::getList();
+$categoryList = Cache::get('category_list');
 
-foreach ($list as $key => $value) {
-    Route::get($value->url . '-<page?>', $value->route)->append(['cid' => $value->id]);
+if (!$categoryList) {
+    $categoryList = Category::getList();
+    Cache::set("category_list",$categoryList, 3600);
 }
 
-Route::get('sys/index', 'sys.index/index');
-Route::post('sys/index/usedspace', 'sys.index/usedspace');
-Route::post('sys/index/clearcache', 'sys.index/clearcache');
-Route::post('sys/index/countArticle', 'sys.index/countArticle');
-Route::post('sys/index/countIndustry', 'sys.index/countIndustry');
-Route::post('sys/index/countGuestBook', 'sys.index/countGuestBook');
-Route::post('sys/index/saveIndexButton', 'sys.index/saveIndexButton');
-Route::get('sys/login/index', 'sys.login/index');
-Route::post('sys/login/dologin', 'sys.login/dologin');
-Route::get('sys/login/logout', 'sys.login/logout');
-Route::get('sys/verify', 'sys.login/verify');
-Route::post('sys/file_manager/uploadImage', 'sys.file_manager/uploadImage');
-Route::post('sys/file_manager/uploadMoive', 'sys.file_manager/uploadMoive');
-Route::post('sys/file_manager/ckeditorUploadImage', 'sys.file_manager/ckeditorUploadImage');
-Route::post('sys/file_manager/uploadUrlImg', 'sys.file_manager/uploadUrlImg');
+foreach ($categoryList as $category) {
+    if ($category['type'] == 2) {
+        Route::get($category['url'], $category['route']);
+    } else {
+        Route::get($category['url'], $category['route'])->append(['cid'=>$category['id']]);
+    }
+}
 
-Route::group('sys', function () {
-    $menuList = SysMenu::where('type', '<>', '0')->field('id, pid, name, url, icon')->select();
+Route::group('sys', function() {
+    Route::get('index', 'sys.index/index');
+    Route::post('index/usedspace', 'sys.index/usedspace');
+    Route::post('index/clearcache', 'sys.index/clearcache');
+    Route::get('login/index', 'sys.login/index');
+    Route::post('login/dologin', 'sys.login/dologin');
+    Route::get('login/logout', 'sys.login/logout');
+    Route::get('verify', 'sys.login/verify');
+    Route::post('file_manager/uploadImage', 'sys.file_manager/uploadImage');
+    Route::post('file_manager/ckeditorUploadImage', 'sys.file_manager/ckeditorUploadImage');
+    Route::post('file_manager/uploadUrlImg', 'sys.file_manager/uploadUrlImg');
+    $menuList = SysMenu::where('type', '<>', '0')->field('id, pid, name, url, icon')->cache('menu_list', 3600)->select();
     foreach ($menuList as $menu) {
         $menuUrl = $menu->url;
         $router = 'sys.' . $menuUrl;
@@ -69,5 +70,26 @@ Route::group('sys', function () {
     }
 });
 
+
+// Route::post('sys/index/usedspace', 'sys.index/usedspace');
+// ;
+// Route::post('sys/index/countArticle', 'sys.index/countArticle');
+// Route::post('sys/index/countIndustry', 'sys.index/countIndustry');
+// Route::post('sys/index/countGuestBook', 'sys.index/countGuestBook');
+// Route::post('sys/index/saveIndexButton', 'sys.index/saveIndexButton');
+// Route::get('sys/login/index', 'sys.login/index');
+// Route::post('sys/login/dologin', 'sys.login/dologin');
+// Route::get('sys/login/logout', 'sys.login/logout');
+// Route::get('sys/verify', 'sys.login/verify');
+// Route::post('sys/file_manager/uploadImage', 'sys.file_manager/uploadImage');
+// Route::post('sys/file_manager/uploadMoive', 'sys.file_manager/uploadMoive');
+// Route::post('sys/file_manager/ckeditorUploadImage', 'sys.file_manager/ckeditorUploadImage');
+// Route::post('sys/file_manager/uploadUrlImg', 'sys.file_manager/uploadUrlImg');
+// Route::post('sys/category/index', 'sys.category/index');
+
+// Route::group('sys', function () {
+
+// });
+
 Route::get('sys', 'sys.index/index');
 

+ 0 - 2
temp/.gitignore

@@ -1,2 +0,0 @@
-*
-!.gitignore

+ 2 - 2
view/404.html

@@ -47,9 +47,9 @@
   <div class="page-404 text-c" style="margin-top:80px;">
     <p class="error-title"><i class="Hui-iconfont va-m" style="font-size:80px">&#xe656;</i><span class="va-m">
         404</span></p>
-    <p class="error-description">{$e->getMessage() ?? '不好意思,您访问的页面不存在~'}</p>
+    <p class="error-description">'不好意思,您访问的页面不存在~'</p>
     <p class="error-info">
-      您可以:<a href="javascript:;" onclick="history.go(-1)" class="c-primary">&lt; 返回上一页</a>
+      您可以:<a href="javascript:history.back();" onclick="history.go(-1)" class="c-primary">&lt; 返回上一页</a>
       <span class="ml-20">|</span><a href="/" class="c-primary ml-20">去首页 &gt;</a></p>
   </div>
 </body>

+ 3 - 7
view/article/archive.html

@@ -6,7 +6,7 @@
   <div class="blogs">
     {foreach $list as $val}
     <div class="bloglist">
-      <h2><a href="/{$val.create_time|date='Y/m-d'}/{$val.id}.html" title="{$val.title}">{$val.title}</a></h2>
+      <h2><a href="/{$val.id}.html" title="{$val.title}">{$val.title}</a></h2>
       <div class="bloginfo">
         <ul>
           <li class="author"><a href="{:url($val.category_url)}"> {$val.category_name} </a></li>
@@ -18,12 +18,8 @@
       <p>{$val.summary}</p>
     </div>
     {/foreach}
-    <div class="pagelist">
-      {if $page > 1} <a href="/{:str_replace('-','/',$yearMonth)}-{$page-1}.html">«</a> {/if}
-      {for start="1" end="$lastPage+1"}
-      {if $page == $i} <b>{$i}</b>&nbsp; {else /} <a href="/{:str_replace('-','/',$yearMonth)}-{$i}.html">{$i}</a>&nbsp; {/if}
-      {/for}
-      {if $page < $lastPage} <a href="/{:str_replace('-','/',$yearMonth)}-{$page+1}.html">»</a> {/if}
+    <div class="page">
+      {$list|raw}
     </div>
   </div>
   {include file="aside"}

+ 0 - 84
view/article/article.bak.html

@@ -1,84 +0,0 @@
-<link href="/static/highlight/styles/monokai-sublime.css" rel="stylesheet"> 
-
-<div class="box">
-  <div class="blank"></div>
-  <div class="infosbox">
-    <div class="newsview">
-      <h3 class="news_title">{$data.title}</h3>
-      <div class="bloginfo">
-        <ul>
-          <li class="author"><a href="{:url('/lists/'.$cid.'/1')}"> {$cid|model('admin/blog_category')->getCateName} </a></li>
-          <li class=" timer">{$data.pubtime|date="Y-m-d", ###}</li>
-          <li class="view">{$data.clicks} 已阅读</li>
-          <!-- <li class="like">8888888</li> -->
-        </ul>
-      </div>
-      <!-- <div class="tags"><a href="/" target="_blank">个人博客</a> &nbsp; <a href="/" target="_blank">小世界</a></div> -->
-      <div class="news_about"><strong>简介</strong>{$data.summary}</div>
-      <div class="news_con" id="preview">
-
-      </div>
-      <p id="content_md" style="display: none;">{$data.content_md}</p>
-      <p class="diggit"><a href="JavaScript:getLike({$data.id});"> 很赞哦! </a>(<b id="diggnum"> {$data.like} </b>)</p>
-    </div>
-    <div class="nextinfo">
-      {empty name="prev_next.prev"}
-      <p>上一篇:<a href="#">没有了</a></p>
-      {else}
-      <p>上一篇:<a href="/{$prev_next.prev.pubtime|date='Y/m/d', ###}/{$prev_next['prev']['id']}" title="{$prev_next.prev.title}">{$prev_next.prev.title}</a></p>
-      {/empty}
-      {empty name="prev_next.next"}
-      <p>下一篇:<a href="{:url('/time')}">返回列表</a></p>
-      {else}
-      <p>下一篇:<a
-          href="/{$prev_next.next.pubtime|date='Y/m/d', ###}/{$prev_next['next']['id']}"
-          title="{$prev_next.next.title}">{$prev_next.next.title}</a></p>
-      {/empty}
-    </div>
-    <!-- <div class="otherlink">
-      <h2>相关文章</h2>
-      <ul>
-        <li><a href="#" title="##">###</a></li>
-      </ul>
-    </div> -->
-    <div class="news_pl">
-      <h2>文章评论</h2>
-      <ul>
-        <div class="gbko"> </div>
-      </ul>
-    </div>
-  </div>
-  {include file="aside"}
-</div>
-
-<script src="/static/highlight/highlight.pack.js"></script>
-<script src="/static/md/js/marked.js"></script>
-<script type="text/javascript">
-  hljs.initHighlightingOnLoad();
-
-  marked.setOptions({
-    renderer: new marked.Renderer(),
-    gfm: true,
-    tables: true,
-    breaks: false,
-    pedantic: false,
-    sanitize: false,
-    smartLists: true,
-    smartypants: false,
-    highlight: function (code) {
-      return hljs.highlightAuto(code).value;
-    }
-  });
-
-  $("#preview").html(marked($("#content_md").html()));
-  function getLike(id) {
-    var num = parseInt($('#diggnum').text());
-    $.post('/getlike', {
-      'id': id
-    }, function (data) {
-      if (data.code=2) {
-        $('#diggnum').text(num+1);
-      }
-    }, 'json');
-  }
-</script>

+ 8 - 25
view/article/index.html

@@ -1,15 +1,16 @@
 <div class="box">
   <div class="place">
-    <a href="/all.html" class="{$cid==0 ? 'current_category': ''}">All</a>
-    {foreach $cate_lists as $value}
+    {foreach $categoryList as $value}
+    {eq name="value.type" value="0"}
     <a href="{$value.url}" class="{$cid==$value.id ? 'current_category': ''}">{$value.name}</a>
+    {/eq}
     {/foreach}
   </div>
   <div class="blank"></div>
   <div class="blogs">
     {foreach $list as $val}
     <div class="bloglist">
-      <h2><a href="/{$val.create_time|date='Y/m-d'}/{$val.id}.html" title="{$val.title}">{$val.title}</a></h2>
+      <h2><a href="/{$val.id}.html" title="{$val.title}">{$val.title}</a></h2>
       <div class="bloginfo">
         <ul>
           <li class="author"><a href="{$val.category_url}.html"> {$val.category_name} </a></li>
@@ -21,30 +22,12 @@
       <p>{$val.summary}</p>
     </div>
     {/foreach}
-    {lt name="list|count" value="$limit"}
+    {lt name="list->count()" value="$list->listRows()"}
     <p style="text-align: center;">全都给你了, 没有更多啦(╥╯^╰╥).</p>
     {/lt}
-    <div class="pagelist">
-      <a title="Total record">共&nbsp;<b>{$lastPage}</b>&nbsp;页</a>&nbsp;&nbsp;&nbsp;
-      {neq name="page" value="1"}
-      <a href="{$baseUrl}">首页</a>
-      <a href="{$baseUrl}-{$page - 1}">上一页</a>&nbsp;
-      {/neq}
-      <b>{$page}</b>&nbsp;
-      {if ( $lastPage != 0) && ( $lastPage != $page) }
-      <a href="{$baseUrl}-{$page + 1}">下一页</a>&nbsp;
-      <a href="{$baseUrl}-{$lastPage}">尾页</a>
-      {/if}
-      <input type="number" min="1" max="{$lastPage}" name="topage">
-      <a href="javascript:goto()">转到</a>
+    <div class="page">
+      {$list|raw}
     </div>
   </div>
   {include file="aside"}
-</div>
-
-<script>
-  function goto() {
-    var page = $("input[name='topage']").val();
-    window.location.href = "{$baseUrl}-" + page;
-  }
-</script>
+</div>

+ 0 - 45
view/article/lists.bak.html

@@ -1,45 +0,0 @@
-<div class="box">
-  <!-- <div class="place" id="pageContents">
-
-      <a href="/jstt/bj/" target="_blank" id="pagecurrent">心得笔记</a>
-
-      <a href="/jstt/css3/" target="_blank">CSS3|Html5</a>
-
-      <a href="/jstt/web/" target="_blank">网站建设</a>
-
-      <a href="/news/jsex/" target="_blank">JS经典实例</a>
-
-      <a href="/jstt/t/" target="_blank">推荐工具</a>
-  </div> -->
-  <div class="blank"></div>
-  <div class="blogs">
-    {foreach $data.lists as $val}
-    <div class="bloglist">
-      <h2><a href="/read/{$val.id}"
-          title="{$val.title}">{$val.title}</a></h2>
-      <p>{$val.summary}</p>
-    </div>
-    {/foreach}
-    {lt name="data.count" value="$data.num_of_per"}
-    <p style="text-align: center;">全都给你了, 没有更多啦(╥╯^╰╥).</p>
-    {/lt}
-    <div class="pagelist">
-      <a title="Total record">共&nbsp;<b>{$data.pages}</b>页</a>&nbsp;&nbsp;&nbsp;
-      {neq name="page" value="1"}
-      <a href="{:url('/lists/'.$cid.'/1')}">首页</a>
-      <a href="{:url('/lists/'.$cid.'/'.($page - 1))}">上一页</a>&nbsp;
-      {/neq}
-      {php}$start = ceil($page/5)*5-4;{/php}
-      {for start="$start" end="$start+5" comparison="lt" step="1" name="npage"}
-      {eq name="page" value="$npage"}
-      <b>{$npage}</b>&nbsp;
-      {else}
-      <a href="{:url('/lists/'.$cid.'/'.$npage, 'page=')}">{$npage}</a>&nbsp;
-      {/eq}
-      {/for}
-      <a href="{:url('/lists/'.$cid.'/'.($page + 1))}">下一页</a>&nbsp;
-      <a href="{:url('/lists/'.$cid.'/'.$data.pages)}">尾页</a>
-    </div>
-  </div>
-  {include file="aside"}
-</div>

+ 3 - 3
view/article/read.html

@@ -33,13 +33,13 @@
       {empty name="prev_next.prev"}
       <p>上一篇:<a >没有了</a></p>
       {else}
-      <p>上一篇:<a href="/{$prev_next['prev']['create_time']|date='Y/m-d'}/{$prev_next['prev']['id']}" title="{$prev_next.prev.title}">{$prev_next.prev.title}</a></p>
+      <p>上一篇:<a href="/{$prev_next['prev']['id']}" title="{$prev_next.prev.title}">{$prev_next.prev.title}</a></p>
       {/empty}
       {empty name="prev_next.next"}
-      <p>下一篇:<a href="{:url($data.route)}">返回列表</a></p>
+      <p>下一篇:<a href="{:url($data.category_url)}">返回列表</a></p>
       {else}
       <p>下一篇:<a
-          href="/{$prev_next['next']['create_time']|date='Y/m-d'}/{$prev_next['next']['id']}"
+          href="/{$prev_next['next']['id']}"
           title="{$prev_next.next.title}">{$prev_next.next.title}</a></p>
       {/empty}
     </div>

+ 31 - 0
view/article/search.html

@@ -0,0 +1,31 @@
+<div class="box">
+  <div class="search_place">
+    <h2>Search for</h2>
+    <form action="" method="get">
+      <input type="text" value="{$key ?? 'search'}" name="key" id="key" class="input-key">
+      <input type="submit" id="search" value="搜索" class="input-submit">
+    </form>
+  </div>
+  <div class="blank"></div>
+  {notempty name="key"}
+  <div class="blogs" style="width: 100%;">
+    {foreach $list as $val}
+    <div class="bloglist">
+      <h2><a href="/{$val.id}.html" title="{$val.title}">{$val.title}</a></h2>
+      <div class="bloginfo">
+        <ul>
+          <li class="author"><a href="{:url($val.category_url)}"> {$val.category_name} </a></li>
+          <li class="timer">{$val.create_time}</li>
+          <li class="view">{$val.hits} 已阅读</li>
+          <li class="like">{$val.likes}</li>
+        </ul>
+      </div>
+      <p>{$val.summary}</p>
+    </div>
+    {/foreach}
+    <div class="page">
+      {$list|raw}
+    </div>
+  </div>
+  {/notempty}
+</div>

+ 4 - 1
view/article/tag.html

@@ -6,7 +6,7 @@
   <div class="blogs">
     {foreach $list as $val}
     <div class="bloglist">
-      <h2><a href="/{$val.create_time|date='Y/m-d'}/{$val.id}.html" title="{$val.title}">{$val.title}</a></h2>
+      <h2><a href="/{$val.aid}.html" title="{$val.title}">{$val.title}</a></h2>
       <div class="bloginfo">
         <ul>
           <li class="author"><a href="/{$val.route}"> {$val.category_name} </a></li>
@@ -18,6 +18,9 @@
       <p>{$val.summary}</p>
     </div>
     {/foreach}
+    <div class="page">
+      {$list|raw}
+    </div>
   </div>
   {include file="aside"}
 </div>

+ 3 - 7
view/article/time.html

@@ -2,16 +2,12 @@
   <div class="timebox">
     <ul>
       {foreach $list as $val}
-      <li><span>{$val.create_time|date="Y-m-d"}</span><i><a href="/{$val.create_time|date='Y/m-d'}/{$val.id}"
+      <li><span>{$val.create_time|date="Y-m-d"}</span><i><a href="/{$val.id}"
             title="{$val.title}">{$val.title}</a></i></li>
       {/foreach}
     </ul>
   </div>
-  <div class="pagelist">
-    {if $page > 1} <a href="/time-{$page-1}.html">«</a> {/if}
-    {for start="1" end="$lastPage+1"}
-    {if $page == $i} <b>{$i}</b>&nbsp; {else /} <a href="/time-{$i}.html">{$i}</a>&nbsp; {/if}
-    {/for}
-    {if $page < $lastPage} <a href="/time-{$page+1}.html">»</a> {/if}
+  <div class="page">
+    {$list|raw}
   </div>
 </article>

+ 10 - 5
view/aside.html

@@ -1,9 +1,14 @@
 <aside>
+  <div class="paihang">
+    <a href="/search" title="search">
+      <input type="text" value="搜索: 标题、关键词" name="key" id="key" class="aside-search-input" style="width: 95%;height: 20px;padding: 10px;">
+    </a>
+  </div>
   <div class="paihang">
     <h2>最近更新</h2>
     <ul>
       {tp:listbycid cid="0" name="value" limit="7" order="id DESC"}
-      <li><a href="/index/{$value.create_time|date='Y/m-d'}/{$value.id}.html" title="{$value.title}">{$value.title}</a></li>
+      <li><a href="/{$value.id}" title="{$value.title}">{$value.title}</a></li>
       {/tp:listbycid}
     </ul>
   </div>
@@ -11,7 +16,7 @@
     <h2>点击排行</h2>
     <ul>
       {tp:listbycid cid="0" name="value" limit="7" order="hits DESC"}
-      <li><a href="/index/{$value.create_time|date='Y/m-d'}/{$value.id}.html" title="{$value.title}">{$value.title}</a></li>
+      <li><a href="/{$value.id}" title="{$value.title}">{$value.title}</a></li>
       {/tp:listbycid}
     </ul>
   </div>
@@ -19,15 +24,15 @@
     <h2>博文推荐</h2>
     <ul>
       {tp:listbycid cid="0" name="value" limit="7"}
-      <li><a href="/{$value.create_time|date='Y/m-d'}/{$value.id}.html" title="{$value.title}">{$value.title}</a></li>
+      <li><a href="/{$value.id}" title="{$value.title}">{$value.title}</a></li>
       {/tp:listbycid}
     </ul>
   </div>
   <div class="paihang">
     <h2>归档</h2>
     <ul>
-      {tp:listtime name="value" limit="5"}
-      <li><a href="/{:str_replace('-','/',$value->pubmonth)}" title="{$value->pubmonth}">{:str_replace('-','年',$value->pubmonth)}月</a></li>
+      {tp:listtime name="value" limit="0"}
+      <li><a href="/{$value->pubmonth}" title="{$value->pubmonth}">{:str_replace('-','年',$value->pubmonth)}月</a></li>
       {/tp:listtime}
     </ul>
   </div>

+ 192 - 0
view/index/about.html

@@ -22,4 +22,196 @@
       </p>
     </div>
   </div>
+  <style>
+    .comment-respond {
+      background: white;
+      box-shadow: 0 0 2px 0 rgba(58, 58, 58, 0.2);
+      padding: 1.5em 4.6875375%;
+    }
+
+    .guestbook {
+      width: 100%;
+      float: left;
+      padding-bottom: 3em;
+    }
+
+    .guestbook h2 span {
+      font-size: 12px;
+    }
+
+    @media only screen and (max-width: 767px) {
+      .comment-respond {
+        background: white;
+        box-shadow: 0 0 2px 0 rgba(58, 58, 58, 0.2);
+        padding: 1.5em 7.50006%;
+      }
+    }
+
+    h3 {
+      font-size: 1.125em;
+      /* 18px / 16px */
+      line-height: 1.333;
+      /* 24px */
+    }
+
+    .comment-respond p {
+      margin: 1.125em 0;
+    }
+
+    .comment-respond p.comment-notes {
+      margin: 1.5em 0;
+    }
+
+    .comment-respond label {
+      display: block;
+      margin-bottom: 6px;
+      font-weight: 700;
+      font-size: 0.875em;
+      line-height: 1.715;
+    }
+
+    input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="file"]):not([type="image"]),
+    textarea {
+      width: 100%;
+      font-family: "Roboto", "Open Sans", sans-serif;
+      font-weight: 400;
+      padding: 10px 12px;
+      max-width: 27.75em;
+      min-height: 26px;
+      background: #F7F7F7;
+      color: #333333;
+      border: solid 1px #D4D4D4;
+      border-radius: 0;
+      -webkit-appearance: none;
+      -webkit-transition: background 0.2s;
+      transition: background 0.2s;
+    }
+
+    textarea {
+      max-width: 41.625em;
+      overflow: auto;
+    }
+
+    .comment-respond p.form-submit {
+      margin-top: 2.25em;
+    }
+
+    input[type="submit"] {
+      font-size: 0.75em;
+      line-height: 1.5;
+    }
+
+    input[type="submit"] {
+      font-family: "Roboto", "Open Sans", sans-serif;
+      font-weight: 400;
+      padding: 10px 12px;
+      color: #333333;
+      border: solid 1px #333333;
+      background: none;
+      border-radius: 0;
+      -webkit-appearance: none;
+      -webkit-transition: all 0.2s;
+      transition: all 0.2s;
+    }
+
+    .pager {
+      margin-left: 10%;
+      width: 60%;
+      background: red;
+    }
+
+    ul.pager li:first-child {
+      float: left;
+    }
+
+    ul.pager li:last-child {
+      float: left;
+      margin-left: 30%;
+    }
+  </style>
+
+
+  <div class="newsview">
+    <h2>留言</h2>
+    <div class="news_infos">
+      <p>有什么想告诉我说的, 就在这吧ヾ(✿゚▽゚)ノ</p>
+    </div>
+  </div>
+  <!-- #respond -->
+  <div id="respond" class="comment-respond">
+    <h3 id="reply-title" class="comment-reply-title">Leave a Reply</h3>
+    <form action="{:url('/index/save_guest_book')}" method="post" id="comment-form" class="comment-form" novalidate="">
+      <p class="comment-notes"><span id="email-notes">我会妥善保存你的邮箱哒(`・ω・´).</span> 必填项已标记<span class="required">*</span>
+      </p>
+      <p class="comment-form-comment">
+        <label for="comment">Comment*</label>
+        <textarea required="" id="content" name="content" cols="45" rows="8" aria-required="true"></textarea>
+      </p>
+      <p class="comment-form-author">
+        <label for="author">Name*</label>
+        <input id="name" name="name" type="text" placeholder="Jane Doe" value="" size="26">
+      </p>
+      <p class="comment-form-email">
+        <label for="contact">contact*</label>
+        <input id="contact" name="contact" type="text" placeholder="name@email.com or 13355556666" value="" size="26">
+      </p>
+      <p class="comment-form-url">
+        <label for="url">url</label>
+        <input id="url" name="url" type="text" placeholder="https://www.google.com" value="" size="26">
+      </p>
+      <p class="form-submit">
+        <button type="button" id="submit" class="submit">Post Comment</button>
+        <!-- <input type="hidden" name="comment_post_ID" value="23" id="comment_post_ID">
+          <input type="hidden" name="comment_parent" id="comment_parent" value="0"> -->
+      </p>
+    </form>
+    <div>
+      <p class="msg" style="display: none;color: orangered;">提交成功</p>
+    </div>
+  </div><!-- #respond end-->
+  <div class="blank"></div>
+  <div class="guestbook">
+    {php}
+    $list = \app\model\GuestBook::order('id desc')->paginate();
+    {/php}
+    {foreach $list as $val}
+    <div class="bloglist">
+      <div>
+        <h2>{$val.name} <span>{$val.time|date="Y/m/d"}</span></h2>
+      </div>
+      <p>{$val.content}</p>
+    </div>
+    {/foreach}
+    {$list->render()}
+  </div>
+
+  <script>
+    $("#submit").click(function () {
+      $.post('/save_guest_book', {
+        'name': $("#name").val(),
+        'content': $("#content").val(),
+        'contact': $("#contact").val(),
+        'url': $("#url").val(),
+      }, function (res) {
+        console.log(res);
+        if (res.code == 0) {
+          $(".msg").show();
+          var html = '<div class="bloglist"><div><h2>' + res.data.name + ' <span>' + res.data.datetime + '</span></h2>';
+          html += '</div><p>' + res.data.content + '</p></div>';
+          $(".guestbook").prepend(html);
+          setTimeout(() => {
+            $(".msg").hide();
+          }, 1000);
+          $("#comment-form")[0].reset();
+        } else {
+          $(".msg").html(res.msg);
+          $(".msg").show();
+          setTimeout(() => {
+            $(".msg").hide();
+          }, 1000);
+          $(".msg").html('提交成功');
+        }
+      }, 'json');
+    })
+  </script>
 </div>

+ 0 - 138
view/index/error.html

@@ -1,138 +0,0 @@
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
-
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-  <meta name="viewport" content="width=device-width">
-  <meta name='robots' content='noindex,follow' />
-  <title>Comment Submission Failure</title>
-  <style type="text/css">
-    html {
-      background: #f1f1f1;
-    }
-
-    body {
-      background: #fff;
-      color: #444;
-      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
-      margin: 2em auto;
-      padding: 1em 2em;
-      max-width: 700px;
-      -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
-      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
-    }
-
-    h1 {
-      border-bottom: 1px solid #dadada;
-      clear: both;
-      color: #666;
-      font-size: 24px;
-      margin: 30px 0 0 0;
-      padding: 0;
-      padding-bottom: 7px;
-    }
-
-    #error-page {
-      margin-top: 50px;
-    }
-
-    #error-page p {
-      font-size: 14px;
-      line-height: 1.5;
-      margin: 25px 0 20px;
-    }
-
-    #error-page code {
-      font-family: Consolas, Monaco, monospace;
-    }
-
-    ul li {
-      margin-bottom: 10px;
-      font-size: 14px;
-    }
-
-    a {
-      color: #0073aa;
-    }
-
-    a:hover,
-    a:active {
-      color: #00a0d2;
-    }
-
-    a:focus {
-      color: #124964;
-      -webkit-box-shadow:
-        0 0 0 1px #5b9dd9,
-        0 0 2px 1px rgba(30, 140, 190, .8);
-      box-shadow:
-        0 0 0 1px #5b9dd9,
-        0 0 2px 1px rgba(30, 140, 190, .8);
-      outline: none;
-    }
-
-    .button {
-      background: #f7f7f7;
-      border: 1px solid #ccc;
-      color: #555;
-      display: inline-block;
-      text-decoration: none;
-      font-size: 13px;
-      line-height: 26px;
-      height: 28px;
-      margin: 0;
-      padding: 0 10px 1px;
-      cursor: pointer;
-      -webkit-border-radius: 3px;
-      -webkit-appearance: none;
-      border-radius: 3px;
-      white-space: nowrap;
-      -webkit-box-sizing: border-box;
-      -moz-box-sizing: border-box;
-      box-sizing: border-box;
-
-      -webkit-box-shadow: 0 1px 0 #ccc;
-      box-shadow: 0 1px 0 #ccc;
-      vertical-align: top;
-    }
-
-    .button.button-large {
-      height: 30px;
-      line-height: 28px;
-      padding: 0 12px 2px;
-    }
-
-    .button:hover,
-    .button:focus {
-      background: #fafafa;
-      border-color: #999;
-      color: #23282d;
-    }
-
-    .button:focus {
-      border-color: #5b9dd9;
-      -webkit-box-shadow: 0 0 3px rgba(0, 115, 170, .8);
-      box-shadow: 0 0 3px rgba(0, 115, 170, .8);
-      outline: none;
-    }
-
-    .button:active {
-      background: #eee;
-      border-color: #999;
-      -webkit-box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
-      box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
-      -webkit-transform: translateY(1px);
-      -ms-transform: translateY(1px);
-      transform: translateY(1px);
-    }
-  </style>
-</head>
-
-<body id="error-page">
-  <p>
-    <p><strong>ERROR</strong>: {$data.msg}.</p>
-  </p>
-  <p><a href='javascript:history.back()'>&laquo; Back</a></p>
-</body>
-
-</html>

+ 0 - 189
view/index/guest_book.html

@@ -1,189 +0,0 @@
-<style>
-  .comment-respond {
-    background: white;
-    box-shadow: 0 0 2px 0 rgba(58, 58, 58, 0.2);
-    padding: 1.5em 4.6875375%;
-  }
-
-  .guestbook {
-    width: 100%;
-    float: left;
-    padding-bottom: 3em;
-  }
-
-  .guestbook h2 span {
-    font-size: 12px;
-  }
-
-  @media only screen and (max-width: 767px) {
-    .comment-respond {
-      background: white;
-      box-shadow: 0 0 2px 0 rgba(58, 58, 58, 0.2);
-      padding: 1.5em 7.50006%;
-    }
-  }
-
-  h3 {
-    font-size: 1.125em;
-    /* 18px / 16px */
-    line-height: 1.333;
-    /* 24px */
-  }
-
-  .comment-respond p {
-    margin: 1.125em 0;
-  }
-
-  .comment-respond p.comment-notes {
-    margin: 1.5em 0;
-  }
-
-  .comment-respond label {
-    display: block;
-    margin-bottom: 6px;
-    font-weight: 700;
-    font-size: 0.875em;
-    line-height: 1.715;
-  }
-
-  input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="file"]):not([type="image"]),
-  textarea {
-    width: 100%;
-    font-family: "Roboto", "Open Sans", sans-serif;
-    font-weight: 400;
-    padding: 10px 12px;
-    max-width: 27.75em;
-    min-height: 26px;
-    background: #F7F7F7;
-    color: #333333;
-    border: solid 1px #D4D4D4;
-    border-radius: 0;
-    -webkit-appearance: none;
-    -webkit-transition: background 0.2s;
-    transition: background 0.2s;
-  }
-
-  textarea {
-    max-width: 41.625em;
-    overflow: auto;
-  }
-
-  .comment-respond p.form-submit {
-    margin-top: 2.25em;
-  }
-
-  input[type="submit"] {
-    font-size: 0.75em;
-    line-height: 1.5;
-  }
-
-  input[type="submit"] {
-    font-family: "Roboto", "Open Sans", sans-serif;
-    font-weight: 400;
-    padding: 10px 12px;
-    color: #333333;
-    border: solid 1px #333333;
-    background: none;
-    border-radius: 0;
-    -webkit-appearance: none;
-    -webkit-transition: all 0.2s;
-    transition: all 0.2s;
-  }
-
-  .pager {
-    margin-left: 10%;
-    width: 60%;
-    background: red;
-  }
-
-  ul.pager li:first-child {
-    float: left;
-  }
-
-  ul.pager li:last-child {
-    float: left;
-    margin-left: 30%;
-  }
-</style>
-
-<div class="box">
-  <div class="newsview">
-    <h2>留言</h2>
-    <div class="news_infos">
-      <p>有什么想告诉我说的, 就在这吧ヾ(✿゚▽゚)ノ</p>
-    </div>
-  </div>
-  <!-- #respond -->
-  <div id="respond" class="comment-respond">
-    <h3 id="reply-title" class="comment-reply-title">Leave a Reply</h3>
-    <form action="{:url('/index/save_guest_book')}" method="post" id="commentform" class="comment-form" novalidate="">
-      <p class="comment-notes"><span id="email-notes">我会妥善保存你的邮箱哒(`・ω・´).</span> 必填项已标记<span class="required">*</span>
-      </p>
-      <p class="comment-form-comment">
-        <label for="comment">Comment*</label>
-        <textarea required="" id="content" name="content" cols="45" rows="8" aria-required="true"></textarea>
-      </p>
-      <p class="comment-form-author">
-        <label for="author">Name*</label>
-        <input id="name" name="name" type="text" placeholder="Jane Doe" value="" size="26">
-      </p>
-      <p class="comment-form-email">
-        <label for="contact">contact*</label>
-        <input id="contact" name="contact" type="text" placeholder="name@email.com or 13355556666" value="" size="26">
-      </p>
-      <p class="comment-form-url">
-        <label for="url">url</label>
-        <input id="url" name="url" type="text" placeholder="https://www.google.com" value="" size="26">
-      </p>
-      <p class="form-submit">
-        <button type="button" id="submit" class="submit">Post Comment</button>
-        <!-- <input type="hidden" name="comment_post_ID" value="23" id="comment_post_ID">
-        <input type="hidden" name="comment_parent" id="comment_parent" value="0"> -->
-      </p>
-    </form>
-    <div>
-      <p class="msg" style="display: none;color: orangered;">提交成功</p>
-    </div>
-  </div><!-- #respond end-->
-  <div class="blank"></div>
-  <div class="guestbook">
-    {foreach $list as $val}
-    <div class="bloglist">
-      <div>
-        <h2>{$val.name} <span>{$val.time|date="Y/m/d"}</span></h2>
-      </div>
-      <p>{$val.content}</p>
-    </div>
-    {/foreach}
-    {$list->render()}
-  </div>
-</div>
-
-<script>
-  $("#submit").click(function () {
-    $.post('/index/save_guest_book',  {
-      'name': $("#name").val(),
-      'content': $("#content").val(),
-      'contact': $("#contact").val(),
-      'url': $("#url").val(),
-    }, function (res) {
-      console.log(res);
-      if (res.code == 0) {
-        $(".msg").show();
-        var html = '<div class="bloglist"><div><h2>'+res.data.name+'<span>'+res.data.datetime+'</span></h2>';
-          html += '</div><p>'+res.data.content+'</p></div>';
-        $(".guestbook").prepend(html);
-        setTimeout(()=>{
-          $(".msg").hide();
-        }, 1000);
-      } else {
-        $(".msg").html(res.msg);
-        $(".msg").show();
-        setTimeout(()=>{
-          $(".msg").hide();
-        }, 1000);
-        $(".msg").html('提交成功');
-      }
-    }, 'json');
-  })
-</script>

+ 15 - 13
view/index/index.html

@@ -1,19 +1,19 @@
 <div class="box">
   <!-- PHP -->
   <div class="newsbox f_l ">
-    <div class="newstitle"><span><a href="/back.html">+</a></span><b>WEB后端</b></div>
+    <div class="newstitle"><span><a href="/backend.html">+</a></span><b>WEB后端</b></div>
     <ul class="newsli">
       {tp:listbycid cid="2" name="val" limit="7"}
-      <li><a href="/{$val.create_time|date='Y/m-d'}/{$val.id}.html" title="{$val.title}">{$val.title}</a></li>
+      <li><a href="/{$val.id}.html" title="{$val.title}">{$val.title}</a></li>
       {/tp:listbycid}
     </ul>
   </div>
   <!-- notes_data -->
   <div class="newsbox f_r ">
-    <div class="newstitle"><span><a href="/all.html">+</a></span><b>其他</b></div>
+    <div class="newstitle"><span><a href="/front.html">+</a></span><b>WEB前端</b></div>
     <ul class="newsli">
-      {tp:listbycid cid="-1" name="val" limit="7"}
-      <li><a href="/{$val.create_time|date='Y/m-d'}/{$val.id}.html" title="{$val.title}">{$val.title}</a></li>
+      {tp:listbycid cid="1" name="val" limit="7"}
+      <li><a href="/{$val.id}.html" title="{$val.title}">{$val.title}</a></li>
       {/tp:listbycid}
     </ul>
   </div>
@@ -22,7 +22,7 @@
   {tp:listbycid cid="0" name="val" limit="3"}
   <div class="sbox f_l {if $key!=0}ml{/if}">
     <span>{$val.category_name}</span>
-    <h2><a href="/{$val.create_time|date='Y/m-d'}/{$val.id}.html" title="{$val.title}">{$val.title}</a></h2>
+    <h2><a href="/{$val.id}.html" title="{$val.title}">{$val.title}</a></h2>
     <p>{$val.summary}</p>
   </div>
   {/tp:listbycid}
@@ -31,7 +31,7 @@
   <div class="blogs">
     {tp:listbycid cid="0" name="val" limit="15" order="id DESC"}
     <div class="bloglist">
-      <h2><a href="/{$val.create_time|date='Y/m-d'}/{$val.id}.html" title="{$val.title}">{$val.title}</a></h2>
+      <h2><a href="/{$val.id}.html" title="{$val.title}">{$val.title}</a></h2>
       <div class="bloginfo">
         <ul>
           <li class="author"><a href="/{$val.category_url}.html"> {$val.category_name} </a></li>
@@ -44,14 +44,16 @@
     </div>
     {/tp:listbycid}
     <div class="more">
-      <a href="/all.html">更多</a>
+      <a href="/time.html">更多</a>
     </div>
   </div>
   <aside>
     <div class="ztbox">
       <ul>
-        {foreach $cate_lists as $value}
+        {foreach $categoryList as $value}
+        {eq name="value.type" value="0"}
         <li><a href="{$value.url}.html">{$value.name}</a></li>
+        {/eq}
         {/foreach}
       </ul>
     </div>
@@ -59,7 +61,7 @@
       <h2>点击排行</h2>
       <ul>
         {tp:listbycid cid="0" name="value" limit="7" order="hits DESC"}
-        <li><a href="/{$value.create_time|date='Y/m-d'}/{$value.id}.html" title="{$value.title}">{$value.title}</a></li>
+        <li><a href="/{$value.id}.html" title="{$value.title}">{$value.title}</a></li>
         {/tp:listbycid}
       </ul>
     </div>
@@ -67,15 +69,15 @@
       <h2>博文推荐</h2>
       <ul>
         {tp:listbycid cid="0" name="value" limit="7"}
-        <li><a href="/{$value.create_time|date='Y/m-d'}/{$value.id}.html" title="{$value.title}">{$value.title}</a></li>
+        <li><a href="/{$value.id}.html" title="{$value.title}">{$value.title}</a></li>
         {/tp:listbycid}
       </ul>
     </div>
     <div class="paihang">
       <h2>归档</h2>
       <ul>
-        {tp:listtime name="value" limit="5"}
-        <li><a href="/{:str_replace('-','/',$value->pubmonth)}" title="{$value->pubmonth}">{:str_replace('-','年',$value->pubmonth)}月</a></li>
+        {tp:listtime name="value" limit="0"}
+        <li><a href="/{$value->pubmonth}" title="{$value->pubmonth}">{:str_replace('-','年',$value->pubmonth)}月</a></li>
         {/tp:listtime}
       </ul>
     </div>

+ 6 - 4
view/layout.html

@@ -16,9 +16,11 @@
     <div class="logo"><a href="{:url('/index')}">huwhois的自留地</a></div>
     <nav>
       <ul id="starlist">
-        <li><a href="{:url('/index')}">网站首页</a></li>
-        {foreach $categories as $val}
-        <li><a href="{:url($val.url)}">{$val.name}</a></li>
+        <li><a href="{:url('/index')}">首页</a></li>
+        {foreach $categoryList as $val}
+        {eq name="val.is_nav" value="0"}
+        <li><a href="{:url($val.url)}" title="{$val.name}" {eq name="val.is_blank" value="1"}target="_blank"{/eq}>{$val.name}</a></li>
+        {/eq}
         {/foreach}
       </ul>
     </nav>
@@ -29,7 +31,7 @@
   <div class="blank"></div>
 
   <footer>
-    <p>Power by <a href="{:env('domain.email')}" target="_blank">{:env('domain.email')}</a> </p>
+    <p>Power by <a href="mailto:{:env('domain.email')}" target="_blank">{:env('domain.email')}</a> </p>
     <p>备案号:<a href="https://beian.miit.gov.cn/" style="color:blue">{:env('domain.icp')} </a></p>
   </footer>
   {$bdtongji|raw}

+ 0 - 63
view/sys/article/ckeditor4.html

@@ -1,63 +0,0 @@
-<script src="/static/plugins/ckeditor/ckeditor4/ckeditor.js"></script>
-<script>
-if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
-	CKEDITOR.tools.enableHtml5Elements( document );
-
-// The trick to keep the editor in the sample quite small
-// unless user specified own height.
-CKEDITOR.config.height = 300;
-CKEDITOR.config.width = 'auto';
-
-var initSample = ( function() {
-	var wysiwygareaAvailable = isWysiwygareaAvailable(),
-		isBBCodeBuiltIn = !!CKEDITOR.plugins.get( 'bbcode' );
-
-	return function() {
-		var editorElement = CKEDITOR.document.getById( 'editor' );
-
-		// :(((
-		if ( isBBCodeBuiltIn ) {
-			editorElement.setHtml(
-				'Hello world!\n\n' +
-				'I\'m an instance of [url=https://ckeditor.com]CKEditor[/url].'
-			);
-		}
-
-		// Depending on the wysiwygarea plugin availability initialize classic or inline editor.
-		if ( wysiwygareaAvailable ) {
-			CKEDITOR.replace( 'editor' );
-		} else {
-			editorElement.setAttribute( 'contenteditable', 'true' );
-			CKEDITOR.inline( 'editor' );
-
-			// TODO we can consider displaying some info box that
-			// without wysiwygarea the classic editor may not work.
-		}
-	};
-
-	function isWysiwygareaAvailable() {
-		// If in development mode, then the wysiwygarea must be available.
-		// Split REV into two strings so builder does not replace it :D.
-		if ( CKEDITOR.revision == ( '%RE' + 'V%' ) ) {
-			return true;
-		}
-
-		return !!CKEDITOR.plugins.get( 'wysiwygarea' );
-	}
-} )();
-
-initSample();
-
-$("#form-button-save").click(function(){
-    if (!validator().form()) {
-        return false
-    }
-    
-    const content = CKEDITOR.instances.editor.getData();
-    
-    $("<input/>").attr("type","hidden").attr("name", "content").val(content).appendTo($("#form-save"));
-
-    $("#form-save")[0].submit();
-})
-</script>
-

+ 0 - 33
view/sys/article/ckeditor5.html

@@ -1,33 +0,0 @@
-<style>
-    .ck-editor__editable_inline {
-        height: 400px !important;
-    }
-</style>
-<script src="/static/plugins/ckeditor/ckeditor5-build-classic/ckeditor.js"></script>
-<script>
-    ClassicEditor
-        .create(document.querySelector('#editor'), {
-            //功能模块
-            toolbar:
-                ['heading', '|', 'bold', 'italic', 'bulletedList', 'numberedList', '|', 'indent', 'outdent', '|', 'link', 'imageUpload', 'mediaEmbed', '|', 'blockQuote', 'insertTable', 'undo', 'redo']
-            , language: 'zh-cn'
-            //图片上传
-            , ckfinder: {
-                uploadUrl: 'http://192.168.31.123:2000/api/Home/UploadImg'
-            }
-        })
-        .then(editor => {
-            window.editor = editor;
-        })
-        .catch(err => {
-            console.error(err.stack);
-        });
-
-    $("#form-button-save").click(function () {
-        if (!validator().form()) {
-            return false
-        }
-
-        $("#form-save")[0].submit();
-    })
-</script>

+ 2 - 2
view/sys/article/index.html

@@ -61,7 +61,7 @@
                     </td>
                     <td>{$val.id}</td>
                     <td class="text-l">
-                        <a href="/index/{$val.create_time|date='Y/m-d'}/{$val.id}" style="text-decoration:none"
+                        <a href="/{$val.id}" style="text-decoration:none"
                             title="浏览" target="_blank">{$val.title}</a>
                     </td>
                     <td>{$val.category_name}</td>
@@ -76,7 +76,7 @@
                         </div>
                     </td>
                     <td class="td-manage">
-                        <a href="{:url('save',['content_type'=>$val['content_type'], 'id'=>$val['id']])}" title="编辑"
+                        <a href="{:url('/sys/article/save',['content_type'=>$val['content_type'], 'id'=>$val['id']])}" title="编辑"
                             class="btn btn-primary radius">
                             <i class="Hui-iconfont">&#xe6df;</i></a>
                         <a href="javascript:;" title="删除" class="ml-10 btn btn-danger radius"

+ 3 - 4
view/sys/article/save.html

@@ -7,7 +7,6 @@
 <article class="cl pd-20">
     <form action="{:url('/sys/article/save')}" method="post" class="form form-horizontal" id="form-save">
         <input type="hidden" name="id" value="{$data['id']}">
-        <input type="hidden" name="cjid" value="{$data['cjid']}">
         <input type="hidden" name="content_type" value="{$data['content_type']}">
         <div class="row cl">
             <label class="form-label col-xs-4 col-sm-2">
@@ -68,7 +67,7 @@
             <div class="formControls col-xs-6 col-sm-4">
                 <input type="text" class="input-text" value="{$data.titlepic}" name="titlepic" id="titlepic">
                 <div style="width: 160px;height: 160px;">
-                    <a href="javascript:void(0);" onclick="addTitlePic()">
+                    <a href="javascript:void(0);" onclick="uploadPicture()">
                         <img id="view-titlepic"
                             src="{$data.titlepic ? $data.titlepic : '/static/images/upload_picture.png'}" alt="标题图"
                             title="{$data.titlepic ? '更换' : '添加'}标题图" style="max-width: 160px;max-height: 160px;">
@@ -76,7 +75,7 @@
                 </div>
             </div>
             <label class="form-label col-xs-2 col-sm-2">
-                <a class="btn btn-success radius" href="javascript:addTitlePic();">{$data.titlepic ? '更换' :
+                <a class="btn btn-success radius" href="javascript:void(0);" onclick="uploadPicture()">{$data.titlepic ? '更换' :
                     '添加'}标题图</a></label>
             <div class="col-3"> </div>
         </div>
@@ -167,7 +166,7 @@
             //图片上传
             simpleUpload: {
                 // The URL the images are uploaded to.
-                uploadUrl: '/sys/file_manager/ckeditorUploadImage?infoid={$data.id}&cjid={$data.cjid}'
+                uploadUrl: '/sys/file_manager/ckeditorUploadImage'
             },
             //自定义字体
             fontFamily: {

+ 62 - 18
view/sys/article/savemd.html

@@ -64,7 +64,6 @@
 <article class="cl pd-20">
     <form action="{:url('/sys/article/save')}" method="post" class="form form-horizontal" id="form-save">
         <input type="hidden" name="id" value="{$data['id']}">
-        <input type="hidden" name="cjid" value="{$data['cjid']}">
         <input type="hidden" name="content_type" value="{$data['content_type']}">
         <div class="row cl">
             <label class="form-label col-xs-4 col-sm-2">
@@ -125,7 +124,7 @@
             <div class="formControls col-xs-6 col-sm-4">
                 <input type="text" class="input-text" value="{$data.titlepic}" name="titlepic" id="titlepic">
                 <div style="width: 200px;height: 200px;">
-                    <a href="javascript:void(0);" onclick="addTitlePic()">
+                    <a href="javascript:void(0);" onclick="uploadPicture('titlepic')">
                         <img id="view-titlepic"
                             src="{$data.titlepic ? $data.titlepic : '/static/images/upload_picture.png'}" alt="标题图"
                             title="{$data.titlepic ? '更换' : '添加'}标题图" style="max-width: 200px;max-height: 200px;">
@@ -133,7 +132,7 @@
                 </div>
             </div>
             <label class="form-label col-xs-2 col-sm-2">
-                <a class="btn btn-success radius" href="javascript:addTitlePic();">{$data.titlepic ? '更换' :
+                <a class="btn btn-success radius" href="javascript:void(0);"  onclick="uploadPicture('titlepic')">{$data.titlepic ? '更换' :
                     '添加'}标题图</a></label>
             <div class="col-3"> </div>
         </div>
@@ -174,7 +173,7 @@
                     <img src="/static/images/code.png" id="code" onclick="insertText('```\n这里插入代码\n```')" />
                     <img src="/static/images/image.png" id="image" onclick="showDialog()" />
                 </div>
-                <div id="mdeditor" style="width: 100%;height: 400px;">{$data.content}</div>
+                <div id="mdeditor" name="content" style="width: 100%;height: 400px;">{$data.content}</div>
             </div>
         </div>
         <div class="row cl">
@@ -213,9 +212,9 @@
             <div
                 style="width: 160px;height: 160px;margin: 0 auto;display: table-cell;vertical-align: middle;text-align: center;">
                 <img id="view-picture" src="/static/images/upload_picture.png" alt="图片" title="图片"
-                    style="max-width: 120px;max-height: 120px;" onclick="addPicture()">
+                    style="max-width: 120px;max-height: 120px;" onclick="uploadPicture('picture')">
             </div>
-            <input type="text" class="input-text" name="picture" id="picture" value="">
+            <input type="text" class="input-text" name="picture" id="picture" value="" style="width: 90%;margin-left: 5%;">
         </div>
     </div>
     <div style="position: absolute;bottom: 1px;width: 100%;height: 40px;border-top: 1px solid gray;">
@@ -224,6 +223,13 @@
     </div>
 </div>
 
+<!-- 图片上传 -->
+<div>
+    <form id="form-upload_picture">
+        <input type="file" hidden name="image" id="upload_picture">
+    </form>
+</div>
+
 <!--请在下方写此页面业务相关的脚本-->
 <script src="/static/plugins/ace/ace.js"></script>
 <script src="/static/plugins/ace/mode-markdown.js"></script>
@@ -244,18 +250,6 @@
         editor.insert(val); //光标位置插入
     }
 
-    //添加标题图
-    function addTitlePic() {
-        let url = '{:url("file_manager/uploadimg", ["_layer"=>true,"img_id"=>"titlepic","infoid"=>$data.id,"cjid"=>$data.cjid])}'
-        layer_show('添加标题图', url, 800, 500);
-    }
-
-    // 上传图片
-    function addPicture() {
-        let url = '{:url("file_manager/uploadimg", ["_layer"=>true,"img_id"=>"picture","infoid"=>$data.id,"cjid"=>$data.cjid])}'
-        layer_show('插入图片', url, 800, 500);
-    }
-
     //插入图片弹窗取消
     function f_cancel() {
         $('#dialog').hide();
@@ -315,4 +309,54 @@
 
         $("#form-save")[0].submit();
     })
+
+    //添加图片
+    const file = document.getElementById('upload_picture');
+
+    function uploadPicture(name) {
+        // file模拟input点击事件
+        var evt = new MouseEvent("click", {
+            bubbles: false,
+            cancelable: true,
+            view: window,
+        });
+        file.dispatchEvent(evt, uploadfn(name));
+    }
+
+    function uploadfn(name) {
+        file.oninput = function () {
+            if (file.files && file.files[0]) {
+                var formData = new FormData();
+                formData.append("upload_file", file.files[0]);
+                $.ajax({
+                    url: '{:url("/sys/file_manager/uploadImage")}',
+                    type: "post",
+                    data: formData,
+                    processData: false, // 告诉jQuery不要去处理发送的数据
+                    contentType: false, // 告诉jQuery不要去设置Content-Type请求头
+                    dataType: 'json',
+                    success: function (res) {
+                        // console.log(res);
+                        var img = res.data.filename;
+                        $("#view-"+name).attr('src', img);
+                        $("#"+name).val(img);
+                        layer.msg(res.msg, {
+                            icon: 1,
+                            time: 1000
+                        });
+                    },
+                    error: function (res) {
+                        layer.msg(res.msg, {
+                            icon: 5,
+                            time: 1000
+                        });
+                        return false;
+                    },
+                    complete: function () {
+                        document.getElementById('form-upload_picture').reset();
+                    }
+                });
+            }
+        }
+    }
 </script>

+ 0 - 404
view/sys/article/savemdbak.html

@@ -1,404 +0,0 @@
-<style>
-    #toolbar {
-        height: 40px;
-        background-color: #b6b6b6;
-        width: 100%;
-        color: #fff;
-        line-height: 50px;
-    }
-
-    #toolbar img {
-        width: 25px;
-        height: 25px;
-        padding-top: 8px;
-        padding-bottom: 7px;
-        margin-left: 10px;
-    }
-
-    #toolbar img:hover {
-        background: #EBEBEB;
-        cursor: pointer;
-    }
-
-    #dialog {
-        position: fixed;
-        height: 300px;
-        width: 600px;
-        background: #FFFFFF;
-        z-index: 5;
-        left: 30%;
-        border: 1px solid gray;
-        top: 25%;
-        display: none;
-    }
-
-    #cancel {
-        border: 0px none #FFECEC;
-        background: #999999;
-        color: #FFFFFF;
-        padding: 5px 15px;
-        position: absolute;
-        top: 8px;
-        right: 100px;
-    }
-
-    #cancel:hover {
-        background: #AAAAAA;
-    }
-
-    #insert {
-        border: 0px none #FFECEC;
-        background: #BE1A21;
-        color: #FFFFFF;
-        padding: 5px 15px;
-        position: absolute;
-        top: 8px;
-        right: 30px;
-    }
-
-    #insert:hover {
-        background: #CB474D;
-    }
-</style>
-
-<article class="cl pd-20">
-    <form action="{:url('save')}" method="post" class="form form-horizontal" id="form-save">
-        <input type="hidden" name="id" value="{$data['id']}">
-        <input type="hidden" name="cjid" value="{$data['cjid']}">
-        <input type="hidden" name="content_type" value="{$data['content_type']}">
-        <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-2">
-                <span class="c-red">*</span>栏目:</label>
-            <div class="formControls col-xs-8 col-sm-6">
-                <span class="select-box inline">
-                    <select name="cid" class="select" id="cid">
-                        <option value="">所有栏目</option>
-                        {foreach $category_tree as $value}
-                        <option value="{$value.id}" {eq name='data.cid' value="$value.id" }selected{/eq}>{$value.name}
-                        </option>
-                        {notempty name="value.child"}
-                        {foreach $value.child as $val}
-                        <option value="{$val.id}" {eq name='data.cid' value="$val.id" }selected{/eq}>--{$val.name}
-                        </option>
-                        {notempty name="val.child"}
-                        {foreach $val.child as $vo}
-                        <option value="{$vo.id}" {eq name='data.cid' value="$vo.id" }selected{/eq}>&nbsp;&nbsp;└
-                            --{$vo.name}
-                        </option>
-                        {/foreach}
-                        {/notempty}
-                        {/foreach}
-                        {/notempty}
-                        {/foreach}
-                    </select>
-                </span>
-            </div>
-            <div class="col-3"> </div>
-        </div>
-        <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-2">
-                <span class="c-red">*</span>标题:</label>
-            <div class="formControls col-xs-8 col-sm-6">
-                <input type="text" class="input-text" value="{$data.title}" placeholder="请填写标题" id="title" name="title">
-            </div>
-            <div class="col-3"> </div>
-        </div>
-        <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-2">
-                作者: </label>
-            <div class="formControls col-xs-4 col-sm-2">
-                <input type="text" class="input-text" value="{$data.writer}" placeholder="作者" id="writer" name="writer">
-            </div>
-            <label class="form-label col-xs-4 col-sm-2">
-                来源:</label>
-            <div class="formControls col-xs-4 col-sm-2">
-                <input type="text" class="input-text" value="{$data.source}" placeholder="来源" id="source" name="source">
-            </div>
-            <div class="col-3"> </div>
-        </div>
-        <div class="row cl">
-            <div class="col-3"> </div>
-        </div>
-        <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-2">
-                标题图:</label>
-            <div class="formControls col-xs-6 col-sm-4">
-                <input type="text" class="input-text" value="{$data.titlepic}" name="titlepic" id="titlepic">
-                <div style="width: 200px;height: 200px;">
-                    <a href="javascript:void(0);" onclick="addTitlePic()">
-                        <img id="view-titlepic"
-                            src="{$data.titlepic ? $data.titlepic : '/static/images/upload_picture.png'}" alt="标题图"
-                            title="{$data.titlepic ? '更换' : '添加'}标题图" style="max-width: 200px;max-height: 200px;">
-                    </a>
-                </div>
-            </div>
-            <label class="form-label col-xs-2 col-sm-2">
-                <a class="btn btn-success radius" href="javascript:addTitlePic();">{$data.titlepic ? '更换' :
-                    '添加'}标题图</a></label>
-            <div class="col-3"> </div>
-        </div>
-        <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-2">
-                关键词:</label>
-            <div class="formControls col-xs-8 col-sm-6">
-                <input type="text" class="input-text" value="{$data.keywords}" placeholder="关键词" id="source"
-                    name="keywords">
-                <span class="c-red">多个关键词用英文','分割</span>
-            </div>
-            <div class="col-3"> </div>
-        </div>
-        <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-2">内容简介:</label>
-            <div class="formControls col-xs-8 col-sm-6">
-                <textarea name="summary" id="summary" cols="" rows="" class="textarea" placeholder="说点什么...最多输入500个字符"
-                    datatype="*10-100" dragonfly="true" onKeyUp="textarealength(this,500)">{$data.summary}</textarea>
-                <p class="textarea-numberbar">
-                    <em class="textarea-length">0</em>/500
-                </p>
-            </div>
-            <div class="col-3"> </div>
-        </div>
-        <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-2">
-                文章正文:</label>
-        </div>
-        <div class="row cl">
-            <label class="form-label col-xs-1 col-sm-1"></label>
-            <input type="hidden" name="content" value="" id="content">
-            <div class="formControls col-xs-11 col-sm-10">
-                <div id="toolbar">
-                    <img src="/static/images/bold.png" id="bold" onclick="insertText('**这里填写要加粗的文字**')" />
-                    <img src="/static/images/italic.png" id="italic" onclick="insertText('_这里填写要斜体的文字_')" />
-                    <img src="/static/images/hyperlink.png" id="hyperlink" onclick="insertText('[这里写连接的描述](这里填写连接地址)')" />
-                    <img src="/static/images/code.png" id="code" onclick="insertText('```\n这里插入代码\n```')" />
-                    <img src="/static/images/image.png" id="image" onclick="showDialog()" />
-                </div>
-                <div id="mdeditor" style="width: 100%;height: 400px;">{$data.content}</div>
-            </div>
-        </div>
-        <div class="row cl">
-            <label class="form-label col-xs-2 col-sm-2">
-                点击量:</label>
-            <div class="formControls col-xs-4 col-sm-2">
-                <input type="number" class="input-text" value="{$data.hits}" id="hits" name="hits"
-                    style="width: 120px;">
-            </div>
-            <label class="form-label col-xs-2 col-sm-2">
-                排序:</label>
-            <div class="formControls col-xs-4 col-sm-2">
-                <input type="number" class="input-text" value="{$data.sort}" id="sort" name="sort"
-                    style="width: 120px;">
-            </div>
-        </div>
-        <div class="row cl">
-            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
-                <button type="button" class="btn btn-success radius" id="form-button-save">确&nbsp;定</button>
-                <button type="button" class="btn btn-default radius" onclick="window.history.back();"
-                    style="margin-left:20px;">取&nbsp;消</button>
-            </div>
-        </div>
-    </form>
-</article>
-
-<div id="dialog">
-    <div style="position: absolute;height: 40px;width: 100%;background: #FFFFFF;border-bottom: 1px solid gray;">
-        <span style="position: absolute;left: 10px;top: 10px;color: gray;">插入图片</span>
-        <img src="/static/images/X.png" style="height: 25px;width: 25px;position: absolute;right: 10px;top: 10px;cursor: pointer;"
-            onclick="f_cancel()" />
-    </div>
-    <div id="tab-img" class="HuiTab" style="margin-top: 40px;">
-        <div class="tabBar clearfix">
-            <span>本地上传</span>
-            <span>网络文件上传</span>
-            <a onclick="onlinepicture(1)"><span>服务器图片选择</span></a>
-        </div>
-        <div class="tabCon">
-            <div class="step1 active" style="margin-left:30px;">
-                <form id="form-uploadimg" method="post" action="" enctype="multipart/form-data">
-                    <div class="row cl" style="margin-top:20px;">
-                        <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>图片要求: </label>
-                        <div class="formControls col-xs-8 col-sm-8">
-                            格式 jpg,png,gif,jpeg,webp; 大小不超过4M.
-                        </div>
-                        <div class="col-3"> </div>
-                    </div>
-                    <div class="row cl">
-                        <label class="form-label col-xs-2 col-sm-2">
-                            <span class="c-red">*</span>本地上传:</label>
-                        <div class="formControls col-xs-4 col-sm-4">
-                            <input type="file" class="input-text" name="upload_file" id="upload_file">
-                        </div>
-                        <div class="formControls col-xs-2 col-sm-2">
-                            <button class="btn btn-primary radius" type="button" onclick="uploadImg()">上传</button>
-                        </div>
-                        <div style="width: 200px;height: 200px;">
-                            <img id="view-picture" src="/static/images/upload_picture.png" alt="图片"
-                                title="图片" style="max-width: 200px;max-height: 200px;">
-                        </div>
-                        <div class="col-3"> </div>
-                    </div>
-                </form>
-            </div>
-            <!-- 本地上传end -->
-        </div>
-        <div class="tabCon">
-            <div class="step2" style="margin-left:30px;">
-                <form id="form-uploadurlimg" method="post" action="" enctype="multipart/form-data">
-                    <div class="row cl" style="margin-top:20px;">
-                        <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>图片要求: </label>
-                        <div class="formControls col-xs-8 col-sm-8">
-                            格式 jpg,png,gif,jpeg,webp; 大小不超过4M.
-                        </div>
-                        <div class="col-3"> </div>
-                    </div>
-                    <div class="row cl" style="margin-top:20px;">
-                        <label class="form-label col-xs-2 col-sm-2">
-                            <span class="c-red">*</span>图片地址:</label>
-                        <div class="formControls col-xs-8 col-sm-8">
-                            <input type="text" class="input-text" name="url_file" id="url_file">
-                        </div>
-                        <div class="formControls col-xs-2 col-sm-2">
-                            <button class="btn btn-primary radius" type="button" onCLick="uploadUrlImg()">确定</button>
-                        </div>
-                        <div style="width: 200px;height: 200px;">
-                            <img id="view-picture-url" src="/static/images/upload_picture.png" alt="图片"
-                                title="图片" style="max-width: 200px;max-height: 200px;">
-                        </div>
-                        <div class="col-3"> </div>
-                    </div>
-                </form>
-            </div>
-            <!-- 网络图片 -->
-        </div>
-        <!-- 在线图片 -->
-        <div class="tabCon">
-            <form id="form-uploadonlineimg" method="post" action="" enctype="multipart/form-data">
-                <div class="row cl" style="margin-top:20px;" id="online">
-                    <div id="imageList">
-                        <ul class="list">
-                            <!-- <li>
-                                    <img width="170" height="113" src="/storage/20220223/d5cc488e71c58bb072debe45ed06c6ad.jpg?noCache=1634567323"
-                                     _src="/storage/20220223/d5cc488e71c58bb072debe45ed06c6ad.jpg">
-                                    <span class="icon"></span>
-                                </li>
-                                 -->
-                            <li class="clearFloat"></li>
-                        </ul>
-                    </div>
-                </div>
-                <div class="row cl">
-                    <label class="form-label col-xs-2 col-sm-2">
-                        <span class="c-red">*</span>图片地址:</label>
-                    <div class="formControls col-xs-8 col-sm-8">
-                        <input type="text" class="input-text" name="online_file" id="online_file">
-                    </div>
-                    <div class="col-3"> </div>
-                </div>
-            </form>
-        </div>
-
-    <div class="row cl" style="margin-top:40px;">
-        <div style="width: 160px;height: 160px;margin: 0 auto;display: table-cell;vertical-align: middle;text-align: center;">
-            <img id="view-picture" src="/static/images/upload_picture.png" alt="图片"
-                title="图片" style="max-width: 120px;max-height: 120px;" onclick="addPicture()">
-        </div>
-        <input type="text" class="input-text" name="picture" id="picture" value="">
-    </div>
-    <div style="position: absolute;bottom: 1px;width: 100%;height: 40px;border-top: 1px solid gray;">
-        <button id="cancel" onclick="f_cancel()">取消</button>
-        <button id="insert" onclick="insert()">插入</button>
-    </div>
-</div>
-
-<!--请在下方写此页面业务相关的脚本-->
-<script src="/static/plugins/ace/ace.js"></script>
-<script src="/static/plugins/ace/mode-markdown.js"></script>
-<script src="/static/plugins/ace/theme-chrome.js"></script>
-<script type="text/javascript" src="/static/plugins/jquery.validation/1.14.0/jquery.validate.js"></script>
-<script type="text/javascript" src="/static/plugins/jquery.validation/1.14.0/messages_zh.js"></script>
-<script type="text/javascript" src="/static/plugins/jquery.validation/1.14.0/validate-methods.js"></script>
-
-<script type="text/javascript">
-    var editor = ace.edit('mdeditor');//编辑框
-
-    editor.setTheme('ace/theme/chrome');
-    editor.getSession().setMode('ace/mode/markdown');
-    editor.renderer.setShowPrintMargin(false);
-
-    //左侧插入,用户插入一些特定方法
-    function insertText(val) {
-        editor.insert(val); //光标位置插入
-    }
-
-    //添加标题图
-    function addTitlePic() {
-        let url = '{:url("file_manager/uploadimg", ["_layer"=>true,"img_id"=>"titlepic","infoid"=>$data.id,"cjid"=>$data.cjid])}'
-        layer_show('添加标题图', url, 800, 500);
-    }
-
-    // 上传图片
-    function addPicture() {
-        let url = '{:url("file_manager/uploadimg", ["_layer"=>true,"img_id"=>"picture","infoid"=>$data.id,"cjid"=>$data.cjid])}'
-        layer_show('插入图片', url, 800, 500);
-    }
-
-    //插入图片弹窗取消
-    function f_cancel() {
-        $('#dialog').hide();
-    }
-    //显示弹窗
-    function showDialog() {
-        $('#dialog').show();
-    }
-    
-    //插入图片
-    function insert() {
-        $('#dialog').hide();
-
-        // 文档图片插入地址
-        var imgUrl = $("#picture").val();
-        
-        insertText('![这里写图片描述](' + imgUrl + ')')
-
-        $("#picture").val('');
-        $("#view-picture").attr('src', '/static/images/upload_picture.png');
-    }
-
-    function validator(params) {
-        return $("#form-save").validate({
-            debug: true,
-            rules: {
-                title: {
-                    required: true,
-                }
-                , summary: {
-                    maxlength: 500,
-                }
-                , sort: {
-                    max: 99
-                }
-                , cid: {
-                    required: true
-                }
-            },
-            messages: {
-                title: {
-                    required: "标题不能为空"
-                }
-                , cid: {
-                    required: "栏目不能为空"
-                }
-            }
-        });
-    }
-
-    $("#form-button-save").click(function () {
-        if (!validator().form()) {
-            return false
-        }
-
-        $("#content").val(editor.getValue());
-
-        $("#form-save")[0].submit();
-    })
-</script>

+ 7 - 17
view/sys/category/index.html

@@ -1,9 +1,7 @@
 <article class="cl pd-20">
     <div class="cl pd-5 bg-1 bk-gray">
         <span class="l">
-            <!-- <a href="javascript:;" onclick="del_all()" class="btn btn-danger radius">
-                <i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> -->
-            <a class="btn btn-primary radius" href="javascript:save(0);">
+            <a class="btn btn-primary radius" href="javascript:void(0);" onclick="save(0)">
                 <i class="Hui-iconfont">&#xe600;</i> 添加栏目</a>
         </span>
     </div>
@@ -14,8 +12,6 @@
                     <th width="60px">ID</th>
                     <th>栏目名称</th>
                     <th>url</th>
-                    <!-- <th>模型名</th>
-                    <th>列表模板</th> -->
                     <th>导航状态</th>
                     <th style="width: 100px;">排序</th>
                     <th>类型</th>
@@ -28,13 +24,11 @@
                 {foreach $list as $value}
                 <tr class="text-c">
                     <td>{$value.id}</td>
-                    <td>{$value.name}</td>
+                    <td class="text-l">{$value.name}</td>
                     <td>{$value.url}</td>
-                    <!-- <td>{$value.tablename}</td>
-                    <td>{$value.template}</td> -->
                     <td class="td-status-nav">
                         <div class="switch size-S" data-on-label="是" data-off-label="否" data-id="{$value.id}">
-                            <input type="checkbox" {if $value.is_nav==1}checked{/if}>
+                            <input type="checkbox" {if $value.is_nav==0}checked{/if}>
                         </div>
                     </td>
                     <td><input type="text" class="input-text input-sort" value="{$value.sort}" data-id="{$value.id}"
@@ -54,11 +48,9 @@
                     <td>{$val.id}</td>
                     <td>{$val.name}</td>
                     <td>{$val.url}</td>
-                    <!-- <td>{$val.tablename}</td>
-                    <td>{$val.template}</td> -->
                     <td class="td-status-nav">
                         <div class="switch size-S" data-on-label="是" data-off-label="否" data-id="{$val.id}">
-                            <input type="checkbox" {if $val.is_nav==1}checked{/if}>
+                            <input type="checkbox" {if $val.is_nav==0}checked{/if}>
                         </div>
                     </td>
                     <td><input type="text" class="input-text input-sort" value="{$val.sort}" data-id="{$val.id}"
@@ -78,14 +70,12 @@
                     <td>{$vo.id}</td>
                     <td>{$vo.name}</td>
                     <td>{$vo.url}</td>
-                    <!-- <td>{$vo.tablename}</td>
-                    <td>{$vo.template}</td> -->
                     <td class="td-status-nav">
                         <div class="switch size-S" data-on-label="是" data-off-label="否" data-id="{$vo.id}">
-                            <input type="checkbox" {if $vo.is_nav==1}checked{/if}>
+                            <input type="checkbox" {if $vo.is_nav==0}checked{/if}>
                         </div>
                     </td>
-                    <td><input type="text" class="input-text input-sort" value="{$vo.sort}" data-id="{$val.id}"
+                    <td><input type="text" class="input-text input-sort" value="{$vo.sort}" data-id="{$vo.id}"
                         style="text-align: center;"></td>
                     <td>{$types[$vo['type']]}</td>
                     <td>{$vo.create_time}</td>
@@ -107,7 +97,7 @@
 <script type="text/javascript">
     function save(id) {
         var title = id == 0 ? '添加栏目' : '修改栏目'
-        var url = "{:url('save')}" + "?_layer=true&id=" + id
+        var url = "/sys/category/save" + "?_layer=true&id=" + id
         layer_show(title, url, 800, 600);
     }
 

+ 20 - 30
view/sys/category/save.html

@@ -7,7 +7,6 @@
             <div class="formControls col-xs-4 col-sm-6">
                 <span class="select-box">
                     <select class="select" name="parent_id">
-                        <option value="0" {eq name='data.parent_id' value="0" }selected{/eq}>--顶级栏目--</option>
                         {foreach $list as $value}
                         <option value="{$value.id}" {eq name='value.id' value="$data.parent_id" }selected{/eq}>
                             {$value.name}</option>
@@ -32,45 +31,32 @@
             <label class="form-label col-xs-4 col-sm-2">
                 url:</label>
             <div class="formControls col-xs-4 col-sm-6">
-                <input type="text" class="input-text" value="{$data.url}" placeholder="绑定路由地址" id="url" name="url">
+                <input type="text" class="input-text" value="{$data.url}" placeholder="绑定url" id="url" name="url">
             </div>
             <div class="col-3"> </div>
         </div>
         <div class="row cl">
             <label class="form-label col-xs-4 col-sm-2">
-                <span class="c-red">*</span> 类型:</label>
-            <div class="formControls col-xs-4 col-sm-6">
-                <span class="select-box">
-                    <select class="select" name="type">
-                        <option value="0" {eq name='data.type' value="0" }selected{/eq}> 请选择类型 </option>
-                        <option value="1" {eq name='data.type' value="1" }selected{/eq}> 一般栏目 </option>
-                        <option value="2" {eq name='data.type' value="2" }selected{/eq}> 目录 </option>
-                        <option value="3" {eq name='data.type' value="3" }selected{/eq}> 单页 </option>
-                        <option value="4" {eq name='data.type' value="4" }selected{/eq}> 锚点 </option>
-                        <option value="4" {eq name='data.type' value="5" }selected{/eq}> 链接 </option>
-                    </select>
-                </span>
-            </div>
-            <div class="col-3"> </div>
-        </div>
-        <!-- <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-2">
-                模型名:</label>
+                url:</label>
             <div class="formControls col-xs-4 col-sm-6">
-                <input type="text" class="input-text" value="{$data.tablename}" placeholder="请填写模型名(表名, 小写驼峰, 无前缀)"
-                    id="tablename" name="tablename">
+                <input type="text" class="input-text" value="{$data.route}" placeholder="绑定路由" id="route" name="route">
             </div>
             <div class="col-3"> </div>
         </div>
         <div class="row cl">
             <label class="form-label col-xs-4 col-sm-2">
-                列表模板:</label>
+                <span class="c-red">*</span> 类型:</label>
             <div class="formControls col-xs-4 col-sm-6">
-                <input type="text" class="input-text" value="{$data.template}" placeholder="请填写列表模板" id="template"
-                    name="template">
+                <span class="select-box">
+                    <select class="select" name="type">
+                        <option value="0" {eq name='data.type' value="0" }selected{/eq}> 一般栏目 </option>
+                        <option value="1" {eq name='data.type' value="1" }selected{/eq}> 目录 </option>
+                        <option value="3" {eq name='data.type' value="2" }selected{/eq}> 链接 </option>
+                    </select>
+                </span>
             </div>
             <div class="col-3"> </div>
-        </div> -->
+        </div>
         <div class="row cl">
             <label class="form-label col-xs-4 col-sm-2">
                 栏目标题:</label>
@@ -123,11 +109,11 @@
                 <span class="c-red"></span>导航:</label>
             <div class="formControls col-xs-8 col-sm-6">
                 <div class="radio-box">
-                    <input type="radio" name="is_nav" id="is_menu-1" value="1" {$data.is_nav==1 ? 'checked' : "" }>
+                    <input type="radio" name="is_nav" id="is_menu-1" value="0" {$data.is_nav==0 ? 'checked' : "" }>
                     <label for="is_menu-1">是</label>
                 </div>
                 <div class="radio-box">
-                    <input type="radio" name="is_nav" id="is_menu-2" value="0" {$data.is_nav==0 ? 'checked' : "" }>
+                    <input type="radio" name="is_nav" id="is_menu-2" value="-1" {$data.is_nav==-1 ? 'checked' : "" }>
                     <label for="is_menu-2">否</label>
                 </div>
             </div>
@@ -137,11 +123,11 @@
                 <span class="c-red"></span>新标签打开:</label>
             <div class="formControls col-xs-8 col-sm-6">
                 <div class="radio-box">
-                    <input type="radio" name="is_blank" id="is_blank-1" value="1" {$data.is_blank==1 ? 'checked' : "" }>
+                    <input type="radio" name="is_blank" id="is_blank-1" value="0" {$data.is_blank==0 ? 'checked' : "" }>
                     <label for="is_blank-1">是</label>
                 </div>
                 <div class="radio-box">
-                    <input type="radio" name="is_blank" id="is_blank-2" value="0" {$data.is_blank==0 ? 'checked' : "" }>
+                    <input type="radio" name="is_blank" id="is_blank-2" value="-1" {$data.is_blank==-1 ? 'checked' : "" }>
                     <label for="is_blank-2">否</label>
                 </div>
             </div>
@@ -163,7 +149,11 @@
             var data = $("#form-save").serializeArray();
             $.ajax({
                 type: 'POST',
+<<<<<<< HEAD
                 url: '{:url("/sys/sys_category/doSave")}',
+=======
+                url: '/sys/category/doSave',
+>>>>>>> 12a23a8ae7cd9871a9ece818a1ef3f502a7edd39
                 data: data,
                 dataType: 'json',
                 success: function (res) {

+ 0 - 136
view/sys/file_manager/database_picture.html

@@ -1,136 +0,0 @@
-<style>
-    #online {
-        width: 100%;
-        height: 224px;
-        padding: 10px 0 0 0;
-    }
-
-    #online #imageList {
-        width: 100%;
-        height: 100%;
-        overflow-x: hidden;
-        overflow-y: auto;
-        position: relative;
-        margin-left: 20px;
-    }
-
-    #online ul {
-        display: block;
-        list-style: none;
-        margin: 0;
-        padding: 0;
-    }
-
-    #online li {
-        float: left;
-        display: block;
-        list-style: none;
-        padding: 0;
-        width: 113px;
-        height: 113px;
-        margin: 0 0 9px 9px;
-        background-color: #eee;
-        overflow: hidden;
-        cursor: pointer;
-        position: relative;
-    }
-
-    #online li img {
-        cursor: pointer;
-    }
-
-    #online li .icon {
-        cursor: pointer;
-        width: 113px;
-        height: 113px;
-        position: absolute;
-        top: 0;
-        left: 0;
-        z-index: 2;
-        border: 0;
-        background-repeat: no-repeat;
-    }
-
-    #online li .icon:hover {
-        width: 107px;
-        height: 107px;
-        border: 3px solid #1094fa;
-    }
-
-    #online li.selected .icon {
-        background-image: url(/static/images/success.png);
-        background-image: url(images/success.gif)\9;
-        background-position: 75px 75px;
-    }
-
-    #online li.clearFloat {
-        float: left;
-        clear: both;
-        display: block;
-        width: 113px;
-        height: 113px;
-        margin: 0 0 9px 9px;
-        padding: 0;
-    }
-</style>
-
-<div class="cl mt-20" id="online">
-    <div id="imageList">
-        <ul class="list">
-            <!-- <li>
-                <img width="170" height="113" src="/storage/20220223/d5cc488e71c58bb072debe45ed06c6ad.jpg?noCache=1634567323"
-                 _src="/storage/20220223/d5cc488e71c58bb072debe45ed06c6ad.jpg">
-                <span class="icon"></span>
-            </li>
-             -->
-            <li class="clearFloat"></li>
-        </ul>
-    </div>
-</div>
-
-<script type="text/javascript">
-    $(function () {
-        $.Huitab("#tab-img .tabBar span", "#tab-img .tabCon", "current", "click", "0");
-        $(document).on("click", "#online li", function () {
-            $("#online li").removeClass('selected');
-            
-            $(this).addClass('selected');
-            
-            img = $(this).children('img').attr('_src');
-            
-            $("#online_file").val(img);
-        });
-    });
-    
-    function onlinepicture() {
-        let infoid = $("input[name='infoid']").val();
-        let cjid = $("input[name='cjid']").val();
-
-        $.ajax({
-            url: '{:url("file_manager/queryList")}',
-            type: 'POST',
-            async: true,
-            cache: false,
-            data: JSON.stringify({
-                infoid: infoid,
-                cjid: cjid
-            }),
-            processData: false,
-            contentType: 'application/json',
-            dataType: "json",
-            success: function (res) {
-                if (res.code == 0) {
-                    html_str = "";
-                    res.list.forEach(element => {
-                        html_str += '<li><img width="170" height="113" src="' + element.filepath + '?noCache=' + element.filetime + '"';
-                        html_str += '_src="' + element.filepath + '" title="'+element.title+'">';
-                        html_str += '<span class="icon"></span></li>';
-                    });
-                    $('ul.list').prepend(html_str);
-                }
-            }
-        });
-    }
-
-    onlinepicture();
-</script>

+ 0 - 81
view/sys/file_manager/directory_picture.html

@@ -1,81 +0,0 @@
-<div class="row cl">
-    <table class="table table-border table-bordered table-bg">
-        <thead>
-            <tr class="text-c">
-                <th>
-                    <strong>文件名</strong>
-                </th>
-                <th>
-                    <strong>文件大小</strong>
-                </th>
-                <th>
-                    <strong>最后修改时间</strong>
-                </th>
-            </tr>
-        </thead>
-        <tbody>
-        </tbody>
-    </table>
-</div>
-
-<script type="text/javascript">
-    var data = {
-        dirs: [],
-        files: [],
-        activeurl: '',
-        activepath: ''
-    }
-
-    function maketbody() {
-        let tbhtml = '';
-        tbhtml += '<tr class="text-c" bgcolor="#FFFFFF" height="26" onMouseMove="javascript:this.bgColor=\'#FCFDEE\';" onMouseOut="javascript:this.bgColor=\'#FFFFFF\';">'
-        tbhtml += '<td>'+(data.activeurl ? '<i class="Hui-iconfont Hui-iconfont-arrow1-top"></i>' : '') +'<a onclick="onlinepicture(\''+data.activeurl+'\')">上级目录</a></td>'
-        tbhtml += '<td>当前目录:<span style="color:#f00;"> ./storage'+data.activepath+'</span></td><td></td></tr>'
-
-        data.dirs.forEach((dir) => {
-            tbhtml += '<tr class="text-c" style="height:26px; " onMouseMove="javascript:this.bgColor=\'#FCFDEE\';" onMouseOut="javascript:this.bgColor=\'#FFFFFF\';">'
-            tbhtml += '<td style="text-align:left;"><img src="/static/images/icon/dir.png">'
-            tbhtml += '<a onclick="onlinepicture(\''+data.activepath+'/'+dir+'\')">'+dir+'</a></td><td></td><td></td></tr>'
-        });
-
-        data.files.forEach((file) => {
-            tbhtml += '<tr class="text-c" style="height:26px; " onMouseMove="javascript:this.bgColor=\'#FCFDEE\';" onMouseOut="javascript:this.bgColor=\'#FFFFFF\';">'
-            tbhtml += '<td style="text-align:left;"><img src="/static/images/icon/'+file.extension+'.png">'
-            tbhtml += '<a onclick="selcetimg(\'/storage'+data.activepath+'/'+file.filename+'\')">'+file.filename+'</a></td>'
-            tbhtml += '<td>'+file.size+'</td><td></td></tr>'
-        });
-
-        document.querySelector('table tbody').innerHTML = tbhtml;
-    }
-
-    function onlinepicture(activepath) {        
-        $.ajax({
-            url: '{:url("file_manager/explorer")}',
-            type: 'GET',
-            async: true,
-            cache: false,
-            data: 'activepath='+activepath,
-            processData: false,
-            contentType: 'application/x-www-form-urlencoded',
-            dataType: "json",
-            success: function (res) {
-                if (res.code == 0) {
-                    // console.log(res);
-                    data.dirs       = res.dirs
-                    data.files      = res.files
-                    data.activeurl  = res.activeurl
-                    data.activepath = res.activepath
-
-                    maketbody();
-                }
-            }
-        });
-    }
-
-    function selcetimg(img) {
-        $("#online_file").val(img);
-    }
-
-    onlinepicture(data.activepath);
-</script>
-

+ 0 - 462
view/sys/file_manager/explorer.html

@@ -1,462 +0,0 @@
-<<<<<<< HEAD
-<style>
-    .progress {
-        width: 600px;
-        height: 10px;
-        border: 1px solid #ccc;
-        border-radius: 10px;
-        margin: 10px 0px;
-        overflow: hidden;
-        display: -webkit-inline-box;
-    }
-
-    /* 初始状态设置进度条宽度为0px */
-    .progress>div {
-        width: 0px;
-        height: 100%;
-        background-color: yellowgreen;
-        transition: all .3s ease;
-    }
-</style>
-
-<article class="cl pd-20">
-    <div class="cl pd-5 bg-1 bk-gray">
-        <span class="l">
-            <a class="btn radius btn-default" href="{:url('index')}"><i
-                    class="Hui-iconfont Hui-iconfont-pages"></i>数据库模式</a>
-            <a class="btn radius btn-secondary"><i class="Hui-iconfont Hui-iconfont-jifen"></i> 目录模式 </a>
-            <a class="btn btn-primary radius" onclick="uploadFile();"><i
-                    class="Hui-iconfont Hui-iconfont-add"></i>上传附件</a>
-            <input type="file" id="upload_file" hidden multiple onchange="fileChange()">
-            <input type="hidden" id="activepath" name="activepath" value="{$activepath}">
-            <div class="progress">
-                <div></div>
-            </div>
-        </span>
-        <span class="r">共有:
-            <strong>{$counts}</strong> 个对象</span>
-    </div>
-    <div class="cl mt-20">
-        <table class="table table-border table-bordered table-bg">
-            <thead>
-                <tr class="text-c">
-                    <th width="25%">
-                        <strong>文件名</strong>
-                    </th>
-                    <th width="16%">
-                        <strong>文件大小</strong>
-                    </th>
-                    <th width="22%">
-                        <strong>最后修改时间</strong>
-                    </th>
-                    <th width="34%">
-                        <strong>操作</strong>
-                    </th>
-                </tr>
-            </thead>
-            <tbody>
-                <tr class="text-c" bgcolor='#FFFFFF' height='26' onMouseMove="javascript:this.bgColor='#FCFDEE';"
-                    onMouseOut="javascript:this.bgColor='#FFFFFF';">
-                    <td>
-                        {notempty name="activepath"}<i class="Hui-iconfont Hui-iconfont-arrow1-top"></i>{/notempty}
-                        <a href="/sys/file_manager/explorer?activepath={$activeurl}">上级目录</a>
-                    </td>
-                    <td>当前目录:
-                        <span style="color:#f00;"> ./storage{$activepath} </span>  
-                    </td>
-                    <td></td>
-                    <td></td>
-                </tr>
-                {foreach $dirs as $dir}
-                <tr class="text-c" style="height:26px; " onMouseMove="javascript:this.bgColor='#FCFDEE';"
-                    onMouseOut="javascript:this.bgColor='#FFFFFF';">
-                    <td style="text-align:left;">
-                        <img src=/static/images/icon/dir.png>
-                        <a href="/sys/file_manager/explorer?activepath={$activepath.'/'.$dir}">
-                            {$dir}
-                        </a>
-                    </td>
-                    <td></td>
-                    <td></td>
-                    <td>
-                        <a class="btn" onclick="del_dir(this, '{$activepath}/{$dir}')">删除</a>
-                    </td>
-                </tr>
-                {/foreach}
-                {foreach $files as $file}
-                <tr class="text-c" bgcolor='#FFFFFF' height='26' onMouseMove="javascript:this.bgColor='#FCFDEE';"
-                    onMouseOut="javascript:this.bgColor='#FFFFFF';">
-                    <td style="text-align:left;">
-                        <img src="/static/images/icon/{$file['extension']}.png">
-                        <a href="/storage{$activepath}/{$file['filename']}" target="_blank">
-                            {$file['filename']}
-                        </a>
-                    </td>
-                    <td align='center'> {$file['size']} </td>
-                    <td align='center'> {$file['time']|date="Y-m-d H:i:s"} </td>
-                    <td>
-                        <a href="/storage{$activepath.'/'.$file['filename']}" class="btn radius btn-primary"
-                            target="_blank">查看/下载</a>&nbsp;
-                        <a class="btn radius btn-danger"
-                            onclick="del_file(this,'{$activepath}/{$file.filename}')">删除</a>&nbsp;
-                        <!-- <a href='' class="btn" >移动</a> -->
-                    </td>
-                </tr>
-                {/foreach}
-            </tbody>
-        </table>
-    </div>
-</article>
-
-<!--请在下方写此页面业务相关的脚本-->
-<script type="text/javascript">
-    /*删除图片*/
-    function del_dir(obj, dir) {
-        layer.confirm('确认要删除吗?', function (index) {
-            $.post('deldir', {
-                'dir': dir
-            }, function (res) {
-                if (res.code == 0) {
-                    $(obj).parents('tr').remove();
-                    topalert({
-                        type: 0,
-                        content: res.msg,
-                        speed: 1000
-                    });
-                } else {
-                    topalert({
-                        type: 2,
-                        content: res.msg,
-                        speed: 2000
-                    });
-                }
-                layer.close(layer.index);
-            }, 'json');
-        });
-    }
-
-    /*删除图片*/
-    function del_file(obj, filename) {
-        layer.confirm('确认要删除吗?', function (index) {
-            $.post('delfile', {
-                'filename': filename
-            }, function (res) {
-                if (res.code == 0) {
-                    $(obj).parents('tr').remove();
-                    topalert({
-                        type: 0,
-                        content: res.msg,
-                        speed: 1000
-                    });
-                } else {
-                    topalert({
-                        type: 2,
-                        content: res.msg,
-                        speed: 2000
-                    });
-                }
-                layer.close(layer.index);
-            }, 'json');
-        });
-    }
-
-    //通过点击图片来触发文件上传按钮
-    function uploadFile(params) {
-        $("#upload_file").click();
-    }
-
-    // 自动上传处理
-    function fileChange() {
-        let uploadFile = $("#upload_file").get(0).files;
-        // console.log(uploadFile);
-        if (uploadFile == undefined || uploadFile == null) {
-            layer.msg("请选择文件", { icon: 5, time: 1000 });
-            return false;
-        }
-
-        if (uploadFile.length > 20) {
-            layer.msg("最多20个文件", { icon: 5, time: 1000 });
-            return false;
-        }
-
-        let formData = new FormData();
-
-        formData.append('activepath', $('#activepath').val());
-
-        for (let i = 0; i < uploadFile.length; i++) {
-            formData.append('upload_file[]', uploadFile[i]);
-        }
-
-        $.ajax({
-            url: '{:url("file_manager/uploadFile")}',
-            type: 'post',
-            dataType: 'json',
-            data: formData,
-            processData: false,
-            contentType: false,
-            xhr: function () {
-                var xhr = new XMLHttpRequest();
-                //使用XMLHttpRequest.upload监听上传过程,注册progress事件,打印回调函数中的event事件
-                xhr.upload.addEventListener('progress', function (e) {
-                    // console.log(e);
-                    //loaded代表上传了多少
-                    //total代表总数为多少
-                    var progressRate = (e.loaded / e.total) * 100 + '%';
-
-                    //通过设置进度条的宽度达到效果
-                    $('.progress > div').css('width', progressRate);
-                })
-
-                return xhr;
-            },
-            success: function (res) {
-                console.log(res);
-                if (res.code == 0) {
-                    layer.msg(res.msg, {
-                        icon: 1,
-                        time: 1000
-                    });
-                    window.location.reload();
-                } else {
-                    layer.msg(res.msg, {
-                        icon: 5,
-                        time: 1000
-                    });
-                    return false;
-                }
-            }
-        });
-    }
-</script>
-=======
-<style>
-    .progress {
-        width: 600px;
-        height: 10px;
-        border: 1px solid #ccc;
-        border-radius: 10px;
-        margin: 10px 0px;
-        overflow: hidden;
-        display: -webkit-inline-box;
-    }
-
-    /* 初始状态设置进度条宽度为0px */
-    .progress>div {
-        width: 0px;
-        height: 100%;
-        background-color: yellowgreen;
-        transition: all .3s ease;
-    }
-</style>
-
-<article class="cl pd-20">
-    <div class="cl pd-5 bg-1 bk-gray">
-        <span class="l">
-            <a class="btn radius btn-default" href="{:url('index')}"><i
-                    class="Hui-iconfont Hui-iconfont-pages"></i>数据库模式</a>
-            <a class="btn radius btn-secondary"><i class="Hui-iconfont Hui-iconfont-jifen"></i> 目录模式 </a>
-            <a class="btn btn-primary radius" onclick="uploadFile();"><i
-                    class="Hui-iconfont Hui-iconfont-add"></i>上传附件</a>
-            <input type="file" id="upload_file" hidden multiple onchange="fileChange()">
-            <input type="hidden" id="activepath" name="activepath" value="{$activepath}">
-            <div class="progress">
-                <div></div>
-            </div>
-        </span>
-        <span class="r">共有:
-            <strong>{$counts}</strong> 个对象</span>
-    </div>
-    <div class="cl mt-20">
-        <table class="table table-border table-bordered table-bg">
-            <thead>
-                <tr class="text-c">
-                    <th width="25%">
-                        <strong>文件名</strong>
-                    </th>
-                    <th width="16%">
-                        <strong>文件大小</strong>
-                    </th>
-                    <th width="22%">
-                        <strong>最后修改时间</strong>
-                    </th>
-                    <th width="34%">
-                        <strong>操作</strong>
-                    </th>
-                </tr>
-            </thead>
-            <tbody>
-                <tr class="text-c" bgcolor='#FFFFFF' height='26' onMouseMove="javascript:this.bgColor='#FCFDEE';"
-                    onMouseOut="javascript:this.bgColor='#FFFFFF';">
-                    <td>
-                        {notempty name="activepath"}<i class="Hui-iconfont Hui-iconfont-arrow1-top"></i>{/notempty}
-                        <a href="/sys/file_manager/explorer?activepath={$activeurl}">上级目录</a>
-                    </td>
-                    <td>当前目录:
-                        <span style="color:#f00;"> ./storage{$activepath} </span>  
-                    </td>
-                    <td></td>
-                    <td></td>
-                </tr>
-                {foreach $dirs as $dir}
-                <tr class="text-c" style="height:26px; " onMouseMove="javascript:this.bgColor='#FCFDEE';"
-                    onMouseOut="javascript:this.bgColor='#FFFFFF';">
-                    <td style="text-align:left;">
-                        <img src="/static/images/icon/dir.png">
-                        <a href="/sys/file_manager/explorer?activepath={$activepath.'/'.$dir}">
-                            {$dir}
-                        </a>
-                    </td>
-                    <td></td>
-                    <td></td>
-                    <td>
-                        <a class="btn" onclick="del_dir(this, '{$activepath}/{$dir}')">删除</a>
-                    </td>
-                </tr>
-                {/foreach}
-                {foreach $files as $file}
-                <tr class="text-c" bgcolor='#FFFFFF' height='26' onMouseMove="javascript:this.bgColor='#FCFDEE';"
-                    onMouseOut="javascript:this.bgColor='#FFFFFF';">
-                    <td style="text-align:left;">
-                        <img src="/static/images/icon/{$file['extension']}.png">
-                        <a href="/storage{$activepath}/{$file['filename']}" target="_blank">
-                            {$file['filename']}
-                        </a>
-                    </td>
-                    <td align='center'> {$file['size']} </td>
-                    <td align='center'> {$file['time']|date="Y-m-d H:i:s"} </td>
-                    <td>
-                        <a href="/storage{$activepath.'/'.$file['filename']}" class="btn radius btn-primary"
-                            target="_blank">查看/下载</a>&nbsp;
-                        <a class="btn radius btn-danger"
-                            onclick="del_file(this,'{$activepath}/{$file.filename}')">删除</a>&nbsp;
-                        <!-- <a href='' class="btn" >移动</a> -->
-                    </td>
-                </tr>
-                {/foreach}
-            </tbody>
-        </table>
-    </div>
-</article>
-
-<!--请在下方写此页面业务相关的脚本-->
-<script type="text/javascript">
-    /*删除图片*/
-    function del_dir(obj, dir) {
-        layer.confirm('确认要删除吗?', function (index) {
-            $.post('deldir', {
-                'dir': dir
-            }, function (res) {
-                if (res.code == 0) {
-                    $(obj).parents('tr').remove();
-                    topalert({
-                        type: 0,
-                        content: res.msg,
-                        speed: 1000
-                    });
-                } else {
-                    topalert({
-                        type: 2,
-                        content: res.msg,
-                        speed: 2000
-                    });
-                }
-                layer.close(layer.index);
-            }, 'json');
-        });
-    }
-
-    /*删除图片*/
-    function del_file(obj, filename) {
-        layer.confirm('确认要删除吗?', function (index) {
-            $.post('delfile', {
-                'filename': filename
-            }, function (res) {
-                if (res.code == 0) {
-                    $(obj).parents('tr').remove();
-                    topalert({
-                        type: 0,
-                        content: res.msg,
-                        speed: 1000
-                    });
-                } else {
-                    topalert({
-                        type: 2,
-                        content: res.msg,
-                        speed: 2000
-                    });
-                }
-                layer.close(layer.index);
-            }, 'json');
-        });
-    }
-
-    //通过点击图片来触发文件上传按钮
-    function uploadFile(params) {
-        $("#upload_file").click();
-    }
-
-    // 自动上传处理
-    function fileChange() {
-        let uploadFile = $("#upload_file").get(0).files;
-        // console.log(uploadFile);
-        if (uploadFile == undefined || uploadFile == null) {
-            layer.msg("请选择文件", { icon: 5, time: 1000 });
-            return false;
-        }
-
-        if (uploadFile.length > 20) {
-            layer.msg("最多20个文件", { icon: 5, time: 1000 });
-            return false;
-        }
-
-        let formData = new FormData();
-
-        formData.append('activepath', $('#activepath').val());
-
-        for (let i = 0; i < uploadFile.length; i++) {
-            formData.append('upload_file[]', uploadFile[i]);
-        }
-
-        $.ajax({
-            url: '{:url("file_manager/uploadFile")}',
-            type: 'post',
-            dataType: 'json',
-            data: formData,
-            processData: false,
-            contentType: false,
-            xhr: function () {
-                var xhr = new XMLHttpRequest();
-                //使用XMLHttpRequest.upload监听上传过程,注册progress事件,打印回调函数中的event事件
-                xhr.upload.addEventListener('progress', function (e) {
-                    // console.log(e);
-                    //loaded代表上传了多少
-                    //total代表总数为多少
-                    var progressRate = (e.loaded / e.total) * 100 + '%';
-
-                    //通过设置进度条的宽度达到效果
-                    $('.progress > div').css('width', progressRate);
-                })
-
-                return xhr;
-            },
-            success: function (res) {
-                console.log(res);
-                if (res.code == 0) {
-                    layer.msg(res.msg, {
-                        icon: 1,
-                        time: 1000
-                    });
-                    window.location.reload();
-                } else {
-                    layer.msg(res.msg, {
-                        icon: 5,
-                        time: 1000
-                    });
-                    return false;
-                }
-            }
-        });
-    }
-</script>
->>>>>>> 78b76253c8ce5873016cf837373af5e30ac80c86
-<!--请在上方写此页面业务相关的脚本-->

+ 0 - 415
view/sys/file_manager/index.html

@@ -1,415 +0,0 @@
-<<<<<<< HEAD
-<style>
-    .progress {
-        width: 600px;
-        height: 10px;
-        border: 1px solid #ccc;
-        border-radius: 10px;
-        margin: 10px 0px;
-        overflow: hidden;
-        display: -webkit-inline-box;
-    }
-
-    /* 初始状态设置进度条宽度为0px */
-    .progress>div {
-        width: 0px;
-        height: 100%;
-        background-color: yellowgreen;
-        transition: all .3s ease;
-    }
-</style>
-
-<article class="cl pd-10">
-    <div class="cl pd-5 bg-1 bk-gray mt-20">
-        <span class="l">
-            <a class="btn radius btn-secondary"><i class="Hui-iconfont Hui-iconfont-jifen"></i>数据库模式</a>
-            <a class="btn radius btn-default" href="{:url('explorer')}"><i class="Hui-iconfont Hui-iconfont-pages"></i> 目录模式 </a>
-            <a class="btn btn-danger radius" onclick="del_all();"><i class="Hui-iconfont Hui-iconfont-del2"></i>批量删除</a>
-            <a class="btn btn-primary radius" onclick="uploadFile();"><i class="Hui-iconfont Hui-iconfont-add"></i>上传附件</a>
-            <input type="file" id="upload_file" hidden multiple onchange="fileChange()">
-            <div class="progress">
-                <div></div>
-            </div>
-        </span>
-        <span class="r">共有数据:<strong id="total">{$list->total()}</strong>条</span>
-    </div>
-
-    <div class="cl mt-20">
-        <table class="table table-border table-bordered table-bg">
-            <thead>
-                <tr class="text-c">
-                    <th width="25px;">
-                        <input type="checkbox" name="allcheck" value="">
-                    </th>
-                    <th width="60px;">ID</th>
-                    <th>文件title</th>
-                    <th style="min-width: 260px;">文件路径</th>
-                    <th>文件类型</th>
-                    <th>文件大小</th>
-                    <th>增加者</th>
-                    <th>增加时间</th>
-                    <th width="100px;">操作</th>
-                </tr>
-            </thead>
-            <tbody>
-                {foreach $list as $val}
-                <tr class="text-c">
-                    <td>
-                        <input type="checkbox" value="{$val.fileid}" name="checkbox[]">
-                    </td>
-                    <td>{$val.fileid}</td>
-                    <td class="text-l">{$val.title}</td>
-                    <td class="text-l">
-                        <a href="{$val.filepath}" title="{$val.filepath}" target="_blank">{$val.filepath}</a>
-                    </td>
-                    <td>{$val.fileextension}</td>
-                    <td>{$val.filesize|format_bytes}</td>
-                    <td>{$val.username}</td>
-                    <td>{$val.filetime|date="Y-m-d H:i:s"}</td>
-                    <td class="td-manager">
-                        <a class="btn btn-secondary radius" title="编辑title" onClick="editTitle('{$val.fileid}','{$val.title}')"><i
-                            class="Hui-iconfont Hui-iconfont-edit"></i></a>
-                        <a class="btn btn-danger radius" title="删除" onClick="del(this,'{$val.fileid}')"><i
-                            class="Hui-iconfont Hui-iconfont-del2"></i></a></td>
-                </tr>
-                {/foreach}
-            </tbody>
-        </table>
-    </div>
-</article>
-
-<script>
-    //通过点击图片来触发文件上传按钮
-    function uploadFile(params) {
-        $("#upload_file").click();
-    }
-
-    // 上传处理
-    function fileChange() {
-        let uploadFile = $("#upload_file").get(0).files;
-        // console.log(uploadFile);
-        if (uploadFile == undefined || uploadFile == null) {
-            layer.msg("请选择文件", { icon: 5, time: 1000 });
-            return false;
-        }
-
-        if (uploadFile.length > 20) {
-            layer.msg("最多20个文件", { icon: 5, time: 1000 });
-            return false;
-        }
-
-        let formData = new FormData();
-
-        for (let i = 0; i < uploadFile.length; i++) {
-            formData.append('upload_file[]', uploadFile[i]);
-        }
-
-        $.ajax({
-            url: '{:url("file_manager/uploadFile")}',
-            type: 'post',
-            dataType: 'json',
-            data: formData,
-            processData: false,
-            contentType: false,
-            xhr: function () {
-                var xhr = new XMLHttpRequest();
-                //使用XMLHttpRequest.upload监听上传过程,注册progress事件,打印回调函数中的event事件
-                xhr.upload.addEventListener('progress', function (e) {
-                    // console.log(e);
-                    //loaded代表上传了多少
-                    //total代表总数为多少
-                    var progressRate = (e.loaded / e.total) * 100 + '%';
-
-                    //通过设置进度条的宽度达到效果
-                    $('.progress > div').css('width', progressRate);
-                })
-
-                return xhr;
-            },
-            success: function (res) {
-                console.log(res);
-                if (res.code == 0) {
-                    layer.msg(res.msg, {
-                        icon: 1,
-                        time: 1000
-                    });
-                    window.location.reload();
-                } else {
-                    layer.msg(res.msg, {
-                        icon: 5,
-                        time: 1000
-                    });
-                    return false;
-                }
-            }
-        });
-    }
-
-    function editTitle(id, title) {
-        if (id==0) {
-            layer.msg('id不可为空', {icon: 5,time: 1000});
-        }
-
-        var content  = '<div  class="cl" style="padding:20px;">';
-            content += '<label class="form-label col-sm-4">';
-            content += '<span class="c-red">*</span>文件title:</label>';
-            content += '<div class="formControls col-sm-6">';
-            content += '<input type="text" class="input-text" name="filetile" id="filetile">';
-            content += '</div><div class="col-3"></div></div></div>';
-
-        layer.open({
-            type: 1,
-            area: ['500px', '200px'],
-            title: '修改文件title',
-            content: '\<\div style="padding:20px;">\<\span class="c-red">*\<\/span>文件title:\<\input type="text" class="input-text" name="filetitle" value="'+title+'" id="filetitle">\<\/div>',
-            btn: ['确定', '取消'],
-            yes: function(index, layero){
-                let filetitle = document.querySelector('input[name="filetitle"]').value;
-                $.ajax({
-                    url: '{:url("file_manager/updateFileTitle")}',
-                    type: 'post',
-                    dataType: 'json',
-                    contentType: 'application/json',
-                    data: JSON.stringify({
-                        id: id,
-                        filetitle: filetitle
-                    }),
-                    success: function (res) {
-                        if (res.code == 0) {
-                            layer.msg(res.msg, {
-                                icon: 1,
-                                time: 1000
-                            });
-                            window.location.reload();
-                        } else {
-                            layer.msg(res.msg, {
-                                icon: 5,
-                                time: 1000
-                            });
-                        }
-                        layer.close(index);
-                    }
-                });
-            }
-        });
-        
-        // layer.open({
-        //     type: 2,
-        //     area: ['700px', '500px'],
-        //     fix: false, //不固定
-        //     maxmin: true,
-        //     shade: 0.4,
-        //     title: '添加标题图',
-        //     content: 'test'
-        // });
-    }
-=======
-<style>
-    .progress {
-        width: 600px;
-        height: 10px;
-        border: 1px solid #ccc;
-        border-radius: 10px;
-        margin: 10px 0px;
-        overflow: hidden;
-        display: -webkit-inline-box;
-    }
-
-    /* 初始状态设置进度条宽度为0px */
-    .progress>div {
-        width: 0px;
-        height: 100%;
-        background-color: yellowgreen;
-        transition: all .3s ease;
-    }
-</style>
-
-<article class="cl pd-10">
-    <div class="cl pd-5 bg-1 bk-gray mt-20">
-        <span class="l">
-            <a class="btn radius btn-secondary"><i class="Hui-iconfont Hui-iconfont-jifen"></i>数据库模式</a>
-            <a class="btn radius btn-default" href="{:url('explorer')}"><i class="Hui-iconfont Hui-iconfont-pages"></i> 目录模式 </a>
-            <a class="btn btn-danger radius" onclick="del_all();"><i class="Hui-iconfont Hui-iconfont-del2"></i>批量删除</a>
-            <a class="btn btn-primary radius" onclick="uploadFile();"><i class="Hui-iconfont Hui-iconfont-add"></i>上传附件</a>
-            <input type="file" id="upload_file" hidden multiple onchange="fileChange()">
-            <div class="progress">
-                <div></div>
-            </div>
-        </span>
-        <span class="r">共有数据:<strong id="total">{$list->total()}</strong>条</span>
-    </div>
-
-    <div class="cl mt-20">
-        <table class="table table-border table-bordered table-bg">
-            <thead>
-                <tr class="text-c">
-                    <th width="25px;">
-                        <input type="checkbox" name="allcheck" value="">
-                    </th>
-                    <th width="60px;">ID</th>
-                    <th>文件title</th>
-                    <th style="min-width: 260px;">文件路径</th>
-                    <th>文件类型</th>
-                    <th>文件大小</th>
-                    <th>增加者</th>
-                    <th>增加时间</th>
-                    <th width="100px;">操作</th>
-                </tr>
-            </thead>
-            <tbody>
-                {foreach $list as $val}
-                <tr class="text-c">
-                    <td>
-                        <input type="checkbox" value="{$val.fileid}" name="checkbox[]">
-                    </td>
-                    <td>{$val.fileid}</td>
-                    <td class="text-l">{$val.title}</td>
-                    <td class="text-l">
-                        <a href="{$val.filepath}" title="{$val.filepath}" target="_blank">{$val.filepath}</a>
-                    </td>
-                    <td>{$val.fileextension}</td>
-                    <td>{$val.filesize|format_bytes}</td>
-                    <td>{$val.username}</td>
-                    <td>{$val.filetime|date="Y-m-d H:i:s"}</td>
-                    <td class="td-manager">
-                        <a class="btn btn-secondary radius" title="编辑title" onClick="editTitle('{$val.fileid}','{$val.title}')"><i
-                            class="Hui-iconfont Hui-iconfont-edit"></i></a>
-                        <a class="btn btn-danger radius" title="删除" onClick="del(this,'{$val.fileid}')"><i
-                            class="Hui-iconfont Hui-iconfont-del2"></i></a></td>
-                </tr>
-                {/foreach}
-            </tbody>
-        </table>
-    </div>
-    <div class="cl pd-5 bg-1 bk-gray mt-20 ">
-        <span class="r">{$list->render()|raw}</span>
-    </div>
-</article>
-
-<script>
-    //通过点击图片来触发文件上传按钮
-    function uploadFile(params) {
-        $("#upload_file").click();
-    }
-
-    // 上传处理
-    function fileChange() {
-        let uploadFile = $("#upload_file").get(0).files;
-        // console.log(uploadFile);
-        if (uploadFile == undefined || uploadFile == null) {
-            layer.msg("请选择文件", { icon: 5, time: 1000 });
-            return false;
-        }
-
-        if (uploadFile.length > 20) {
-            layer.msg("最多20个文件", { icon: 5, time: 1000 });
-            return false;
-        }
-
-        let formData = new FormData();
-
-        for (let i = 0; i < uploadFile.length; i++) {
-            formData.append('upload_file[]', uploadFile[i]);
-        }
-
-        $.ajax({
-            url: '{:url("file_manager/uploadFile")}',
-            type: 'post',
-            dataType: 'json',
-            data: formData,
-            processData: false,
-            contentType: false,
-            xhr: function () {
-                var xhr = new XMLHttpRequest();
-                //使用XMLHttpRequest.upload监听上传过程,注册progress事件,打印回调函数中的event事件
-                xhr.upload.addEventListener('progress', function (e) {
-                    // console.log(e);
-                    //loaded代表上传了多少
-                    //total代表总数为多少
-                    var progressRate = (e.loaded / e.total) * 100 + '%';
-
-                    //通过设置进度条的宽度达到效果
-                    $('.progress > div').css('width', progressRate);
-                })
-
-                return xhr;
-            },
-            success: function (res) {
-                console.log(res);
-                if (res.code == 0) {
-                    layer.msg(res.msg, {
-                        icon: 1,
-                        time: 1000
-                    });
-                    window.location.reload();
-                } else {
-                    layer.msg(res.msg, {
-                        icon: 5,
-                        time: 1000
-                    });
-                    return false;
-                }
-            }
-        });
-    }
-
-    function editTitle(id, title) {
-        if (id==0) {
-            layer.msg('id不可为空', {icon: 5,time: 1000});
-        }
-
-        var content  = '<div  class="cl" style="padding:20px;">';
-            content += '<label class="form-label col-sm-4">';
-            content += '<span class="c-red">*</span>文件title:</label>';
-            content += '<div class="formControls col-sm-6">';
-            content += '<input type="text" class="input-text" name="filetile" id="filetile">';
-            content += '</div><div class="col-3"></div></div></div>';
-
-        layer.open({
-            type: 1,
-            area: ['500px', '200px'],
-            title: '修改文件title',
-            content: '\<\div style="padding:20px;">\<\span class="c-red">*\<\/span>文件title:\<\input type="text" class="input-text" name="filetitle" value="'+title+'" id="filetitle">\<\/div>',
-            btn: ['确定', '取消'],
-            yes: function(index, layero){
-                let filetitle = document.querySelector('input[name="filetitle"]').value;
-                $.ajax({
-                    url: '{:url("file_manager/updateFileTitle")}',
-                    type: 'post',
-                    dataType: 'json',
-                    contentType: 'application/json',
-                    data: JSON.stringify({
-                        id: id,
-                        filetitle: filetitle
-                    }),
-                    success: function (res) {
-                        if (res.code == 0) {
-                            layer.msg(res.msg, {
-                                icon: 1,
-                                time: 1000
-                            });
-                            window.location.reload();
-                        } else {
-                            layer.msg(res.msg, {
-                                icon: 5,
-                                time: 1000
-                            });
-                        }
-                        layer.close(index);
-                    }
-                });
-            }
-        });
-        
-        // layer.open({
-        //     type: 2,
-        //     area: ['700px', '500px'],
-        //     fix: false, //不固定
-        //     maxmin: true,
-        //     shade: 0.4,
-        //     title: '添加标题图',
-        //     content: 'test'
-        // });
-    }
->>>>>>> 78b76253c8ce5873016cf837373af5e30ac80c86
-</script>

+ 0 - 345
view/sys/file_manager/uploadimg.html

@@ -1,345 +0,0 @@
-<div id="tab-img" class="HuiTab">
-    <div class="tabBar clearfix">
-        <span>本地上传</span>
-        <span>网络文件上传</span>
-        <span>服务器图片选择</span>
-        <input type="hidden" name="layer" id="layer" value="{$layer}">
-        <input type="hidden" name="infoid" value={$infoid}>
-        <input type="hidden" name="cjid" value={$cjid}>
-    </div>
-    <!-- 本地上传 -->
-    <div class="tabCon">
-        <div class="step1 active" style="margin-left:30px;">
-            <form id="form-uploadimg" method="post" action="" enctype="multipart/form-data">
-                <div class="row cl" style="margin-top:20px;">
-                    <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>图片要求: </label>
-                    <div class="formControls col-xs-8 col-sm-8">
-                        格式 jpg,png,gif,jpeg,webp; 大小不超过4M.
-                    </div>
-                    <div class="col-3"> </div>
-                </div>
-                <div class="row cl" style="margin-top:20px;">
-                    <label class="form-label col-xs-2 col-sm-2">
-                        <span class="c-red">*</span>本地上传:</label>
-                    <div class="formControls  col-xs-8 col-sm-8">
-                        <input type="file" class="input-text" name="upload_file" id="upload_file">
-                    </div>
-                    <div class="col-3"> </div>
-                </div>
-                <div class="row cl" style="margin-top:20px;">
-                    <input type="hidden" name="img_id" value={$img_id}>
-                    <input type="hidden" name="infoid" value={$infoid}>
-                    <input type="hidden" name="cjid" value={$cjid}>
-                    <div class="formControls col-sm-12">
-                        <div class="skin-minimal">
-                            <div class="check-box">
-                                <input type="checkbox" name="thumb" value="true" {$thumb ? 'checked' : "" }>
-                                <label for="thumb-1">缩略图</label>
-                                <input type="text" class="input-text" name="width" value={$width}
-                                    style="width: 80px;">缩略图宽度
-                                <input type="text" class="input-text" name="height" value={$height}
-                                    style="width: 80px;">缩略图高度
-                                <input type="checkbox" name="original" value="true" {$original ? 'checked' : "" } style="margin-left: 20px;">
-                                <label for="overwrite">保留原图</label>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-                <div class="row cl" style="margin-top:30px;margin-left:30px;">
-                    <div class="col-xs-6 col-sm-5 col-xs-offset-2 col-sm-offset-2">
-                        <input class="btn btn-primary radius" type="button" value="&nbsp;确&nbsp;定&nbsp;"
-                            onCLick="uploadLocalImg();">
-                        <input class="btn btn-default radius" type="button" value="&nbsp;取&nbsp;消&nbsp;"
-                            onClick="layer_close();">
-                    </div>
-                </div>
-            </form>
-        </div>
-        <!-- 本地上传end -->
-    </div>
-    <!-- 网络图片 -->
-    <div class="tabCon">
-        <form id="form-uploadurlimg" method="post" action="" enctype="multipart/form-data">
-            <div class="row cl" style="margin-top:20px;">
-                <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>图片要求: </label>
-                <div class="formControls col-xs-8 col-sm-8">
-                    格式 jpg,png,gif,jpeg,webp; 大小不超过4M.
-                </div>
-                <div class="col-3"> </div>
-            </div>
-            <div class="row cl" style="margin-top:20px;">
-                <label class="form-label col-xs-2 col-sm-2">
-                    <span class="c-red">*</span>图片地址:</label>
-                <div class="formControls col-xs-8 col-sm-8">
-                    <input type="text" class="input-text" name="url_file" id="url_file">
-                </div>
-                <div class="col-3"> </div>
-            </div>
-            <div class="row cl" style="margin-top:20px;">
-                <input type="hidden" name="img_id" value={$img_id}>
-                <div class="formControls col-xs-12 col-sm-12">
-                    <div class="skin-minimal">
-                        <div class="check-box">
-                            <input type="checkbox" name="thumb" value="{$thumb}" {$thumb ? 'checked' : "" }>
-                            <label for="thumb-1">缩略图</label>
-                            <input type="text" class="input-text" name="width" value={$width} style="width: 80px;">缩略图宽度
-                            <input type="text" class="input-text" name="height" value={$height}
-                                style="width: 80px;">缩略图高度
-                            <input type="checkbox" name="original" value="{$original}" {$original ? 'checked' : "" } style="margin-left: 20px;">
-                            <label for="overwrite">保留原图</label>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            <div class="row cl" style="margin-top:30px;margin-left:30px;">
-                <div class="col-xs-6 col-sm-5 col-xs-offset-2 col-sm-offset-2">
-                    <input class="btn btn-primary radius" type="button" value="&nbsp;确&nbsp;定&nbsp;"
-                        onCLick="uploadUrlImg()">
-                    <input class="btn btn-default radius" type="button" value="&nbsp;取&nbsp;消&nbsp;"
-                        onClick="layer_close();">
-                </div>
-            </div>
-        </form>
-    </div>
-    <!-- 在线图片 -->
-    <style>
-        a.active-btn {
-            color: #fff;
-            background-color: #3bb4f2;
-            border-color: #3bb4f2;
-        }
-    </style>
-    <div class="tabCon">
-        <a class="btn radius active-btn" id="database_picture"><i class="Hui-iconfont Hui-iconfont-jifen"></i>数据库模式</a>
-        <a class="btn radius" id="directory_picture"><i class="Hui-iconfont Hui-iconfont-pages"></i> 目录模式</a>
-        <div class="database online-picture">
-            {include file="file_manager/database_picture" /}
-        </div>
-        <div class="directory online-picture" style="display: none;">
-            {include file="file_manager/directory_picture" /}
-        </div>
-        <form id="form-uploadonlineimg" method="post" action="" enctype="multipart/form-data">
-            <div class="row cl" style="margin-top:20px;">
-                <label class="form-label col-xs-2 col-sm-2">
-                    <span class="c-red">*</span>图片地址:</label>
-                <div class="formControls col-xs-8 col-sm-8">
-                    <input type="hidden" name="img_id" value={$img_id}>
-                    <input type="text" class="input-text" name="online_file" id="online_file">
-                </div>
-                <div class="col-3"> </div>
-            </div>
-            <div class="row cl" style="margin-top:30px;margin-left:30px;">
-                <div class="col-xs-6 col-sm-5 col-xs-offset-2 col-sm-offset-2">
-                    <input class="btn btn-primary radius" type="button" value="&nbsp;确&nbsp;定&nbsp;"
-                        onCLick="uploadOnlineImg()">
-                    <input class="btn btn-default radius" type="button" value="&nbsp;取&nbsp;消&nbsp;"
-                        onClick="layer_close();">
-                </div>
-            </div>
-        </form>
-    </div>
-</div>
-
-<!--请在下方写此页面业务相关的脚本-->
-<script type="text/javascript">
-    jQuery.Huitab = function (tabBar, tabCon, class_name, tabEvent, i) {
-        var $tab_menu = $(tabBar);
-        // 初始化操作
-        $tab_menu.removeClass(class_name);
-        $(tabBar).eq(i).addClass(class_name);
-        $(tabCon).hide();
-        $(tabCon).eq(i).show();
-
-        $tab_menu.bind(tabEvent, function () {
-            $tab_menu.removeClass(class_name);
-            $(this).addClass(class_name);
-            var index = $tab_menu.index(this);
-            $(tabCon).hide();
-            $(tabCon).eq(index).show()
-        })
-    }
-
-    $(function () {
-        $.Huitab("#tab-img .tabBar span", "#tab-img .tabCon", "current", "click", "0");
-
-        $("#database_picture").click(function () {
-            $(".online-picture").css('display', 'none');
-            $(".database").css('display', 'block');
-
-            $(this).addClass('active-btn');
-            $('#directory_picture').removeClass('active-btn');
-        });
-
-        $("#directory_picture").click(function () {
-            $(".online-picture").css('display', 'none');
-            $(".directory").css('display', 'block');
-
-            $(this).addClass('active-btn');
-            $('#database_picture').removeClass('active-btn');
-        });
-    });
-
-    // 本地上传图片
-    function uploadLocalImg() {
-        var layer = $("#layer").val();
-        if ($("#upload_file").val() == '') {
-            layer.msg("请选择要上传的文件", {
-                icon: 6,
-                time: 1000
-            });
-            return false;
-        } else {
-            var formData = new FormData($("#form-uploadimg")[0]);
-            $.ajax({
-                url: '{:url("file_manager/uploadLocalImg")}',
-                type: 'POST',
-                async: true,
-                cache: false,
-                data: formData,
-                processData: false,
-                contentType: false,
-                dataType: "json",
-                beforeSend: function () {
-                    // loadIndex = layer.load();
-                },
-                success: function (res) {
-                    if (res.code == 0) {
-                        // layer.close(loadIndex);
-                        if (layer == true) {
-                            var img = res.thumb ? res.thumb : res.picname;
-
-                            window.parent.$("#" + res.img_id).val(img);
-
-                            window.parent.$("#view-" + res.img_id).attr('src', img);
-
-                            layer_close();
-                        } else {
-                            layer.msg('上传成功', {
-                                icon: 1,
-                                time: 1000
-                            }, () => {
-                                window.location.reload();
-                            });
-                        }
-                    } else {
-                        // layer.close(loadIndex);
-                        layer.msg(res.msg, {
-                            icon: 5,
-                            time: 1000
-                        });
-                        return false;
-                    }
-                }
-            });
-        }
-    }
-
-    // 网络图片
-    function uploadUrlImg() {
-        var layer = $("#layer").val();
-        if ($("#url_file").val() == '') {
-            layer.msg("文件地址不可以为空", {
-                icon: 6,
-                time: 1000
-            });
-            return false;
-        } else {
-            var formData = new FormData($("#form-uploadurlimg")[0]);
-            $.ajax({
-                url: '{:url("file_manager/uploadUrlImg")}',
-                type: 'POST',
-                async: true,
-                cache: false,
-                data: formData,
-                processData: false,
-                contentType: false,
-                dataType: "json",
-                beforeSend: function () {
-                    // loadIndex = layer.load();
-                },
-                success: function (res) {
-                    if (res.code == 0) {
-                        console.log(layer);
-                        // layer.close(loadIndex);
-                        if (layer == true) {
-                            var img = res.picname;
-                            window.parent.$("#" + res.img_id).val(img);
-
-                            if (res.thumbname) {
-                                img = res.thumbname;
-                                window.parent.$("#thumb").val(img);
-                            }
-
-                            window.parent.$("#view-" + res.img_id).attr('src', img);
-                            layer_close();
-                        } else {
-                            window.location.reload();
-                        }
-                    } else {
-                        // layer.close(loadIndex);
-                        layer.msg(res.msg, {
-                            icon: 5,
-                            time: 1000
-                        });
-                        return false;
-                    }
-                }
-            });
-        }
-    }
-
-    function uploadOnlineImg() {
-        var layer = $("#layer").val();
-        if ($("#online_file").val() == '') {
-            layer.msg("文件地址不可以为空", {
-                icon: 6,
-                time: 1000
-            });
-            return false;
-        } else {
-            var formData = new FormData($("#form-uploadonlineimg")[0]);
-            $.ajax({
-                url: '{:url("file_manager/uploadOnlineImg")}',
-                type: 'POST',
-                async: true,
-                cache: false,
-                data: formData,
-                processData: false,
-                contentType: false,
-                dataType: "json",
-                beforeSend: function () {
-                    // loadIndex = layer.load();
-                },
-                success: function (res) {
-                    // layer.close(loadIndex);
-                    if (res.code == 0) {
-                        if (layer == true) {
-                            var img = res.picname;
-                            window.parent.$("#" + res.img_id).val(img);
-                            if (res.thumbname) {
-                                img = res.thumbname;
-                                window.parent.$("#thumb").val(img);
-                            }
-                            window.parent.$("#view-" + res.img_id).attr('src', img);
-                            layer_close();
-                        } else {
-                            layer.msg('上传成功', {
-                                icon: 1,
-                                time: 1000
-                            }, () => {
-                                window.location.reload();
-                            });
-                        }
-                    } else {
-                        layer.msg(res.msg, {
-                            icon: 5,
-                            time: 1000
-                        });
-                        return false;
-                    }
-                }
-            });
-        }
-    }
-</script>
-<!--请在上方写此页面业务相关的脚本-->

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff