huwhois 3 jaren geleden
bovenliggende
commit
a44a43387a
54 gewijzigde bestanden met toevoegingen van 1578 en 919 verwijderingen
  1. 37 12
      app/common.php
  2. 159 4
      app/common/model/Article.php
  3. 1 1
      app/common/model/ArticleTags.php
  4. 9 9
      app/common/model/Base.php
  5. 22 21
      app/common/model/Category.php
  6. 9 9
      app/common/model/SysLogin.php
  7. 49 1
      app/common/model/SysMenu.php
  8. 0 1
      app/common/model/SysUser.php
  9. 129 0
      app/common/service/FileService.php
  10. 15 25
      app/sys/controller/Article.php
  11. 96 69
      app/sys/controller/Base.php
  12. 53 29
      app/sys/controller/Category.php
  13. 239 74
      app/sys/controller/FileManager.php
  14. 1 12
      app/sys/controller/Index.php
  15. 0 1
      app/sys/controller/Login.php
  16. 4 7
      app/sys/controller/SysMenu.php
  17. 3 3
      app/sys/controller/SysRole.php
  18. 0 5
      app/sys/controller/SysUser.php
  19. 1 1
      app/sys/controller/System.php
  20. 0 291
      app/sys/view/article/index.html
  21. 0 142
      app/sys/view/category/index.html
  22. 0 88
      app/sys/view/file_manager/uploadimg.html
  23. 2 1
      composer.json
  24. 5 2
      config/app.php
  25. 0 17
      route/app.php
  26. 0 0
      view/sys/advertise/index.html
  27. 0 0
      view/sys/advertise/save.html
  28. 0 0
      view/sys/advertise_type/index.html
  29. 0 0
      view/sys/advertise_type/save.html
  30. 116 0
      view/sys/article/index.html
  31. 14 14
      view/sys/article/save.html
  32. 122 0
      view/sys/category/index.html
  33. 27 64
      view/sys/category/save.html
  34. 452 0
      view/sys/file_manager/uploadimg.html
  35. 0 0
      view/sys/index/awere.html
  36. 7 7
      view/sys/index/index.html
  37. 3 3
      view/sys/layout.html
  38. 1 1
      view/sys/login/index.html
  39. 0 0
      view/sys/module/index.html
  40. 0 0
      view/sys/module/save.html
  41. 0 0
      view/sys/public/breadcrumb.html
  42. 0 0
      view/sys/public/css_js.html
  43. 0 0
      view/sys/public/foot_css_js.html
  44. 0 0
      view/sys/public/footer.html
  45. 2 5
      view/sys/public/header.html
  46. 0 0
      view/sys/sys_log/index.html
  47. 0 0
      view/sys/sys_login/index.html
  48. 0 0
      view/sys/sys_menu/index.html
  49. 0 0
      view/sys/sys_menu/save.html
  50. 0 0
      view/sys/sys_role/index.html
  51. 0 0
      view/sys/sys_role/save.html
  52. 0 0
      view/sys/sys_user/index.html
  53. 0 0
      view/sys/sys_user/password.html
  54. 0 0
      view/sys/sys_user/save.html

+ 37 - 12
app/common.php

@@ -1,21 +1,25 @@
 <?php
 // 应用公共文件
-/*无限级分类*/
-function obj_tree($list, $pk = 'id', $pid = 'pid', $child = 'child', $root = 0)
+/**
+ * 数据库查询结果集无限级分类
+ * @param mixed $list 结果集
+ * @param string $pk 主键
+ * @param string $pid 父级字段名
+ * @param string $child 子结果集
+ * @param int $root 起始id
+ * @return @return array
+ */
+function list_tree($list, $pk = 'id', $pid = 'pid', $child = 'child', $root = 0)
 {
-    $tree=array();
+    $tree = [];
     foreach ($list as $key => $val) {
-        if ($val->$pid == $root) {
-            unset($list->$key);
+        if ($val[$pid] == $root) {
+            unset($list[$key]);
             if (!empty($list)) {
-                $child = obj_tree($list, $pk, $pid, $child, $val[$pk]);
-                if (!empty($child)) {
-                    $val->child=$child;
-                } else {
-                    $val->child = array();
-                }
+                $children = list_tree($list, $pk, $pid, $child, $val[$pk]);
+                $val[$child] = $children;
             }
-            $tree[]=$val;
+            array_push($tree, $val);
         }
     }
     return $tree;
@@ -40,3 +44,24 @@ function make_tree($list, $pk = 'id', $pid = 'pid', $child = 'child', $root = 0)
     }
     return $tree;
 }
+
+/**
+ * 获取指定月份的第一天开始和最后一天结束的时间戳
+ *
+ * @param int $y 年份 $m 月份
+ * @return array(本月开始时间,本月结束时间)
+ */
+function month_frist_and_last_day($y = "", $m = ""){
+    if ($y == "") $y = date("Y");
+    if ($m == "") $m = date("m");
+    $m = sprintf("%02d", intval($m));
+    $y = str_pad(intval($y), 4, "0", STR_PAD_RIGHT);
+ 
+    $m>12 || $m<1 ? $m=1 : $m=$m;
+    $firstday = strtotime($y . $m . "01000000");
+    $firstdaystr = date("Y-m-01", $firstday);
+    $lastday = strtotime(date('Y-m-d 23:59:59', strtotime("$firstdaystr +1 month -1 day")));
+ 
+    return [ "firstday" => $firstday, "lastday" => $lastday];
+}
+

+ 159 - 4
app/common/model/Article.php

@@ -1,18 +1,173 @@
 <?php
+
+declare(strict_types=1);
+
 namespace app\common\model;
 
-class Article extends \think\Model
+use think\exception\HttpException;
+
+use app\common\model\Base;
+
+class Article extends Base
 {
+    protected $schema = [
+        "id"          => "int",
+        "cid"         => "int",
+        "title"       => "varchar",
+        "writer"      => "varchar",
+        "source"      => "varchar",
+        "titlepic"    => "varchar",
+        "keywords"    => "varchar",
+        "summary"     => "varchar",
+        "content"     => "varchar",
+        "discussed"   => "int",
+        "status"      => "int",
+        "top"         => "int",
+        "sorts"       => "int",
+        "hits"        => "int",
+        "likes"       => "int",
+        "content_type"=> "int",
+        "userid"      => "int",
+        "username"    => "varchar",
+        "create_time" => "int",
+        "update_time" => "int"
+    ];
+
+    protected $disuse = ['top','discussed'];
+
+    public function category()
+    {
+        return $this->belongsTo('Category', 'cid')->bind(['category_name' => 'name', 'category_url' => 'url']);
+    }
+
+    public static function queryPage($params)
+    {
+        $where = [];
+
+        if (isset($params['status'])) {
+            $where[] = ['status', '=', (int) $params['status']];
+        }
+
+        if (!empty($params['cid'])) {
+            $where[] = ['cid', '=', (int) $params['cid']];
+        }
+
+        if (!empty($params['key'])) {
+            $where[] = ['title|keywords', 'LIKE', '%' . (string)$params['key'] . '%'];
+        }
+
+        if (!empty($params['yearMonth'])) {
+            if (!preg_match("/^([0-9]{4})\/([0-9]{1,2})$/", $params['yearMonth']) && !preg_match("/^([0-9]{4})-([0-9]{1,2})$/", $params['yearMonth'])) {
+                throw new HttpException(404, '日期格式不正确');
+            }
+
+            $separator = strrpos('/', $params['yearMonth']) ? '/' : '-';
+
+            $year = $month = '';
+
+            if (strnatcasecmp(PHP_VERSION, '7.0.0') >= 0) {
+                list($year, $month) = explode($separator, $params['yearMonth']);
+            } else {
+                list($month, $year) = explode($separator, $params['yearMonth']);
+            }
+
+            if ((int) $month < 1 || (int) $month > 12) {
+                throw new HttpException(404, '日期格式不正确');
+            }
+
+            $days = month_frist_and_last_day($year, $month);
+
+            $where['create_time'] = ['between', [$days['firstday'], $days['lastday']]];
+        }
+
+        $limit = empty($params['limit']) ? 20 : (int)$params['limit'];
+
+        $list = self::where($where)
+            ->field('id,cid,title,titlepic,username,hits,sorts,status,create_time')
+            ->with(['category'])
+            ->order('id desc')->paginate($limit, false, ['query' => $params]);
+
+        return $list;
+    }
+
+    public static function getListByCid($cid = 0, $limit = 10, $order = [])
+    {
+        $where = [];
+
+        if ($cid != 0) {
+            if ($cid < 0) {
+                $where[] = ['cid', '<>', abs($cid)];
+            } else {
+                $where[] = ['cid', '=', $cid];
+            }
+        }
+
+        $order = !empty($order) ? array_merge($order, ['id' => 'desc']) : ['id' => 'desc'];
+
+        return self::where($where)
+            ->field('id,cid,title,titlepic,username,hits,sorts,status,create_time')
+            ->order($order)->limit($limit)->select();
+    }
+
+    public static function getTop($limit)
+    {
+        return self::with('category')->field('id,cid,title,titlepic,summary,username,hits,sorts,status,create_time')
+            ->order('sorts desc, hits desc')->limit($limit)->select();
+    }
+
+    public static function getOne($id)
+    {
+        if (!$id) {
+            throw new HttpException(404, '页面不存在');
+        }
+
+        return self::with('category')->find($id);
+    }
+
+    public static function getNextPrev($id, $cid = null)
+    {
+        if ($cid) {
+            $id_list = self::where(['status' => 1, 'cid' => $cid])
+                ->order(['sorts' => 'desc', 'id' => 'desc'])
+                ->column('id');
+        } else {
+            $id_list = self::where(['status' => 1])->column('id');
+        }
+
+        if (count($id_list)==1) {
+            $data_p = null;
+            $data_N = null;
+        } else {
+            $key = array_search($id, $id_list);
+            if ($key == 0) {
+                $data_p = null;
+                $N = $id_list[1];
+                $data_N = self::field('id,title,create_time')->find($N);
+            } elseif ($key == count($id_list) - 1) {
+                $P = $id_list[count($id_list) - 2];
+                $data_p = self::field('id,title,create_time')->find($P);
+                $data_N = null;
+            } else {
+                $P = $id_list[$key - 1];
+                $data_p =  self::field('id,title,create_time')->find($P);
+                $N = $id_list[$key + 1];
+                $data_N =  self::field('id,title,create_time')->find($N);
+            }
+        }
+
+        return ['prev' => $data_p, 'next' => $data_N];
+    }
+
     public function createTimeArchive()
     {
         $create_times = $this->order('create_time desc')->column('create_time');
         $timeList = [];
-        foreach($create_times as $value) {
+        foreach ($create_times as $value) {
             $yearAndMonth = date("Y-m", $value);
             $timeList[] = $yearAndMonth;
         }
         $timeList = array_unique($timeList);
-        
+
         return $timeList;
     }
 
@@ -20,7 +175,7 @@ class Article extends \think\Model
     {
         $article = self::find($data['id']);
         $article->sort = $data['sort'];
-        
+
         return $article->save();
     }
 }

+ 1 - 1
app/common/model/ArticleTags.php

@@ -5,6 +5,6 @@ class ArticleTags extends \think\Model
 {
     public static function tagsList($name)
     {
-        return self::where('tag', $name)->field('id, cid, title, username, titlepic, description, hits, create_time, url, cname')->order('id', 'desc')->paginate();
+        return self::where('tag', $name)->field('id, cid, title, username, titlepic, summary, hits, create_time, category_url, category_name')->order('id desc')->select();
     }
 }

+ 9 - 9
app/common/model/Base.php

@@ -11,9 +11,9 @@ class Base extends model
     {
         try {
             self::destroy($id);
-            return json(['code' => 1, 'msg' => '删除成功!']);
+            return json(['code' => 0, 'msg' => '删除成功!']);
         } catch (\Exception $e) {
-            return json(['code' => 0, 'msg' => $e->getMessage()]);
+            return json(['code' => 1, 'msg' => $e->getMessage()]);
         }
     }
     
@@ -22,13 +22,13 @@ class Base extends model
     {
         try {
             $info = self::find($data['id']);
-            if ($info->sort != $data['sort']) {
-                $info->sort = $data['sort'];
+            if ($info->sort != $data['sorts']) {
+                $info->sort = $data['sorts'];
                 $info->save();
-                return json(['code' => 1, 'msg' => '修改成功!']);
+                return json(['code' => 0, 'msg' => '修改成功!']);
             }
         } catch (\Exception $e) {
-            return json(['code' => 0, 'msg' => $e->getMessage()]);
+            return json(['code' => 1, 'msg' => $e->getMessage()]);
         }
     }
 
@@ -37,11 +37,11 @@ class Base extends model
     {
         try {
             $info         = self::find($id);
-            $info->status = 3 - $info['status'];
+            $info->status = 1 - $info['status'];
             $info->save();
-            return json(['code' => 1, 'msg' => '修改成功!', 'status'=>$info->status]);
+            return json(['code' => 0, 'msg' => '修改成功!', 'status'=>$info->status]);
         } catch (\Exception $e) {
-            return json(['code' => 0, 'msg' => $e->getMessage()]);
+            return json(['code' => 1, 'msg' => $e->getMessage()]);
         }
     }
 }

+ 22 - 21
app/common/model/Category.php

@@ -4,30 +4,31 @@ namespace app\common\model;
 
 class Category extends Base
 {
-    public function module()
-    {
-        return $this->belongsTo('Module', 'module_id');
-    }
+    protected $schema = [
+        "id"          => "int",
+        "parent_id"         => "int",
+        "name"        => "varchar",
+        "url"         => "varchar",
+        "route"       => "varchar",
+        "tablename"   => "varchar",
+        "template"    => "varchar",
+        "type"        => "int",
+        "is_nav"      => "int",
+        "note"        => "varchar",
+        "sort"        => "int",
+        "title"       => "varchar",
+        "keywords"    => "varchar",
+        "description" => "varchar",
+        "is_blank"    => "int",
+        "create_time" => "int",
+        "update_time" => "int"
+    ];
+
+    protected $disuse = [ 'route' ];
 
     // 获取列表
     public static function getList()
     {
-        $list = self::with(['module'])
-            ->order(['sort desc', 'id' => 'desc'])
-            ->select();
-        // halt($list);
-        foreach ($list as $k => $v) {
-            if ($list[$k]['module_id']) {
-                $v['module_name'] = $v->module->getData('module_name');
-                $v['table_name'] = $v->module->getData('table_name');
-            }
-        }
-        return $list;
-    }
-
-
-    public static function articleCategoryies()
-    {
-        return self::where('module_id', 19)->where('status', 1)->field('id, parent_id, category_name, category_folder')->select();
+        return self::order(['id' => 'desc'])->select();
     }
 }

+ 9 - 9
app/common/model/SysLogin.php

@@ -11,27 +11,27 @@ use think\Model;
 
 class SysLogin extends Model
 {
-    protected $pk = 'loginid';
+    protected $pk = 'id';
 
     // 管理员登录日志记录
-    public static function record($info)
+    public static function record(int $userid, string $username, string $logintime, string $loginip, int $status = 0)
     {
         // 入库
         self::create([
-            'userid'    => $info->userid,
-            'username'  => $info->username,
-            'logintime' => $info->per_time,
-            'loginip'   => $info->per_ip,
-            'status'    => 0,
+            'userid'    => $userid,
+            'username'  => $username,
+            'logintime' => $logintime,
+            'loginip'   => $loginip,
+            'status'    => $status,
         ]);
     }
 
     public static function queryPage($limit = 30, $userid = 0)
     {
         if ($userid==0) {
-            $list = self::order("loginid desc")->paginate($limit);
+            $list = self::order("id desc")->paginate($limit);
         } else {
-            $list = self::where('userid', $userid)->order("loginid desc")->paginate($limit);
+            $list = self::where('userid', $userid)->order("id desc")->paginate($limit);
         }
         
         return $list;

+ 49 - 1
app/common/model/SysMenu.php

@@ -15,7 +15,7 @@ class SysMenu extends Model
             $permission_ids = $roleModel->getpermissionIds($rid);
             $data = self::where('id', 'IN', $permission_ids)->field('id, pid, name, url, icon')->select();
         }
-        return $data;
+        return list_tree($data);
     }
 
     public static function queryButtonPermissionsByRoleid($rid)
@@ -30,4 +30,52 @@ class SysMenu extends Model
 
         return $data;
     }
+
+    /**
+     * 面包屑
+     */
+    public static function getBreadCrumb($route)
+    {
+        $active =  \app\common\model\SysMenu::where('url', $route)->find();
+
+        $active_pid = 0;
+
+        $breadCrumb = [];
+
+        if ($active) {
+            $active_pid = $active->pid;
+
+            $result = \app\common\model\SysMenu::find($active_pid);
+            // 如果还有上级
+            if ($result) {
+                $res = \app\common\model\SysMenu::find($result->pid);
+                // 如果还有上级
+                if ($res) {
+                    $active_pid = $result->pid;
+                    $breadCrumb[] = [
+                        'url'   => $res['url'],
+                        'title' => $res['name'],
+                    ];
+                }
+                $breadCrumb[] = [
+                    'url'   => $result['url'],
+                    'title' => $result['name'],
+                ];
+            }
+            $breadCrumb[] = [
+                'url'   => $active['url'],
+                'title' => $active['name'],
+            ];
+        } else {
+            $breadCrumb[] = [
+                'url'   => null,
+                'title' => '我的桌面',
+            ];
+        }
+
+        return [
+            'active_pid' => $active_pid,
+            'breadCrumb' => $breadCrumb
+        ];
+    }
 }

+ 0 - 1
app/common/model/SysUser.php

@@ -109,7 +109,6 @@ class SysUser extends Model
 
             // 记录登录
             SysLogin::record($info->userid, $info->username, $datetime, $ip);
-
             return json(['code' => 0, 'msg' => '登录成功']);
         } else {
             // 记录失败

+ 129 - 0
app/common/service/FileService.php

@@ -0,0 +1,129 @@
+<?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\facade\Filesystem;
+use think\Exception;
+use think\File;
+
+class FileService
+{
+    /**
+     * 生成缩略图
+     * @param string $filename 必须参数, 图片路径名(相对or绝对)(/public/uploads/...)
+     * @param int $width 缩略图宽值, 默认 384px;
+     * @param int $height 缩略图高值, 默认 224px;
+     * @param int $type 缩略图裁剪方式, 默认值 1, 固定尺寸缩放; 其他: 1, 等比例缩放;
+     * 2, 缩放后填充; 3, 居中裁剪; 4, 左上角裁剪; 5, 右下角裁剪
+     * @return string $thumbname 缩略图文件名
+     */
+    public static function makeThumb($filename, $width = 384, $height = 224, $type = 1, $t_suffix = "thumb")
+    {
+        $file = './storage/' . str_replace('\\', '/', $filename);
+
+        $ext = pathinfo($file, PATHINFO_EXTENSION);
+
+        $thumbname = str_replace('.' . $ext, '', str_replace('\\', '/', $filename)) . $t_suffix . '.' . $ext;
+
+        $image = Image::open($file);
+
+        $result = $image->thumb($width, $height, $type)->save('./storage/' . $thumbname);
+
+        return $result ? $thumbname : '';
+    }
+
+    public function urlImg($url)
+    {
+        $ch = curl_init($url);
+        curl_setopt($ch, CURLOPT_HEADER, 0);
+        curl_setopt($ch, CURLOPT_NOBODY, 0); // 只取body头
+        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 (!$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 static 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;
+    }
+}

+ 15 - 25
app/sys/controller/Article.php

@@ -13,6 +13,7 @@ namespace app\sys\controller;
 use think\facade\View;
 
 use app\common\model\Category as CategoryModel;
+use app\common\model\Article as ArticleModel;
 
 /**
  * 文章管理  
@@ -24,29 +25,19 @@ class Article extends Base
 
     public function index()
     {
-        $categories = CategoryModel::articleCategoryies();
+        $categories = CategoryModel::select();
 
-        $categories_url = [];
-        $categories_name = [];
-        foreach ($categories as $value) {
-            $categories_url[$value->id] = $value->url;
-            $categories_name[$value->id] = $value->category_name;
-        }
-
-        $category_tree = obj_tree($categories);
+        $category_tree = list_tree($categories);
+        
+        $cid = $this->app->request->param('cid');
 
-        $where = [];
+        $params = $this->app->request->param();
 
-        if ($cid = $this->app->request->param('cid')) {
-            $where['cid'] = $cid;
-        }
-
-        $data = $this->modelName::where($where)->field('id,cid,title,username,hits,sort,create_time')->order(['sort desc', 'id desc'])->paginate();
+        $list = ArticleModel::queryPage($params);
 
         View::assign('category_tree', $category_tree);
-        View::assign('categories_url', $categories_url);
-        View::assign('categories_name', $categories_name);
-        View::assign('data', $data);
+
+        View::assign('list', $list);
         View::assign('cid', $cid);
         return View::fetch();
     }
@@ -62,16 +53,15 @@ class Article extends Base
             if ($params['title'] == '') {
                 $this->error("标题不能为空");
             }
-            $params['content'] =  $params['editorValue'];
-            unset($params['editorValue']);
+            $params['content'] =  isset($params['content']) ? $params['content'] : '';
             try {
                 if ($params['id'] != 0) {
-                   $this->modelName::update($params);
+                   ArticleModel::update($params);
                 } else {
                     $params['userid'] = $this->getSysUser()->userid;
                     $params['username'] = $this->getSysUser()->username;
                     unset($params['id']);
-                    $this->modelName::create($params);
+                    ArticleModel::create($params);
                 }
             } catch (\Exception $e) {
                 $msg = $e->getMessage();
@@ -85,12 +75,12 @@ class Article extends Base
             }
 
             if ($id) {
-                $data = $this->modelName::find($id);
+                $data = ArticleModel::find($id);
             } else {
-                $data = null;
+                $data = new ArticleModel();
             }
             
-            $category_info = CategoryModel::field('id, parent_id, category_name')->find($cid);
+            $category_info = CategoryModel::field('id, parent_id, name')->find($cid);
     
             View::assign('cid', $cid);
             View::assign('category_info', $category_info);

+ 96 - 69
app/sys/controller/Base.php

@@ -25,13 +25,14 @@ use think\facade\View;
 use think\Response;
 use think\Validate;
 
+use app\common\model\SysMenu;
 
 /**
  * 控制器基础类
  */
 abstract class Base
 {
-    use \liliuwei\think\Jump;
+    // use \liliuwei\think\Jump;
     /**
      * Request实例
      * @var \think\Request
@@ -88,22 +89,19 @@ abstract class Base
 
     // 初始化
     protected function initialize()
-    {
+    {   
         // 左侧菜单
         $rid = Session::get('adminuser.roleid');
 
-        $menus = Cache::get('menus');
-        if (!$menus) {
-            $menus = \app\common\model\SysMenu::getUserMenuList($rid);
-
-            Cache::set('menus', $menus);
-        }
+        $menus = $rid !=null ? SysMenu::getUserMenuList($rid) : [];
 
         $controller =  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
         if (Request::has('_layer')) {
@@ -119,14 +117,6 @@ abstract class Base
         //     View::assign(['pjax' => false]);
         // }
 
-        // 当前活动菜单父id & 面包导航
-        $this->getBreadCrumb($route);
-
-        $menus = obj_tree($menus);
-        View::assign('menus', $menus);
-
-
-
         // 内容管理,获取栏目列表
         // if (class_exists('\app\common\model\Cate')) {
         //     $cates = \app\common\model\Cate::getList();
@@ -143,62 +133,18 @@ abstract class Base
         // View::assign(['indexUrl' => $indexUrl ?? '/']);
 
         // 查询系统设置
-        // $system       = \app\common\model\System::find(1);
-        // $this->system = $system;
+        $system       = \app\common\model\System::find(1);
+        $this->system = $system;
         View::assign([
-            // 'system' => $system,
+            'active_pid' => $breadCrumb['active_pid'],
+            'breadCrumb' => $breadCrumb['breadCrumb'],
+            'menus' => $menus,
+            'system' => $system,
             'sys_version'    => Config::get('app.sys_version'),
             'default_lang' => env('lang.default_lang', 'en')
         ]);
     }
 
-    /**
-     * 当前活动菜单父id & 面包导航
-     */
-    public function getBreadCrumb($route)
-    {
-        $active =  \app\common\model\SysMenu::where('url', $route)->find();
-
-        $active_pid = 0;
-
-        $breadCrumb = [];
-
-        if ($active) {
-            $active_pid = $active->pid;
-
-            $result = \app\common\model\SysMenu::find($active_pid);
-            // 如果还有上级
-            if ($result) {
-                $res = \app\common\model\SysMenu::find($result->pid);
-                // 如果还有上级
-                if ($res) {
-                    $active_pid = $result->pid;
-                    $breadCrumb[] = [
-                        'url'   => $res['url'],
-                        'title' => $res['name'],
-                    ];
-                }
-                $breadCrumb[] = [
-                    'url'   => $result['url'],
-                    'title' => $result['name'],
-                ];
-            }
-            $breadCrumb[] = [
-                'url'   => $active['url'],
-                'title' => $active['name'],
-            ];
-        } else {
-            $breadCrumb[] = [
-                'url'   => null,
-                'title' => '我的桌面',
-            ];
-        }
-
-        View::assign('active_pid', $active_pid);
-
-        View::assign(['breadCrumb' => $breadCrumb]);
-    }
-
     /**
      * 验证数据
      * @access protected
@@ -241,6 +187,83 @@ abstract class Base
         }
     }
 
+    /**
+     * 操作成功跳转的快捷方法
+     * @access protected
+     * @param  mixed $msg 提示信息
+     * @param  string $url 跳转的URL地址
+     * @param  mixed $data 返回的数据
+     * @param  integer $wait 跳转等待时间
+     * @param  array $header 发送的Header信息
+     * @return void
+     */
+    protected function success($msg = '', string $url = null, $data = '', int $wait = 3, array $header = [])
+    {
+        if (is_null($url) && isset($_SERVER["HTTP_REFERER"])) {
+            $url = $_SERVER["HTTP_REFERER"];
+        } elseif ($url) {
+            $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : (string)$this->app->route->buildUrl($url);
+        }
+
+        $result = [
+            'code' => 0,
+            'msg' => $msg,
+            'data' => $data,
+            'url' => $url,
+            'wait' => $wait,
+        ];
+
+        $type = $this->request->isJson() || $this->request->isAjax() ? 'json' : 'html';
+        // 把跳转模板的渲染下沉,这样在 response_send 行为里通过getData()获得的数据是一致性的格式
+        if ('html' == strtolower($type)) {
+            $type = 'view';
+            $response = Response::create($this->app->config->get('jump.dispatch_success_tmpl'), $type)->assign($result)->header($header);
+        } else {
+            $response = Response::create($result, $type)->header($header);
+        }
+
+        throw new HttpResponseException($response);
+    }
+
+    /**
+     * 操作错误跳转的快捷方法
+     * @access protected
+     * @param  mixed $msg 提示信息
+     * @param  string $url 跳转的URL地址
+     * @param  mixed $data 返回的数据
+     * @param  integer $wait 跳转等待时间
+     * @param  array $header 发送的Header信息
+     * @return void
+     */
+    protected function error($msg = '', string $url = null, $data = '', int $wait = 3, array $header = [])
+    {
+        if (is_null($url)) {
+            $url = $this->request->isAjax() ? '' : 'javascript:history.back(-1);';
+        } elseif ($url) {
+            $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : (string)$this->app->route->buildUrl($url);
+        }
+
+        $result = [
+            'code' => 1,
+            'msg' => $msg,
+            'data' => $data,
+            'url' => $url,
+            'wait' => $wait,
+        ];
+
+        $type = $this->request->isJson() || $this->request->isAjax() ? 'json' : 'html';
+
+        if ('html' == strtolower($type)) {
+            $type = 'view';
+            $response = Response::create($this->app->config->get('jump.dispatch_error_tmpl'), $type)->assign($result)->header($header);
+        } else {
+            $response = Response::create($result, $type)->header($header);
+        }
+
+        throw new HttpResponseException($response);
+    }
+
+
     // /**
     //  * 返回封装后的API数据到客户端
     //  * @param mixed   $data   要返回的数据
@@ -361,8 +384,11 @@ abstract class Base
     public function sort()
     {
         if (Request::isPost()) {
-            $data  = Request::post();
-            return $this->modelName::sort($data);
+            $param  = Request::param();
+
+            $model = 'app\common\model\\' . $this->modelName;
+
+            return $model::sort($param);
         }
     }
 
@@ -370,7 +396,8 @@ abstract class Base
     public function state(string $id)
     {
         if (Request::isPost()) {
-            return $this->modelName::state($id);
+            $model = 'app\common\model\\' . $this->modelName;
+            return $model::state($id);
         }
     }
 

+ 53 - 29
app/sys/controller/Category.php

@@ -1,27 +1,32 @@
 <?php
-declare (strict_types = 1);
+declare(strict_types=1);
 /**
  * +----------------------------------------------------------------------
  * | 栏目控制制器
  * +----------------------------------------------------------------------
  */
-namespace app\admin\controller;
+
+namespace app\sys\controller;
 
 // 引入框架内置类
 use think\facade\View;
 
+use app\common\model\Category as CategoryModel;
+
 class Category extends Base
 {
-    protected  $modelName = "\app\common\model\Category";
+    protected  $modelName = "Category";
 
     public function index()
     {
-        $list = $this->modelName::getList();
+        $list = CategoryModel::getList();
 
-        $list = obj_tree($list, $pk = 'id', $pid = 'parent_id');
+        $list = list_tree($list, 'id', 'parent_id');
 
         View::assign('list', $list);
 
+        View::assign('types', ['一般', '目录', '单页', '锚点', '链接']);
+
         return View::fetch();
     }
 
@@ -31,43 +36,62 @@ class Category extends Base
      * @return mix 
      */
     public function save($id = 0)
+    {
+        if ($id != 0) {
+            $data = CategoryModel::find($id);
+        } else {
+            $data = [
+                "id"          => 0,
+                "parent_id"         => 0,
+                "name"        => "",
+                "url"         => "",
+                "route"       => "",
+                "tablename"   => "",
+                "template"    => "",
+                "type"        => 0,
+                "is_nav"      => 0,
+                "note"        => "",
+                "sort"        => 0,
+                "title"       => "",
+                "keywords"    => "",
+                "description" => "",
+                "is_blank"    => 0
+            ];
+        }
+
+        View::assign('data', $data);
+
+        $list = list_tree(CategoryModel::select());
+
+        View::assign('list', $list);
+
+        return View::fetch();
+    }
+
+    public function doSave($id)
     {
         if ($this->app->request->isPost()) {
             $params = $this->app->request->param();
-            
-            if ($params['category_name'] == '') {
+
+            if ($params['name'] == '') {
                 $this->error("名称不能为空");
             }
 
             try {
-                $id = $params['id']; 
+                $id = $params['id'];
                 unset($params['id']);
 
                 if ($id != 0) {
-                    $this->modelName::update($params, ['id' => $id]);
+                    CategoryModel::update($params, ['id' => $id]);
                 } else {
-                    $this->modelName::create($params);
+                    CategoryModel::create($params);
                 }
             } catch (\Exception $e) {
                 $msg = $e->getMessage();
 
-                $this->error("错误提示:".$msg);
+                $this->error("错误提示:" . $msg);
             }
-            $this->success('操作成功', (String)url('index'));
-        } else {
-            if ($id != 0) {
-                $data = $this->modelName::find($id);
-            } else {
-                $data = null;
-            }
-            
-            View::assign('data', $data);
-
-            $list = obj_tree($this->modelName::select());
-
-            View::assign('list', $list);
-
-            return View::fetch();
+            $this->success('操作成功', (string)url('index'));
         }
     }
 
@@ -75,11 +99,11 @@ class Category extends Base
     public function delete($id)
     {
         if ($this->app->request->isPost()) {
-            if ($this->modelName::where('parent_id', $id)->value('id')) {
-                return ['code'=>0, 'msg'=>'子栏目不为空, 若要删除请先清空子栏目'];
+            if (CategoryModel::where('parent_id', $id)->value('id')) {
+                return ['code' => 0, 'msg' => '子栏目不为空, 若要删除请先清空子栏目'];
             }
 
-            return $this->modelName::del($id);
+            return CategoryModel::del($id);
         }
     }
 }

+ 239 - 74
app/sys/controller/FileManager.php

@@ -1,27 +1,96 @@
 <?php
+
 /**
- * upload文件浏览器
+ * upload文件管理
  *
  * @version      0.0.0
  * @author      by huwhois
  * @time        2017/11/27
  */
-namespace app\admin\controller;
 
-use think\App;
-use think\Request;
+namespace app\sys\controller;
+
 use think\facade\View;
+use think\File;
 use think\Image;
+use think\facade\Config;
+
+use app\common\service\FileService;
+use Exception;
 
 class FileManager extends Base
 {
-    protected $img_path = ''; 
     protected $t_suffix = '_thumb';
-    protected $t_width = 400;
-    protected $t_height = 300;
-    protected $request;
+    protected $width = 400;  // 缩略图高度
+    protected $height = 300;
 
-    public function uploadimg($thumb=false, $width=400, $height=300)
+    /**
+     * 处理上传的图片
+     */
+    protected function dealUploadImg(File $file, $water, $thumb, $width, $height, $overwrite)
+    {
+        $savename = "";
+        $thumbname = "";
+
+        if ($water == true || $thumb == true) {
+            $image = Image::open($file);
+
+            if ($water) {
+                $type = $this->system->water_type ?: Config::get('filesystem.water.type');
+
+                if ($type == 'water') {
+                    $watemark = $this->system->watermark ?: Config::get('filesystem.water.watermark');
+                    $image->water($watemark);
+                } else {
+                    $watetext = $this->system->watertext ?: Config::get('filesystem.water.watertext');
+                    $image->text($watetext, Config::get('filesystem.water.waterfont'), 30, '#ffffff30');
+                }
+            }
+
+            $savename = $file->hashName();
+            $realPath = Config::get('filesystem.disks.public.root') . '/' . $savename;
+
+            if ($thumb == true) {
+                if ($overwrite == true) {
+                    $image->thumb($width, $height, 1);
+
+                    $image->save($realPath);
+                } else {
+                    $image->save($realPath);
+
+                    $image->thumb($width, $height, 1);
+
+                    $ext = $file->extension();
+
+                    $thumbname = str_replace('.' . $ext, '', str_replace('\\', '/', $savename)) . $this->t_suffix . '.' . $ext;
+                    // halt(Config::get('filesystem.disks.public.root') .'/' . $thumbname);
+                    $image->save(Config::get('filesystem.disks.public.root') . '/' . $thumbname);
+                }
+            } else {
+                $image->save($realPath);
+            }
+            unset($image);
+        } else {
+            $savename = \think\facade\Filesystem::disk('public')->putFile('/', $file);
+        }
+
+        return [
+            'picname'   => str_replace('\\', '/', $savename),
+            'thumbname' => $thumbname
+        ];
+    }
+
+    /**
+     * 图片上传
+     * @file upload_file   上传的文件
+     * @param string  $img_id   图片ipnut text id 默认值 picture
+     * @param boolean $water    是否添加水印
+     * @param boolean $thumb    是否制作缩略图
+     * @param int $width        缩略图最大宽
+     * @param int $height       缩略图最大高
+     * @param bool $overwrite   生成缩略图后是否保存原图
+     */
+    public function uploadimg(string $img_id = 'picture', $water = false, $thumb = false, $width = 400, $height = 300, $overwrite = false)
     {
         if ($this->request->isPost()) {
             $file = $this->request->file('upload_file');
@@ -30,10 +99,10 @@ class FileManager extends Base
                     validate(
                         [
                             'file' => [
-                                // 限制文件大小(单位b),这里限制为20M
-                                'fileSize' => 20 * 1024 * 1024,
+                                // 限制文件大小(单位b),这里限制为4M
+                                'fileSize' => 4 * 1024 * 1024,
                                 // 限制文件后缀,多个后缀以英文逗号分割
-                                'fileExt'  => 'jpg,png,gif,jpeg,webp'
+                                'fileExt'  => 'jpg,png,gif,jpeg,webp,jfif'
                             ]
                         ],
                         [
@@ -42,54 +111,150 @@ class FileManager extends Base
                         ]
                     )->check(['file' => $file]);
 
-                    $savename = \think\facade\Filesystem::disk('public')->putFile( '/', $file);
-                    $thumbname = "";
-                    if ($thumb) {
-                        $thumbname = $this->makeThumb($savename, $width, $height);
-                    }
+                    $arr = $this->dealUploadImg($file, $water, $thumb, $width, $height, $overwrite);
+
+                    return array_merge([
+                        'code' => 0,
+                        'img_id' => $img_id,
+                        'picture_url' => Config::get('filesystem.disks.public.url') . '/']
+                        , $arr);
                 } catch (\think\exception\ValidateException $e) {
                     $this->error($e->getMessage());
                 }
-                unset($file);
-                return [
-                    'code'=>2,
-                    'picname' => '/storage/' . str_replace('\\', '/', $savename),
-                    'thumbname'=>'/storage/' . $thumbname
-                ];
             } else {
-                $this->error('图片不能为空');  
+                $this->error('图片不能为空');
             }
         } else {
+            View::assign('img_id', $img_id);
+            View::assign('water', $water);
             View::assign('thumb', $thumb);
             View::assign('width', $width);
             View::assign('height', $height);
+            View::assign('overwrite', $overwrite);
 
             return View::fetch();
         }
     }
 
     /**
-     * 生成缩略图
-     * @param string $filename 必须参数, 图片路径名(相对or绝对)(/public/uploads/...)
-     * @param int $width 缩略图宽值, 默认 384px;
-     * @param int $height 缩略图高值, 默认 224px;
-     * @param int $type 缩略图裁剪方式, 默认值 1, 固定尺寸缩放; 其他: 1, 等比例缩放;
-     * 2, 缩放后填充; 3, 居中裁剪; 4, 左上角裁剪; 5, 右下角裁剪
-     * @return string $thumbname 缩略图文件名
+     * 图片上传
+     * @file upload_file   上传的文件
+     * @param string  $img_id   图片ipnut text id 默认值 picture
+     * @param boolean $water    是否添加水印
+     * @param boolean $thumb    是否制作缩略图
+     * @param int $width        缩略图最大宽
+     * @param int $height       缩略图最大高
+     * @param bool $overwrite   生成缩略图后是否保存原图
      */
-    public function makeThumb($filename, $width =384, $height = 224, $type = 1)
+    public function uploadurlimg(string $img_id = 'picture', $water = false, $thumb = false, $width = 400, $height = 300, $overwrite = false)
     {
-        $file ='./storage/' . str_replace('\\', '/', $filename);
+        if ($this->request->isPost()) {
+            $urlImg = $this->request->param('url_file');
+
+            if ($urlImg) {
+                try {
+                    $fileService = new FileService();
+
+                    $file = $fileService->urlImg($urlImg);
+
+                    $arr = $this->dealUploadImg($file, $water, $thumb, $width, $height, $overwrite);
+
+                    @unlink($file->realPath);
+
+                    return array_merge([
+                        'code' => 0,
+                        'img_id' => $img_id,
+                        'picture_url' => Config::get('filesystem.disks.public.url') . '/']
+                        , $arr);
+                } catch (\think\exception\ValidateException $e) {
+                    $this->error($e->getMessage());
+                }
+            } else {
+                $this->error('图片地址不能为空');
+            }
+        }
+    }
+
+    public function uploadonlineimg(string $img_id = 'picture', $water = false, $thumb = false, $width = 400, $height = 300, $overwrite = false)
+    {
+        if ($this->request->isPost()) {
+            $pathImg = $this->request->param('online_file');
+
+            if ($pathImg && file_exists($this->app->getRootPath() . "public" . $pathImg)) {
+
+                $picname = $pathImg;
+                $thumbname = "";
+                
+                if ($thumb) {
+                    if (stripos($picname, $this->t_suffix)) {
+                        $thumbname = $pathImg;
+                    } else {
+                        try {
+                            $file = new File($this->app->getRootPath() . "public"  . $pathImg);
+    
+                            $ext = $file->getExtension();
+                            
+                            $thumbname = str_replace('.' . $ext, '', str_replace('\\', '/', $picname)) . $this->t_suffix . '.' . $ext;
+
+                            if (!file_exists($thumbname)) {
+                                $image = Image::open($file);
         
-        $ext = pathinfo($file, PATHINFO_EXTENSION);
+                                $image->thumb($width, $height, 1);
+            
+                                $image->save($this->app->getRootPath() . "public"  .  $thumbname);
+                                unset($image);
+                            }
+
+                            if ($overwrite) {
+                                $picname = $thumbname;
+                            }
+                        } catch (Exception $e) {
+                            $this->error($e->getMessage());
+                        }
+                    }
+                }
+
+                return [
+                    'code' => 0,
+                    'img_id' => $img_id,
+                    'picname' => $picname,
+                    'thumbname' => $thumbname,
+                ];
+            } else {
+                $this->error('图片地址不存在');
+            }
+        }
+    }
 
-        $thumbname = str_replace('.' . $ext, '', str_replace('\\', '/', $filename)) . $this->t_suffix . '.' . $ext;
+    public function onlineimg($page)
+    {
+        $files =  FileService::getFiles(Config::get('filesystem.disks.public.root'));
+
+        if (!count($files)) {
+            return json_encode(array(
+                "state" => "no match file",
+                "list" => array(),
+                "start" => $page,
+                "total" => count($files)
+            ));
+        }
+        /* 获取指定范围的列表 */
+        $page = $page-1 < 0 ? 0 : (int)$page - 1;
+        $size = 20;
+        $start = $page * $size;
+        $end = $start + $size;
 
-        $image = Image::open($file);
+        $len = count($files);
 
-        $result = $image->thumb($width, $height, $type)->save('./storage/' . $thumbname);
+        for ($i = min($end, $len) - 1, $list = array(); $i < $len && $i >= 0 && $i >= $start; $i--){
+            $list[] = $files[$i];
+        }
 
-        return $result ? $thumbname : '';
+        return json([ "code" => 0,
+            "list" => $list,
+            "page" => $page+1,
+            "total" => count($files)
+        ]);
     }
 
     public function index()
@@ -112,19 +277,19 @@ class FileManager extends Base
     protected function explorer()
     {
         $param = $this->request->param();
- 
-        $activepath =  isset($param['activepath'])? $param['activepath'] : '';
-        
+
+        $activepath =  isset($param['activepath']) ? $param['activepath'] : '';
+
         $inpath = "";
 
         $inpath = $this->img_path . $activepath;
 
         $dirhandle = scandir($inpath);
-       
+
         $dirs = $files = [];
 
         define('BKM', 1024);
-        
+
         foreach ($dirhandle as $val) {
             if ($val == "." || $val == "..") {
                 continue;
@@ -134,24 +299,24 @@ class FileManager extends Base
                 $arr = [];
                 $file = '';
                 $file = $inpath . DIRECTORY_SEPARATOR . $val;
-                
+
                 $arr['name'] = $val;
-                
+
                 $arr['extension'] = pathinfo($file, PATHINFO_EXTENSION);
 
                 $filesize = floatval(filesize($file));
-                if ($filesize>BKM) {
-                    $filesize =  round($filesize/BKM, 2);
+                if ($filesize > BKM) {
+                    $filesize =  round($filesize / BKM, 2);
+
+                    if ($filesize > BKM) {
+                        $filesize = round($filesize / BKM, 2);
 
-                    if ($filesize>BKM) {
-                        $filesize = round($filesize/BKM, 2);
-                    
-                        $filesize .="M";
+                        $filesize .= "M";
                     } else {
-                        $filesize .="K";
+                        $filesize .= "K";
                     }
                 } else {
-                    $filesize .="B";
+                    $filesize .= "B";
                 }
                 $arr['size'] = $filesize;
 
@@ -161,16 +326,16 @@ class FileManager extends Base
                 $files[] = $arr;
             }
         }
-        $counts = count($dirs)+count($files);
+        $counts = count($dirs) + count($files);
 
         $activeurl = preg_replace("#[\/][^\/]*$#i", "", $activepath);
-       
+
         $data = [
             'dirs'      => $dirs,
             'files'     => $files,
             'counts'    => $counts,
             'activeurl' => $activeurl,
-            'activepath'=> $activepath,
+            'activepath' => $activepath,
         ];
 
         return $data;
@@ -179,24 +344,24 @@ class FileManager extends Base
     public function delDir()
     {
         if ($this->request->isAjax()) {
-             $activepath = $this->request->param('activepath');
+            $activepath = $this->request->param('activepath');
             $activepath = str_replace('/', DIRECTORY_SEPARATOR, $activepath);
             $dir = $this->request->param('dir');
 
-            $dir_name = app()->getRootPath.'public'.DIRECTORY_SEPARATOR.$activepath.DIRECTORY_SEPARATOR.$dir;
-    
+            $dir_name = app()->getRootPath . 'public' . DIRECTORY_SEPARATOR . $activepath . DIRECTORY_SEPARATOR . $dir;
+
             if (count(scandir($dir_name)) > 2) {
-                return ['status'=>1,'msg'=>'不可删除非空目录'];
+                return ['status' => 1, 'msg' => '不可删除非空目录'];
             }
 
             if (rmdir($dir_name)) {
-                return ['status'=>2,'msg'=>'success'];
+                return ['status' => 2, 'msg' => 'success'];
             } else {
-                return ['status'=>0,'msg'=>'failed'];
+                return ['status' => 0, 'msg' => 'failed'];
             }
         }
     }
-    
+
     public function del()
     {
         if ($this->request->isAjax()) {
@@ -204,10 +369,10 @@ class FileManager extends Base
             $activepath = str_replace('/', DIRECTORY_SEPARATOR, $activepath);
             $filename = $this->request->param('filename');
 
-            if (unlink(app()->getRootPath.'public'.DIRECTORY_SEPARATOR.$activepath.DIRECTORY_SEPARATOR.$filename)) {
-                return ['status'=>1,'msg'=>'success'];
+            if (unlink(app()->getRootPath . 'public' . DIRECTORY_SEPARATOR . $activepath . DIRECTORY_SEPARATOR . $filename)) {
+                return ['status' => 1, 'msg' => 'success'];
             } else {
-                return ['status'=>0,'msg'=>'failed'];
+                return ['status' => 0, 'msg' => 'failed'];
             }
         }
     }
@@ -226,13 +391,13 @@ class FileManager extends Base
     //         if (!$info) {
     //             $this->error($info->getError());
     //         }
-   
+
     //         $filename = $info->getSaveName();
     //         unset($info);
     //         if ($isthumb == 1) {
     //             $width = $this->request->has('width', 'post') ? $this->request->post('width') : $this->t_width;
     //             $height = $this->request->has('height', 'post') ? $this->request->post('height') : $this->t_height;
-                
+
     //             $thumbname = $this->makeThumb($filename, $width, $height);
 
     //             if (!$thumbname) {
@@ -258,7 +423,7 @@ class FileManager extends Base
      */
     protected function saveUpload($file, $mode)
     {
-        $validate = ['size'=>2097152,'ext'=>'jpg,png,gif,jpeg'];
+        $validate = ['size' => 2097152, 'ext' => 'jpg,png,gif,jpeg'];
 
         if ($mode) {
             $upload = $file->validate($validate)->move(app()->getRootPath . 'public' . DIRECTORY_SEPARATOR . 'uploads', '');
@@ -304,7 +469,7 @@ class FileManager extends Base
     //             } else {
     //                 $basepath = \config('url_domain_root') . '/uploads';
     //                 // var_dump($param);
-                    
+
     //                 if ($isthumb!=1  &&  preg_match("#" . $basepath . "#i", $urlimg)) {
     //                     $this->error('图片已在服务其中, 可直接选用');
     //                 }
@@ -317,7 +482,7 @@ class FileManager extends Base
     //                         $this->error('下载失败, 请稍后重试');
     //                     }
     //                 }
-                    
+
     //                 if ($formername==1) {
     //                     // 获取原文件名
     //                     $fileinfo = pathinfo($urlimg);
@@ -328,15 +493,15 @@ class FileManager extends Base
     //                 } else {
     //                     $filename = '';
     //                 }
-                            
+
     //                 $filename = \mylib\GetImageByurl::getImageByurl($urlimg, $filename, $savePath);
-                    
+
     //                 if ($filename) {
     //                     // 生成缩略图
     //                     if ($isthumb==1) {
     //                         $width = $this->request->has('width', 'post') ? $this->request->post('width') : $this->t_width;
     //                         $height = $this->request->has('height', 'post') ? $this->request->post('height') : $this->t_height;
-                            
+
     //                         $thumbname = $this->makeThumb($today . DIRECTORY_SEPARATOR . $filename, $width, $height);
 
     //                         if (!$thumbname) {

+ 1 - 12
app/sys/controller/Index.php

@@ -1,6 +1,4 @@
 <?php
-
-
 declare (strict_types = 1);
 
 namespace app\sys\controller;
@@ -60,7 +58,7 @@ class Index  extends Base
             
             $dirsize = get_dir_size($dirname);
             
-            return ['code'=>1, 'size'=>format_bytes($dirsize)];
+            return ['code'=>0, 'size'=>format_bytes($dirsize)];
         }
     }
 
@@ -70,24 +68,15 @@ class Index  extends Base
             $runtime_path = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR;
             
             try {
-                // deldir($runtime_path);
                 $cache_dir = $runtime_path . 'cache' . DIRECTORY_SEPARATOR;
                 $admin_dir = $runtime_path . 'admin' . DIRECTORY_SEPARATOR;
                 $index_dir = $runtime_path . 'index' . DIRECTORY_SEPARATOR;
                 $api_dir = $runtime_path . 'api' . DIRECTORY_SEPARATOR;
-                $adminedata_dir = $runtime_path . 'adminedata' . DIRECTORY_SEPARATOR;
-                $edata_dir = $runtime_path . 'edata' . DIRECTORY_SEPARATOR;
-                $top_dir = $runtime_path . 'top' . DIRECTORY_SEPARATOR;
-                $common_dir = $runtime_path . 'common' . DIRECTORY_SEPARATOR;
 
                 deldir($cache_dir);
                 deldir($admin_dir);
                 deldir($index_dir);
                 deldir($api_dir);
-                deldir($adminedata_dir);
-                deldir($edata_dir);
-                deldir($top_dir);
-                deldir($common_dir);
             } catch (\Exception $e) {
                 return ['code'=>0, 'msg'=>$e->getMessage()];
             }

+ 0 - 1
app/sys/controller/Login.php

@@ -8,7 +8,6 @@ declare (strict_types = 1);
 namespace app\sys\controller;
 
 // 引入框架内置类
-
 use think\facade\Session;
 use think\facade\View;
 

+ 4 - 7
app/sys/controller/SysMenu.php

@@ -3,21 +3,18 @@ namespace app\sys\controller;
 
 // 引入框架内置类
 use think\facade\View;
-
-// 引入表格和表单构建器
-use app\common\facade\MakeBuilder;
-// use app\common\builder\FormBuilder;
-use app\common\builder\TableBuilder;
-use app\admin\model\SysMenu as SysMenuModel;
 use think\facade\Request;
 
+use app\common\model\SysMenu as SysMenuModel;
+
+
 class SysMenu extends Base
 {
     public function index()
     {
         $list = SysMenuModel::select();
 
-        View::assign('list', obj_tree($list));
+        View::assign('list', list_tree($list));
 
         View::assign('type',  ['目录', '菜单', '按钮']);
 

+ 3 - 3
app/sys/controller/SysRole.php

@@ -3,9 +3,9 @@ namespace app\sys\controller;
 
 use think\facade\View;
 
-use app\admin\model\SysMenu;
-use app\admin\model\SysUser;
-use app\admin\model\SysRole as SysRoleModel;
+use app\common\model\SysMenu;
+use app\common\model\SysUser;
+use app\common\model\SysRole as SysRoleModel;
 use think\facade\Session;
 
 class SysRole extends Base

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

@@ -8,17 +8,12 @@ declare (strict_types = 1);
 namespace app\sys\controller;
 
 // 引入框架内置类
-use think\facade\Request;
-use think\facade\Event;
-use think\facade\Session;
 use think\facade\View;
-use think\captcha\facade\Captcha;
 use think\facade\Config;
 
 use app\common\model\SysUser as SysUserModel;
 use app\common\model\SysRole as SysRoleModel;
 
-
 class SysUser extends Base
 {
     public function index()

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

@@ -10,7 +10,7 @@ namespace app\sys\controller;
 // 引入框架内置类
 use think\facade\View;
 
-use app\admin\model\System as SystemModel;
+use app\common\model\System as SystemModel;
 
 class System extends Base
 {

+ 0 - 291
app/sys/view/article/index.html

@@ -1,291 +0,0 @@
-<article class="cl pd-10" style="min-width: 900px;">
-    <div class="cl pd-5 bg-1 bk-gray mt-20">
-        <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);">
-                <i class="Hui-iconfont">&#xe600;</i> 添加文章</a>
-        </span>
-        <span class="select-box inline ml-50">
-            <select name="cid" id="sel_option" class="select">
-                <option value="0" {eq name='cid' value="0" }selected{/eq}>所有栏目</option>
-                {foreach $category_tree as $value}
-                <option value="{$value.id}" {eq name='cid' value="$value.id" }selected{/eq}>{$value.category_name}</option>
-                {notempty name="value.child"}
-                {foreach $value.child as $val}
-                <option value="{$val.id}" {eq name='cid' value="$val.id" }selected{/eq}>--{$val.category_name}</option>
-                {notempty name="val.child"}
-                {foreach $val.child as $vo}
-                <option value="{$vo.id}" {eq name='cid' value="$vo.id" }selected{/eq}>&nbsp;&nbsp;└ --{$vo.category_name}
-                </option>
-                {/foreach}
-                {/notempty}
-                {/foreach}
-                {/notempty}
-                {/foreach}
-            </select>
-        </span>
-        <span class="r">共有数据:<strong id="total">{notempty name="data"}{$data->total()}{else/}0{/notempty}</strong>
-            条</span>
-    </div>
-    <div id="edatalist">
-        <table class="table table-border table-bordered table-bg">
-            <thead>
-                <tr class="text-c">
-                    <th width="25px;">
-                        <input type="checkbox" name="" value="">
-                    </th>
-                    <th width="80px;">ID</th>
-                    <th style="min-width: 260px;">标题</th>
-                    <th width="240px;">栏目</th>
-                    <th width="160px;">发布者</th>
-                    <th width="180px;">发布时间</th>
-                    <th width="140px;">点击量</th>
-                    <th width="80px;">排序</th>
-                    <th width="200px;">操作</th>
-                </tr>
-            </thead>
-            <tbody>
-                {foreach $data as $val}
-                <tr class="text-c va-m">
-                    <td>
-                        <input type="checkbox" value="{$val.id}" name="checkbox[]">
-                    </td>
-                    <td>{$val.id}</td>
-                    <td class="text-l">
-                        <a href="/index/article/detail/id/{$val.id}" style="text-decoration:none" title="浏览"
-                            target="_blank">{$val.title}</a>
-                    </td>
-                    <td>{:isset($categories_name[$val['cid']]) ? $categories_name[$val['cid']] : ""}</td>
-                    <td>{$val.username}</td>
-                    <td>{$val.create_time}</td>
-                    <td>{$val.hits}</td>
-                    <td><input type="text" class="input-text input-sort" value="{$val.sort}" data-id="{$val.id}" style="text-align: center;"></td>
-                    <td class="td-manage">
-                        <a href="{:url('save?cid='.$val['cid'].'&id='.$val['id'])}" title="编辑"
-                            style="text-decoration:none" class="ml-10">
-                            <i class="Hui-iconfont">&#xe6df;</i>
-                        </a>
-                        <a href="javascript:;" title="删除" style="text-decoration:none" class="ml-10"
-                            onClick="del(this,'{$val.id}')">
-                            <i class="Hui-iconfont">&#xe6e2;</i>
-                        </a>
-                    </td>
-                </tr>
-                {/foreach}
-            </tbody>
-        </table>
-    </div>
-    <div class="cl pd-5 bg-1 bk-gray mt-20 ">
-        <span class="r">{notempty name="data"}{$data->render()}{/notempty}</span>
-    </div>
-</article>
-<script>
-    $("#sel_option").change(function () {
-        var cid = $("#sel_option").val();
-        console.log(cid);
-        if (cid) {
-            window.location.href = '/admin/article/index?cid=' + cid;
-        } else {
-            window.location.href = '/admin/article/index';
-        }
-        return false;
-    })
-
-    function save(id) {
-        var cid = $("#sel_option").val();
-        // console.log(cid);
-        // return false;
-        if (!cid || cid == 0) {
-            layer.msg("请选择栏目", {
-                icon: 5,
-                time: 2000
-            });
-            return false;
-        }
-        window.location.href = '/admin/article/save?id='+id+'&cid='+cid;
-        return false;
-    }
-
-    // 排序
-    $(".input-sort").change(function () {
-        var sort = $(this).val();
-        var id = $(this).data('id');
-        // console.log(sort);
-        // console.log(id);
-        $.post('sort', {
-                'id': id,
-                'sort': sort
-            }, function (res) {
-                console.log(res);
-                if (res) {
-                    layer.msg('排序成功', {
-                        icon: 1,
-                        time: 2000
-                    });
-                } else {
-                    layer.msg('排序失败', {
-                        icon: 5,
-                        time: 2000
-                    });
-                }
-            }, 'json');
-    })
-
-    //列表删除条目
-    function del(obj, id) {
-        layer.confirm('确认要删除吗?', function (index) {
-            $.post('delete', {
-                'id': id
-            }, function (data) {
-                if (data.code == 2) {
-                    $(obj).parents("tr").remove();
-                    layer.msg(data.msg, {
-                        icon: 1,
-                        time: 1000
-                    });
-                } else {
-                    layer.msg(data.msg, {
-                        icon: 5,
-                        time: 2000
-                    });
-                    return false;
-                }
-            }, 'json');
-        });
-    }
-
-    //列表多选删除条目
-    function del_all() {
-        if (isNull(controller)) {
-            url = 'del';
-        } else {
-            url = '/admin/' + controller + '/del';
-        }
-        var checkbox = $('.text-c input[name="checkbox[]"]');
-        var ids = new Array();
-        checkbox.each(function (x) {
-            if (this.checked)
-                ids.push(this.value);
-        })
-
-        var length = ids.length;
-
-        if (length == 0) {
-            layer.msg('请选择要删除的选项', {
-                icon: 5,
-                time: 1000
-            });
-            return false;
-        }
-
-        layer.confirm('确认要删除选中项吗?', function (index) {
-            $.post('delete', {
-                'id': ids
-            }, function (data) {
-                if (data.code == 2) {
-                    checkbox.each(function (x) {
-                        if (this.checked)
-                            $(this).parents("tr").remove();
-                    })
-                    layer.msg(data.msg, {
-                        icon: 1,
-                        time: 1000
-                    });
-                } else {
-                    layer.msg(data.msg, {
-                        icon: 5,
-                        time: 2000
-                    });
-                    return false;
-                }
-            }, 'json');
-        });
-    }
-
-    /* 置顶 or 首页 */
-    function top_home(action, obj, column, id) {
-        var col = '首页';
-        var style = 'style="margin-left: 10%"';
-        if (column == 'top') {
-            col = '置顶';
-            style = '';
-        }
-
-        var value = 2;
-        var cancel = '';
-        var color = 'default';
-        if (action == 'up') {
-            value = 1;
-            action = 'down';
-            cancel = '取消';
-            color = 'success';
-        } else {
-            action = 'up';
-        }
-
-        var text = "<a href=\"javascript:void(0);\" title='" + cancel + col + "' onClick=\"top_home('" + action + "',this,'" + column + "'," + id + ")\" style=\"text-decoration:none\">";
-        text += '<span class="label label-' + color + ' radius" ' + style + '>' + col + '</span></a>';
-
-        $.post('top', {
-            'id': id,
-            'column': column,
-            'value': value
-        }, function (data) {
-            if (data.code == 2) {
-                $(obj).after(text);
-                $(obj).remove();
-                layer.msg(data.msg, {
-                    icon: 6,
-                    time: 1000
-                });
-            } else {
-                layer.msg(data.msg, {
-                    icon: 5,
-                    time: 1000
-                });
-            }
-        }, 'json');
-    }
-
-    // 产品上加/下架 or 文章上线.下线
-    function duty(action, obj, id) {
-        var duty = 2,
-            title = '上线',
-            button = 'default',
-            status = '下线';
-
-        if (action == 'up') {
-            duty = 1;
-            title = '下线';
-            status = '正常';
-            button = 'success';
-            action = 'down';
-        } else {
-            action = 'up';
-        }
-
-
-        var text = "<a href=\"javascript:void(0);\" title=" + title + " onClick=\"duty('" + action + "', this," + id + ")\" >";
-        text += '<span class="label label-' + button + ' radius">' + status + '</span></a>';
-
-        $.post("duty", {
-            'id': id,
-            'status': duty
-        }, function (data) {
-            if (data.code == 2) {
-                $(obj).after(text);
-                $(obj).remove();
-                layer.msg(data.msg, {
-                    icon: 6,
-                    time: 1000
-                });
-            } else {
-                layer.msg(data.msg, {
-                    icon: 5,
-                    time: 1000
-                });
-            }
-        }, 'json');
-    }
-</script>

+ 0 - 142
app/sys/view/category/index.html

@@ -1,142 +0,0 @@
-<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);">
-                <i class="Hui-iconfont">&#xe600;</i> 添加栏目</a>
-        </span>
-    </div>
-    <div class="mt-10" style="min-width:920px;">
-        <table class="table table-border table-bordered table-hover table-bg">
-            <thead>
-                <tr class="text-c">
-                    <th width="60px">ID</th>
-                    <th>栏目名称</th>
-                    <th>英文名称</th>
-                    <th>栏目目录</th>
-                    <th>表名</th>
-                    <th>模型名</th>
-                    <th>列表模板</th>
-                    <th>详情模板</th>
-                    <th>导航状态</th>
-                    <th style="width: 60px;">排序</th>
-                    <th>添加时间</th>
-                    <th>更新时间</th>
-                    <th>操作</th>
-                </tr>
-            </thead>
-            <tbody>
-                {foreach $list as $value}
-                <tr class="text-c">
-                    <td>{$value.id}</td>
-                    <td class="text-l">{$value.category_name}</td>
-                    <td>{$value.en_name}</td>
-                    <td>{$value.category_folder}</td>
-                    <td>{$value.table_name}</td>
-                    <td>{$value.module_name}</td>
-                    <td>{$value.template_list}</td>
-                    <td>{$value.template_show}</td>
-                    <td>{$value.is_menu}</td>
-                    <td><input type="text" class="input-text input-sort" value="{$value.sort}" data-id="{$value.id}"
-                            style="text-align: center;"></td>
-                    <td>{$value.create_time|date="Y-m-d"}</td>
-                    <td>{$value.update_time|date="Y-m-d"}</td>
-                    <td class="td-manage">
-                        <a class="btn btn-primary radius" title="编辑" href="javascript:save({$value.id});"
-                            style="text-decoration:none">
-                            <i class="Hui-iconfont">&#xe6df;</i>编辑
-                        </a>
-                        <a class="btn btn-danger radius" title="删除" href="javascript:;"
-                            onclick="del(this,'{$value.id}')" class="ml-5" style="text-decoration:none">
-                            <i class="Hui-iconfont">&#xe6e2;</i>删除
-                        </a>
-                    </td>
-                </tr>
-                {notempty name="value.child"} {foreach $value.child as $val}
-                <tr class="text-c">
-                    <td>{$val.id}</td>
-                    <td>{$val.category_name}</td>
-                    <td>{$val.en_name}</td>
-                    <td>{$val.category_folder}</td>
-                    <td>{$val.table_name}</td>
-                    <td>{$val.module_name}</td>
-                    <td>{$val.template_list}</td>
-                    <td>{$val.template_show}</td>
-                    <td>{$val.is_menu}</td>
-                    <td><input type="text" class="input-text input-sort" value="{$val.sort}" data-id="{$val.id}"
-                            style="text-align: center;"></td>
-                    <td>{$val.create_time|date="Y-m-d"}</td>
-                    <td>{$val.update_time|date="Y-m-d"}</td>
-                    <td class="td-manage">
-                        <a class="btn btn-primary radius" title="编辑" href="javascript:save({$val.id});"
-                            style="text-decoration:none">
-                            <i class="Hui-iconfont">&#xe6df;</i>编辑
-                        </a>
-                        <a class="btn btn-danger radius" title="删除" href="javascript:;" onclick="del(this,'{$val.id}')"
-                            class="ml-5" style="text-decoration:none">
-                            <i class="Hui-iconfont">&#xe6e2;</i>删除
-                        </a>
-                    </td>
-                </tr>
-                {notempty name="val.child"} {foreach $val.child as $vo}
-                <tr class="text-c">
-                    <td>{$vo.id}</td>
-                    <td>{$vo.category_name}</td>
-                    <td>{$vo.en_name}</td>
-                    <td>{$vo.category_folder}</td>
-                    <td>{$vo.table_name}</td>
-                    <td>{$vo.module_name}</td>
-                    <td>{$vo.template_list}</td>
-                    <td>{$vo.template_show}</td>
-                    <td>{$vo.is_menu}</td>
-                    <td><input type="text" class="input-text input-sort" value="{$vo.sort}" data-id="{$vo.id}"
-                            style="text-align: center;"></td>
-                    <td>{$vo.create_time|date="Y-m-d"}</td>
-                    <td>{$vo.update_time|date="Y-m-d"}</td>
-                    <td class="td-manage">
-                        <a class="btn btn-primary radius" title="编辑" href="javascript:save({$vo.id});"
-                            style="text-decoration:none">
-                            <i class="Hui-iconfont">&#xe6df;</i>编辑
-                        </a>
-                        <a class="btn btn-danger radius" title="删除" href="javascript:;" onclick="del(this,'{$vo.id}')"
-                            class="ml-5" style="text-decoration:none">
-                            <i class="Hui-iconfont">&#xe6e2;</i>删除
-                        </a>
-                    </td>
-                </tr>
-                {/foreach} {/notempty}{/foreach} {/notempty} {/foreach}
-            </tbody>
-        </table>
-    </div>
-</article>
-
-<!--请在下方写此页面业务相关的脚本-->
-<script type="text/javascript">
-    function save(id) {
-        var title = id == 0 ? '添加栏目' : '修改栏目'
-        var url = "{:url('save')}" + "?_layer=true&id=" + id
-        layer_show(title, url, 800, 600);
-    }
-
-    // 排序
-    $(".input-sort").change(function () {
-        var sort = $(this).val();
-        var id = $(this).data('id');
-
-        console.log(id);
-        console.log(sort);
-        $.post('sort', {
-            'id': id,
-            'sort': sort
-        }, function (data) {
-            if (data.code == 1) {
-                topalert({ type: 0, content: data.msg, speed: 2000 });
-            } else {
-                topalert({ type: 1, content: data.msg, speed: 2000 });
-                return false;
-            }
-        }, 'json');
-    });
-</script>
-<!--请在上方写此页面业务相关的脚本-->

+ 0 - 88
app/sys/view/file_manager/uploadimg.html

@@ -1,88 +0,0 @@
- <!-- <div class="cl pd-5 bg-1 bk-gray">
-        <a href="{:url('/file_manager/selectpicture')}" class="btn btn-default radius sethumb">
-            <i class="Hui-iconfont">&#xe600;</i> 站内选择 </a>&nbsp;&nbsp;
-        <a href="javascript:void(0);" class="btn btn-primary radius sethumb">
-            <i class="Hui-iconfont">&#xe600;</i> 本地上传 </a>&nbsp;&nbsp;
-        <a href="{:url('/file_manager/onlinepicture')}" class="btn btn-default radius sethumb">
-            <i class="Hui-iconfont">&#xe600;</i> 网络图片 </a>&nbsp;&nbsp;
-    </div> -->
-    <!-- 本地上传 -->
-    <div class="step1 active" style="margin-left:30px;">
-        <form id="submit_form" method="post" action="" enctype="multipart/form-data">
-            <input type="hidden" name="thumb" value={$thumb}>
-            <input type="hidden" name="width" value={$width}>
-            <input type="hidden" name="height" value={$height}>
-            <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. 大小不超过2M.
-                </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-4 col-sm-4">
-                    <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: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="uploadImg()">
-                    <input class="btn btn-default radius" type="button" value="&nbsp;取&nbsp;消&nbsp;" onClick="layer_close();">
-                </div>
-            </div>
-        </form>
-    </div>
-    <!-- 本地上传end -->
-    
-<!--请在下方写此页面业务相关的脚本-->
-<script type="text/javascript">
-
-    //step1本地上传图片
-    function uploadImg() {
-        if ($("#upload_file").val() == '') {
-            layer.msg("请选择要上传的文件", {
-                icon: 6,
-                time: 1000
-            });
-            return false;
-        } else {
-            var formData = new FormData($("#submit_form")[0]);
-            $.ajax({
-                url: '{:url("file_manager/uploadimg")}',
-                type: 'POST',
-                async: true,
-                cache: false,
-                data: formData,
-                processData: false,
-                contentType: false,
-                dataType: "json",
-                beforeSend: function () {
-                    uploading = true;
-                },
-                success: function (data) {
-                    if (data.code == 2) {
-                        window.parent.$("#picture").val(data.picname);
-                        var img=data.picname;
-                        if (data.thumbname) {
-                            img = data.thumbname;
-                            window.parent.$("#thumb").val(data.thumbname);
-                        }
-                        window.parent.$("#view-img").attr('src',img);
-                        layer_close();
-                    } else {
-                        layer.msg(data.msg, {
-                            icon: 5,
-                            time: 1000
-                        });
-                        return false;
-                    }
-                    uploading = false;
-                }
-            });
-        }
-    }
-</script>
-<!--请在上方写此页面业务相关的脚本-->

+ 2 - 1
composer.json

@@ -24,7 +24,8 @@
         "topthink/framework": "^6.0.0",
         "topthink/think-orm": "^2.0",
         "topthink/think-multi-app": "^1.0",
-        "liliuwei/thinkphp-jump": "^1.5"
+        "liliuwei/thinkphp-jump": "^1.5",
+        "topthink/think-image": "^1.0"
     },
     "require-dev": {
         "symfony/var-dumper": "^4.2",

+ 5 - 2
config/app.php

@@ -18,9 +18,12 @@ return [
     // 应用映射(自动多应用模式有效)
     'app_map'          => [],
     // 域名绑定(自动多应用模式有效)
-    'domain_bind'      => [],
+    'domain_bind'      => [
+        'admin' => 'sys',
+        '*'     => 'index'
+    ],
     // 禁止URL访问的应用列表(自动多应用模式有效)
-    'deny_app_list'    => [],
+    'deny_app_list'    => ['common'],
 
     // 异常页面的模板文件
     'exception_tmpl'   => app()->getThinkPath() . 'tpl/think_exception.tpl',

+ 0 - 17
route/app.php

@@ -1,17 +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::get('think', function () {
-    return 'hello,ThinkPHP6!';
-});
-
-Route::get('hello/:name', 'index/hello');

+ 0 - 0
app/sys/view/advertise/index.html → view/sys/advertise/index.html


+ 0 - 0
app/sys/view/advertise/save.html → view/sys/advertise/save.html


+ 0 - 0
app/sys/view/advertise_type/index.html → view/sys/advertise_type/index.html


+ 0 - 0
app/sys/view/advertise_type/save.html → view/sys/advertise_type/save.html


+ 116 - 0
view/sys/article/index.html

@@ -0,0 +1,116 @@
+<article class="cl pd-10" style="min-width: 900px;">
+    <div class="cl pd-5 bg-1 bk-gray mt-20">
+        <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);">
+                <i class="Hui-iconfont">&#xe600;</i> 添加文章</a>
+        </span>
+        <span class="select-box inline ml-50">
+            <select name="cid" id="sel_option" class="select">
+                <option value="0" {eq name='cid' value="0" }selected{/eq}>所有栏目</option>
+                {foreach $category_tree as $value}
+                <option value="{$value.id}" {eq name='cid' value="$value.id" }selected{/eq}>{$value.name}</option>
+                {notempty name="value.child"}
+                {foreach $value.child as $val}
+                <option value="{$val.id}" {eq name='cid' value="$val.id" }selected{/eq}>--{$val.name}</option>
+                {notempty name="val.child"}
+                {foreach $val.child as $vo}
+                <option value="{$vo.id}" {eq name='cid' value="$vo.id" }selected{/eq}>&nbsp;&nbsp;└ --{$vo.name}
+                </option>
+                {/foreach}
+                {/notempty}
+                {/foreach}
+                {/notempty}
+                {/foreach}
+            </select>
+        </span>
+        <span class="r">共有数据:<strong id="total">{$list->total()}</strong>
+            条</span>
+    </div>
+    <div id="edatalist">
+        <table class="table table-border table-bordered table-bg">
+            <thead>
+                <tr class="text-c">
+                    <th width="25px;">
+                        <input type="checkbox" name="" value="">
+                    </th>
+                    <th width="80px;">ID</th>
+                    <th style="min-width: 260px;">标题</th>
+                    <th width="240px;">栏目</th>
+                    <th width="160px;">发布者</th>
+                    <th width="180px;">发布时间</th>
+                    <th width="140px;">点击量</th>
+                    <th width="80px;">排序</th>
+                    <th width="80px;">状态</th>
+                    <th>操作</th>
+                </tr>
+            </thead>
+            <tbody>
+                {foreach $list as $val}
+                <tr class="text-c va-m">
+                    <td>
+                        <input type="checkbox" value="{$val.id}" name="checkbox[]">
+                    </td>
+                    <td>{$val.id}</td>
+                    <td class="text-l">
+                        <a href="/index/article/detail/id/{$val.id}" style="text-decoration:none" title="浏览"
+                            target="_blank">{$val.title}</a>
+                    </td>
+                    <td>{$val.category_name}</td>
+                    <td>{$val.username}</td>
+                    <td>{$val.update_time}</td>
+                    <td>{$val.hits}</td>
+                    <td><input type="text" class="input-text input-sort" value="{$val.sorts}" data-id="{$val.id}" style="text-align: center;"></td>
+                    <td class="td-status">
+                        {if $val.status == 1}
+                        <a href="javascript:;" onclick="status(this,'{$val.id}')" title="正常"><span
+                                class="f-20 c-primary"><i class="Hui-iconfont">&#xe601;</i></span></a>
+                        {else/}
+                        <a href="javascript:;" onclick="status(this,'{$val.id}')" title="停用"><span
+                                class="f-20 c-primary"><i class="Hui-iconfont">&#xe677;</i></span></a>
+                        {/if}
+                    </td>
+                    
+                    <td class="td-manage">
+                        <a href="{:url('save?cid='.$val['cid'].'&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" onClick="del(this,'{$val.id}')">
+                            <i class="Hui-iconfont">&#xe6e2;</i></a>
+                    </td>
+                </tr>
+                {/foreach}
+            </tbody>
+        </table>
+    </div>
+    <div class="cl pd-5 bg-1 bk-gray mt-20 ">
+        <span class="r">{notempty name="data"}{$data->render()}{/notempty}</span>
+    </div>
+</article>
+<script>
+    $("#sel_option").change(function () {
+        var cid = $("#sel_option").val();
+        console.log(cid);
+        if (cid) {
+            window.location.href = '/sys/article/index?cid=' + cid;
+        } else {
+            window.location.href = '/sys/article/index';
+        }
+        return false;
+    })
+
+    function save(id) {
+        var cid = $("#sel_option").val();
+        // console.log(cid);
+        // return false;
+        if (!cid || cid == 0) {
+            layer.msg("请选择栏目", {
+                icon: 5,
+                time: 2000
+            });
+            return false;
+        }
+        window.location.href = '/sys/article/save?id='+id+'&cid='+cid;
+        return false;
+    }
+</script>

+ 14 - 14
app/sys/view/article/save.html → view/sys/article/save.html

@@ -16,9 +16,9 @@
                 <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>
+                来源:</label>
             <div class="formControls col-xs-4 col-sm-2">
-                <input type="text" class="input-text" value="{$data.source}" placeholder="信息来源" id="source"
+                <input type="text" class="input-text" value="{$data.source}" placeholder="来源" id="source"
                     name="source">
             </div>
             <div class="col-3"> </div>
@@ -30,21 +30,18 @@
             <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-img"
+                        <img id="view-titlepic"
                             src="{$data.titlepic ? $data.titlepic : '/static/images/upload_picture.png'}"
-                            alt="标题图" title="{$data.title_pic ? '更换' : '添加'}标题图"
+                            alt="标题图" title="{$data.titlepic ? '更换' : '添加'}标题图"
                             style="max-width: 200px;max-height: 200px;">
                     </a>
                 </div>
-                <input type="text" class="input-text" value="{$data.titlepic}" name="titlepic" id="thumb"
-                    style="display: none;">
-                <!-- <input type="text" class="input-text" value="{//$value}" name="images[]" id="picture"
-                    style="display: none;"> -->
             </div>
             <label class="form-label col-xs-2 col-sm-2">
-                <a class="btn btn-success radius" href="javascript:addTitlePic();">{$data.title_pic ? '更换' :
+                <a class="btn btn-success radius" href="javascript:addTitlePic();">{$data.titlepic ? '更换' :
                     '添加'}标题图</a></label>
             <div class="col-3"> </div>
         </div>
@@ -84,13 +81,13 @@
             <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.clicks}" id="clicks" name="clicks"
+                <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.clicks}" id="clicks" name="clicks"
+                <input type="number" class="input-text" value="{$data.sorts}" id="sorts" name="sorts"
                     style="width: 120px;">
             </div>
         </div>
@@ -111,7 +108,10 @@
 <script type="text/javascript">
     $(function () {
         //实例化编辑器   
-        var ue = UE.getEditor('editor');
+        var ue = UE.getEditor('editor', {
+            autoHeightEnabled: false,
+            textarea: "content",
+        });
     })
     $("#form-admin-article").submit(function () {
         if (isNull($("#title").val())) {
@@ -140,8 +140,8 @@
             fix: false, //不固定
             maxmin: true,
             shade: 0.4,
-            title: '添加缩略图',
-            content: '{:url("file_manager/uploadimg", ["thumb"=>1,"_layer"=>true])}'
+            title: '添加标题图',
+            content: '{:url("file_manager/uploadimg", ["_layer"=>true,"img_id"=>"titlepic"])}'
         });
     }
 </script>

+ 122 - 0
view/sys/category/index.html

@@ -0,0 +1,122 @@
+<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);">
+                <i class="Hui-iconfont">&#xe600;</i> 添加栏目</a>
+        </span>
+    </div>
+    <div class="mt-10" style="min-width:920px;">
+        <table class="table table-border table-bordered table-hover table-bg">
+            <thead>
+                <tr class="text-c">
+                    <th width="60px">ID</th>
+                    <th>栏目名称</th>
+                    <th>url</th>
+                    <th>模型名</th>
+                    <th>列表模板</th>
+                    <th>导航状态</th>
+                    <th style="width: 80px;">排序</th>
+                    <th>类型</th>
+                    <th>添加时间</th>
+                    <th>更新时间</th>
+                    <th>操作</th>
+                </tr>
+            </thead>
+            <tbody>
+                {foreach $list as $value}
+                <tr class="text-c">
+                    <td>{$value.id}</td>
+                    <td>{$value.name}</td>
+                    <td>{$value.url}</td>
+                    <td>{$value.tablename}</td>
+                    <td>{$value.template}</td>
+                    <td>{$value.is_nav}</td>
+                    <td><input type="text" class="input-text input-sort" value="{$value.sort}" data-id="{$value.id}"
+                        style="text-align: center;"></td>
+                    <td>{$types[$value['type']]}</td>
+                    <td>{$value.create_time}</td>
+                    <td>{$value.update_time}</td>
+                    <td class="td-manage">
+                        <a  title="编辑" href="javascript:save({$value.id});" class="btn btn-primary radius">
+                            <i class="Hui-iconfont">&#xe6df;</i></a>
+                        <a title="删除" href="javascript:;" onclick="del(this,'{$value.id}')" class="ml-5 btn btn-danger radius">
+                            <i class="Hui-iconfont">&#xe6e2;</i></a>
+                    </td>
+                </tr>
+                {notempty name="value.child"} {foreach $value.child as $val}
+                <tr class="text-c">
+                    <td>{$val.id}</td>
+                    <td>{$val.name}</td>
+                    <td>{$val.url}</td>
+                    <td>{$val.tablename}</td>
+                    <td>{$val.template}</td>
+                    <td>{$val.is_nav}</td>
+                    <td><input type="text" class="input-text input-sort" value="{$val.sort}" data-id="{$val.id}"
+                        style="text-align: center;"></td>
+                    <td>{$types[$val['type']]}</td>
+                    <td>{$val.create_time}</td>
+                    <td>{$val.update_time}</td>
+                    <td class="td-manage">
+                        <a  title="编辑" href="javascript:save({$val.id});" class="btn btn-primary radius">
+                            <i class="Hui-iconfont">&#xe6df;</i></a>
+                        <a title="删除" href="javascript:;" onclick="del(this,'{$val.id}')" class="ml-5 btn btn-danger radius">
+                            <i class="Hui-iconfont">&#xe6e2;</i></a>
+                    </td>
+                </tr>
+                {notempty name="val.child"} {foreach $val.child as $vo}
+                <tr class="text-c">
+                    <td>{$vo.id}</td>
+                    <td>{$vo.name}</td>
+                    <td>{$vo.url}</td>
+                    <td>{$vo.tablename}</td>
+                    <td>{$vo.template}</td>
+                    <td>{$vo.is_nav}</td>
+                    <td><input type="text" class="input-text input-sort" value="{$vo.sort}" data-id="{$val.id}"
+                        style="text-align: center;"></td>
+                    <td>{$types[$vo['type']]}</td>
+                    <td>{$vo.create_time}</td>
+                    <td>{$vo.update_time}</td>
+                    <td class="td-manage">
+                        <a  title="编辑" href="javascript:save({$vo.id});" class="btn btn-primary radius">
+                            <i class="Hui-iconfont">&#xe6df;</i></a>
+                        <a title="删除" href="javascript:;" onclick="del(this,'{$vo.id}')" class="ml-5 btn btn-danger radius">
+                            <i class="Hui-iconfont">&#xe6e2;</i></a>
+                    </td>
+                </tr>
+                {/foreach} {/notempty}{/foreach} {/notempty} {/foreach}
+            </tbody>
+        </table>
+    </div>
+</article>
+
+<!--请在下方写此页面业务相关的脚本-->
+<script type="text/javascript">
+    function save(id) {
+        var title = id == 0 ? '添加栏目' : '修改栏目'
+        var url = "{:url('save')}" + "?_layer=true&id=" + id
+        layer_show(title, url, 800, 600);
+    }
+
+    // 排序
+    $(".input-sort").change(function () {
+        var sort = $(this).val();
+        var id = $(this).data('id');
+
+        console.log(id);
+        console.log(sort);
+        $.post('sort', {
+            'id': id,
+            'sort': sort
+        }, function (data) {
+            if (data.code == 1) {
+                topalert({ type: 0, content: data.msg, speed: 2000 });
+            } else {
+                topalert({ type: 1, content: data.msg, speed: 2000 });
+                return false;
+            }
+        }, 'json');
+    });
+</script>
+<!--请在上方写此页面业务相关的脚本-->

+ 27 - 64
app/sys/view/category/save.html → view/sys/category/save.html

@@ -6,14 +6,14 @@
                 <span class="c-red">*</span>上级栏目:</label>
             <div class="formControls col-xs-4 col-sm-6">
                 <span class="select-box">
-                    <select class="select" id="sel_Sub" name="pid">
+                    <select class="select" name="parent_id">
                         <option value="0" {eq name='data.pid' value="0" }selected{/eq}>--顶级栏目--</option>
                         {foreach $list as $value}
                         <option value="{$value.id}" {eq name='value.id' value="$data.pid" }selected{/eq}>
-                            {$value.category_name}</option>
+                            {$value.name}</option>
                         {notempty name="value.child"} {foreach $value.child as $val}
                         <option value="{$val.id}" {eq name='val.id' value="$data.pid" }selected{/eq}>&nbsp;&nbsp;└
-                            --{$val.category_name}</option>
+                            --{$val.name}</option>
                         {/foreach} {/notempty} {/foreach}
                     </select>
                 </span>
@@ -24,8 +24,7 @@
             <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">
-                <input type="text" class="input-text" value="{$data.category_name}" placeholder="请填写栏目名称"
-                    id="category_name" name="category_name">
+                <input type="text" class="input-text" value="{$data.name}" placeholder="请填写栏目名称" id="name" name="name">
             </div>
             <div class="col-3"> </div>
         </div>
@@ -39,10 +38,17 @@
         </div>
         <div class="row cl">
             <label class="form-label col-xs-4 col-sm-2">
-                栏目目录:</label>
+                类型:</label>
             <div class="formControls col-xs-4 col-sm-6">
-                <input type="text" class="input-text" value="{$data.directory}" placeholder="栏目静态文件目录" id="directory"
-                    name="directory">
+                <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>
+                    </select>
+                </span>
             </div>
             <div class="col-3"> </div>
         </div>
@@ -59,17 +65,8 @@
             <label class="form-label col-xs-4 col-sm-2">
                 列表模板:</label>
             <div class="formControls col-xs-4 col-sm-6">
-                <input type="text" class="input-text" value="{$data.template_list}" placeholder="请填写列表模板"
-                    id="template_list" name="template_list">
-            </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-6">
-                <input type="text" class="input-text" value="{$data.template_detail}" placeholder="请填写详情模板"
-                    id="template_detail" name="template_detail">
+                <input type="text" class="input-text" value="{$data.template}" placeholder="请填写列表模板" id="template"
+                    name="template">
             </div>
             <div class="col-3"> </div>
         </div>
@@ -94,8 +91,7 @@
             <label class="form-label col-xs-4 col-sm-2">描述:</label>
             <div class="formControls col-xs-8 col-sm-6">
                 <textarea name="description" id="description" cols="" rows="" class="textarea"
-                    placeholder="SEO描述...最多输入500个字符" dragonfly="true" nullmsg="备注不能为空!"
-                    onKeyUp="textarealength(this,500)">{$data.note}</textarea>
+                    placeholder="SEO描述...最多输入500个字符" onKeyUp="textarealength(this,500)">{$data.note}</textarea>
                 <p class="textarea-numberbar">
                     <em class="textarea-length">0</em>/500
                 </p>
@@ -103,37 +99,22 @@
             <div class="col-3"> </div>
         </div>
         <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-2">简介:</label>
+            <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="SEO描述...最多输入255个字符"
-                    dragonfly="true" nullmsg="备注不能为空!" onKeyUp="textarealength(this,3000)">{$data.summary}</textarea>
+                <textarea name="remark" id="remark" cols="" rows="" class="textarea" placeholder="备注...最多输入500个字符"
+                    onKeyUp="textarealength(this,3000)">{$data.remark}</textarea>
                 <p class="textarea-numberbar">
-                    <em class="textarea-length">0</em>/3000
+                    <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">
-                <span class="c-red"></span>状态:</label>
-            <div class="formControls col-xs-4 col-sm-6">
-                <div class="radio-box">
-                    <input type="radio" name="status" id="status-1" value="1" {$data==null || $data.status==1
-                        ? 'checked' : "" }>
-                    <label for="status-1">启用</label>
-                </div>
-                <div class="radio-box">
-                    <input type="radio" name="status" id="status-2" value="2" {$data.status==2 ? 'checked' : "" }>
-                    <label for="status-2">禁用</label>
-                </div>
-            </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-6">
                 <input type="number" min=0 max=100 class="input-text" value="{$data.sort}" name="sort"
                     style="width:120px;">
-                    <span class="c-red">数字越大, 越靠前</span>
+                <span class="c-red">数字越大, 越靠前</span>
             </div>
         </div>
         <div class="row cl">
@@ -141,12 +122,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_menu" id="is_menu-1" value="1" {$data==null || $data.is_menu==1
-                        ? 'checked' : "" }>
+                    <input type="radio" name="is_nav" id="is_menu-1" value="1" {$data.is_nav==1 ? 'checked' : "" }>
                     <label for="is_menu-1">是</label>
                 </div>
                 <div class="radio-box">
-                    <input type="radio" name="is_menu" id="is_menu-2" value="2" {$data.is_menu==2 ? 'checked' : "" }>
+                    <input type="radio" name="is_nav" id="is_menu-2" value="0" {$data.is_nav==0 ? 'checked' : "" }>
                     <label for="is_menu-2">否</label>
                 </div>
             </div>
@@ -156,12 +136,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==null || $data.is_blank==1
-                        ? 'checked' : "" }>
+                    <input type="radio" name="is_blank" id="is_blank-1" value="1" {$data.is_blank==1 ? 'checked' : "" }>
                     <label for="is_blank-1">是</label>
                 </div>
                 <div class="radio-box">
-                    <input type="radio" name="is_blank" id="is_blank-2" value="2" {$data.is_blank==2 ? 'checked' : "" }>
+                    <input type="radio" name="is_blank" id="is_blank-2" value="0" {$data.is_blank==0 ? 'checked' : "" }>
                     <label for="is_blank-2">否</label>
                 </div>
             </div>
@@ -180,26 +159,10 @@
 <script type="text/javascript">
     $(function () {
         $("#form-save-button").click(function () {
-            if (getblen($("#description").val()) > 500) {
-                layer.msg('描述过长', {
-                    icon: 5,
-                    time: 1000
-                });
-                return false;
-            }
-
-            if (getblen($("#summary").val()) > 3000) {
-                layer.msg('简介过长', {
-                    icon: 5,
-                    time: 1000
-                });
-                return false;
-            }
-
             var data = $("#form-save").serializeArray();
             $.ajax({
                 type: 'POST',
-                url: '{:url("save")}',
+                url: '{:url("doSave")}',
                 data: data,
                 dataType: 'json',
                 success: function (res) {

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

@@ -0,0 +1,452 @@
+<!-- <div class="cl pd-5 bg-1 bk-gray">
+        <a href="{:url('/file_manager/selectpicture')}" class="btn btn-default radius sethumb">
+            <i class="Hui-iconfont">&#xe600;</i> 站内选择 </a>&nbsp;&nbsp;
+        <a href="javascript:void(0);" class="btn btn-primary radius sethumb">
+            <i class="Hui-iconfont">&#xe600;</i> 本地上传 </a>&nbsp;&nbsp;
+        <a href="{:url('/file_manager/onlinepicture')}" class="btn btn-default radius sethumb">
+            <i class="Hui-iconfont">&#xe600;</i> 网络图片 </a>&nbsp;&nbsp;
+    </div> -->
+<!-- 本地上传 -->
+<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: none;
+        clear: both;
+        display: block;
+        width: 0;
+        height: 0;
+        margin: 0;
+        padding: 0;
+    }
+</style>
+
+<div id="tab-img" class="HuiTab">
+    <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" 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-4 col-sm-4">
+                        <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}>
+                    <div class="formControls col-xs-12 col-sm-8">
+                        <div class="skin-minimal">
+                            <div class="check-box">
+                                <input type="checkbox" name="overwrite" value="{$overwrite}" {$overwrite ? 'checked'
+                                    : "" }>
+                                <label for="overwrite">覆盖原图</label>
+                            </div>
+                            <div class="check-box">
+                                <input type="checkbox" name="water" value="{$water}" {$water ? 'checked' : "" }>
+                                <label for="water">水印</label>
+                            </div>
+                            <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;">缩略图高度
+                            </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="uploadImg()">
+                        <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-4 col-sm-4">
+                    <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-8">
+                    <div class="skin-minimal">
+                        <div class="check-box">
+                            <input type="checkbox" name="overwrite" value="{$overwrite}" {$overwrite ? 'checked' : "" }>
+                            <label for="overwrite">覆盖原图</label>
+                        </div>
+                        <div class="check-box">
+                            <input type="checkbox" name="water" value="{$water}" {$water ? 'checked' : "" }>
+                            <label for="water">水印</label>
+                        </div>
+                        <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;">缩略图高度
+                        </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>
+    <!-- 在线图片 -->
+    <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" 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-6">
+                    <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:20px;">
+                <input type="hidden" name="img_id" value={$img_id}>
+                <div class="formControls col-xs-12 col-sm-8">
+                    <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="overwrite" value="{$overwrite}" {$overwrite ? 'checked' : "" }>
+                            <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="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");
+        $(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(page) {
+        var data = { "page": page };
+        $.ajax({
+            url: '{:url("file_manager/onlineimg")}',
+            type: 'GET',
+            async: true,
+            cache: false,
+            data: 'page=' + page,
+            processData: false,
+            contentType: false,
+            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.url + '?noCache=' + element.mtime + '"';
+                        html_str += '_src="' + element.url + '">';
+                        html_str += '<span class="icon"></span></li>';
+                    });
+                    $('ul.list').prepend(html_str);
+                }
+            }
+        });
+    }
+
+    //step1本地上传图片
+    function uploadImg() {
+        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/uploadimg")}',
+                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);
+                        console.log(res);
+                        var img = res.picture_url + res.picname;
+                        window.parent.$("#" + res.img_id).val(img);
+
+                        if (res.thumbname) {
+                            img = res.picture_url + res.thumbname;
+                            window.parent.$("#thumb").val(img);
+                        }
+
+                        window.parent.$("#view-" + res.img_id).attr('src', img);
+                        layer_close();
+                    } else {
+                        // layer.close(loadIndex);
+                        layer.msg(res.msg, {
+                            icon: 5,
+                            time: 1000
+                        });
+                        return false;
+                    }
+                }
+            });
+        }
+    }
+
+    // 网络图片
+    function uploadUrlImg() {
+        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(res);
+                        // layer.close(loadIndex);
+                        var img = res.picture_url + res.picname;
+                        window.parent.$("#" + res.img_id).val(img);
+
+                        if (res.thumbname) {
+                            img = res.picture_url + res.thumbname;
+                            window.parent.$("#thumb").val(img);
+                        }
+
+                        window.parent.$("#view-" + res.img_id).attr('src', img);
+                        layer_close();
+                    } else {
+                        // layer.close(loadIndex);
+                        layer.msg(res.msg, {
+                            icon: 5,
+                            time: 1000
+                        });
+                        return false;
+                    }
+                }
+            });
+        }
+    }
+
+    function uploadOnlineImg() {
+        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) {
+                    if (res.code == 0) {
+                        // console.log(res);
+                        // layer.close(loadIndex);
+                        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.close(loadIndex);
+                        layer.msg(res.msg, {
+                            icon: 5,
+                            time: 1000
+                        });
+                        return false;
+                    }
+                }
+            });
+        }
+    }
+</script>
+<!--请在上方写此页面业务相关的脚本-->

+ 0 - 0
app/sys/view/index/awere.html → view/sys/index/awere.html


+ 7 - 7
app/sys/view/index/index.html → view/sys/index/index.html

@@ -124,7 +124,7 @@
                                 <tr>
                                     <td>已用空间</td>
                                     <td>
-                                        <span id="Info6">
+                                        <span id="spaceInfo">
                                             <img src="/static/images/loading.gif" alt="正在载入" class="mid"> Loading...
                                         </span>
                                         <span class="ml-50 c-blue">
@@ -190,21 +190,21 @@
     })
 
     function usedSpace(params) {
-        $.post('/admin/index/usedspace', function (data) {
-            if (data.code == 1) {
-                $("#Info6").html(data.size);
+        $.post('/sys/index/usedspace', function (res) {
+            if (res.code == 0) {
+                $("#spaceInfo").html(res.size);
             }
         }, 'json');
     }
 
     function clearCache() {
-        $.post('/admin/index/clearcache', function (data) {
-            if (data.code == 1) {
+        $.post('/sys/index/clearcache', function (res) {
+            if (res.code == 0) {
                 layer.msg('清除成功', {
                     icon: 1,
                     time: 1000
                 });
-                $("#Info6").html('<img src="/static/images/loading.gif" alt="正在载入" class="mid"> Loading...');
+                $("#spaceInfo").html('<img src="/static/images/loading.gif" alt="正在载入" class="mid"> Loading...');
                 usedSpace();
             }
         }, 'json');

+ 3 - 3
app/sys/view/layout.html → view/sys/layout.html

@@ -15,13 +15,13 @@
     <link rel="stylesheet" type="text/css" href="/static/plugins/h-ui.admin/css/H-ui.admin.css" />
     <link rel="stylesheet" type="text/css" href="/static/plugins/lib/Hui-iconfont/1.0.8/iconfont.css" />
     <link rel="stylesheet" type="text/css" href="/static/plugins/h-ui.admin/skin/default/skin.css" id="skin" />
-    <link rel="stylesheet" type="text/css" href="/static/admin/css/style.css" />
+    <link rel="stylesheet" type="text/css" href="/static/sys/css/style.css" />
 
     <script type="text/javascript" src="/static/plugins/lib/jquery/1.9.1/jquery.min.js"></script>
     <script type="text/javascript" src="/static/plugins/lib/layer/2.4/layer.js"></script>
     <script type="text/javascript" src="/static/plugins/h-ui/js/H-ui.js"></script>
     <script type="text/javascript" src="/static/plugins/h-ui.admin/js/H-ui.admin.page.js"></script>
-    <script type="text/javascript" src="/static/admin/js/admin.js"></script>
+    <script type="text/javascript" src="/static/sys/js/admin.js"></script>
 </head>
 
 <body>
@@ -29,7 +29,7 @@
     {include file="public/header" /}
     <section class="Hui-article-box">
         <nav class="breadcrumb">
-            <i class="Hui-iconfont">&#xe67f;</i><a href="/admin/index/index" class="maincolor">首页</a>
+            <i class="Hui-iconfont">&#xe67f;</i><a href="/sys/index/index" class="maincolor">首页</a>
             {foreach $breadCrumb as $bread}
             <span class="c-999 en">&gt;</span>
             <span class="c-666"><a href="{$bread.url ? url($bread.url) : 'javascript:void(0);'}" title="{$bread.title}">{$bread.title}</a></span>

+ 1 - 1
app/sys/view/login/index.html → view/sys/login/index.html

@@ -92,7 +92,7 @@
                         loadIndex = layer.load();
                     },
                     success: function (res) {
-                        if (res.code==1) {
+                        if (res.code==0) {
                             // sessionStorage.setItem('permissions', res.permissions);
                             layer.close(loadIndex);
                             // console.log(res.href);

+ 0 - 0
app/sys/view/module/index.html → view/sys/module/index.html


+ 0 - 0
app/sys/view/module/save.html → view/sys/module/save.html


+ 0 - 0
app/sys/view/public/breadcrumb.html → view/sys/public/breadcrumb.html


+ 0 - 0
app/sys/view/public/css_js.html → view/sys/public/css_js.html


+ 0 - 0
app/sys/view/public/foot_css_js.html → view/sys/public/foot_css_js.html


+ 0 - 0
app/sys/view/public/footer.html → view/sys/public/footer.html


+ 2 - 5
app/sys/view/public/header.html → view/sys/public/header.html

@@ -19,11 +19,8 @@
                         <span id="top_time"></span>
                     </li>
                     <li>
-                        <a aria-hidden="false" class="logo navbar-logo f-l mr-10 hidden-xs" href="/admin">
+                        <a aria-hidden="false" class="logo navbar-logo f-l mr-10 hidden-xs" href="/sys">
                             <i class="Hui-iconfont">&#xe625;</i>系统首页</a>
-                        <a aria-hidden="false" class="logo navbar-logo f-l mr-10 hidden-xs" href="/adminedata"
-                            target="_blank">
-                            <i class="Hui-iconfont">&#xe67f;</i>数据(data网)管理</a>
                         <a aria-hidden="false" class="logo navbar-logo f-l mr-10 hidden-xs" href="/index"
                             target="_blank">
                             <i class="Hui-iconfont">&#xe67f;</i>网站首页</a>
@@ -85,7 +82,7 @@
                 {notempty name='value.child'} {foreach $value.child as $val}
                 <ul>
                     <li>
-                        <a href="{:url($val.url)}"><i class="Hui-iconfont">{$val.icon|raw}</i> {$val.name}</a>
+                        <a {notempty name='val.url'}href="{:url($val.url)}">{/notempty} <i class="Hui-iconfont">{$val.icon|raw}</i> {$val.name}</a>
                     </li>
                 </ul>
                 {/foreach} {/notempty}

+ 0 - 0
app/sys/view/sys_log/index.html → view/sys/sys_log/index.html


+ 0 - 0
app/sys/view/sys_login/index.html → view/sys/sys_login/index.html


+ 0 - 0
app/sys/view/sys_menu/index.html → view/sys/sys_menu/index.html


+ 0 - 0
app/sys/view/sys_menu/save.html → view/sys/sys_menu/save.html


+ 0 - 0
app/sys/view/sys_role/index.html → view/sys/sys_role/index.html


+ 0 - 0
app/sys/view/sys_role/save.html → view/sys/sys_role/save.html


+ 0 - 0
app/sys/view/sys_user/index.html → view/sys/sys_user/index.html


+ 0 - 0
app/sys/view/sys_user/password.html → view/sys/sys_user/password.html


+ 0 - 0
app/sys/view/sys_user/save.html → view/sys/sys_user/save.html