From 27a6f158c291859ebfdea2dcdfd18d4fbc8061ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=B8=80=E5=B3=B0?= <1feng.0595@gmail.com> Date: Wed, 31 May 2017 00:16:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 1 + app/Common/function.php | 162 ++++++++-- .../Controllers/Admin/ArticleController.php | 281 ++++++++++++++++++ .../Controllers/Admin/CategoryController.php | 123 ++++++++ .../Controllers/Admin/CommonController.php | 54 ++++ .../Controllers/Admin/IndexController.php | 35 +++ .../Controllers/Admin/LoginController.php | 95 ++++++ app/Http/Controllers/Admin/PageController.php | 85 ++++++ app/Http/Controllers/Controller.php | 44 ++- .../Controllers/Home/CommonController.php | 12 + app/Http/Controllers/Home/IndexController.php | 33 +- app/Http/Controllers/Wap/IndexController.php | 4 +- app/Http/Kernel.php | 2 + app/Http/Middleware/CheckLogin.php | 28 ++ app/Http/Model/Arctype.php | 41 +++ app/Http/Model/Article.php | 61 ++++ app/Http/Model/Sysconfig.php | 17 ++ app/Http/Model/User.php | 27 +- app/Http/Model/UserRole.php | 25 ++ composer.json | 7 +- composer.lock | 64 +++- config/app.php | 4 +- config/custom.php | 12 + config/database.php | 2 +- public/index.php | 2 + resources/views/admin/article/add.blade.php | 164 ++++++++++ resources/views/admin/article/edit.blade.php | 147 +++++++++ resources/views/admin/article/index.blade.php | 115 +++++++ .../views/admin/article/repetarc.blade.php | 26 ++ resources/views/admin/category/add.blade.php | 145 +++++++++ .../views/admin/category/index.blade.php | 21 ++ resources/views/admin/common/header.blade.php | 12 + .../views/admin/common/leftmenu.blade.php | 26 ++ resources/views/admin/index/index.blade.php | 18 ++ resources/views/admin/index/jump.blade.php | 47 +++ resources/views/admin/login/login.blade.php | 172 +++++++++++ resources/views/admin/page/add.blade.php | 160 ++++++++++ resources/views/admin/page/edit.blade.php | 156 ++++++++++ resources/views/admin/page/index.blade.php | 33 ++ resources/views/home/404.blade.php | 20 ++ routes/web.php | 63 +++- 41 files changed, 2477 insertions(+), 69 deletions(-) create mode 100644 app/Http/Controllers/Admin/ArticleController.php create mode 100644 app/Http/Controllers/Admin/CategoryController.php create mode 100644 app/Http/Controllers/Admin/CommonController.php create mode 100644 app/Http/Controllers/Admin/IndexController.php create mode 100644 app/Http/Controllers/Admin/LoginController.php create mode 100644 app/Http/Controllers/Admin/PageController.php create mode 100644 app/Http/Controllers/Home/CommonController.php create mode 100644 app/Http/Middleware/CheckLogin.php create mode 100644 app/Http/Model/Arctype.php create mode 100644 app/Http/Model/Article.php create mode 100644 app/Http/Model/Sysconfig.php create mode 100644 app/Http/Model/UserRole.php create mode 100644 config/custom.php create mode 100644 resources/views/admin/article/add.blade.php create mode 100644 resources/views/admin/article/edit.blade.php create mode 100644 resources/views/admin/article/index.blade.php create mode 100644 resources/views/admin/article/repetarc.blade.php create mode 100644 resources/views/admin/category/add.blade.php create mode 100644 resources/views/admin/category/index.blade.php create mode 100644 resources/views/admin/common/header.blade.php create mode 100644 resources/views/admin/common/leftmenu.blade.php create mode 100644 resources/views/admin/index/index.blade.php create mode 100644 resources/views/admin/index/jump.blade.php create mode 100644 resources/views/admin/login/login.blade.php create mode 100644 resources/views/admin/page/add.blade.php create mode 100644 resources/views/admin/page/edit.blade.php create mode 100644 resources/views/admin/page/index.blade.php create mode 100644 resources/views/home/404.blade.php diff --git a/.env.example b/.env.example index 0dbde09..70377b9 100644 --- a/.env.example +++ b/.env.example @@ -13,6 +13,7 @@ DB_PORT=3306 DB_DATABASE=lqycms DB_USERNAME=root DB_PASSWORD=123456 +DB_PREFIX=fl_ BROADCAST_DRIVER=log CACHE_DRIVER=file diff --git a/app/Common/function.php b/app/Common/function.php index 47bbccc..f20087f 100644 --- a/app/Common/function.php +++ b/app/Common/function.php @@ -1,13 +1,17 @@ where($map)->field($field)->order($orderby)->limit($limit)->select(); + $model = \DB::table($modelname); + if($where!=''){$model = $model->where($where);} + if($orderby!=''){$model = $model->orderBy($orderby[0], $orderby[1]);} + if($field!='*'){$model = $model->select(\DB::raw($field));} + + $skip = ($page-1)*$size; + + return object_to_array($model->skip($skip)->take($size)->get()); } //pc前台栏目、标签、内容页面地址生成 @@ -18,17 +22,17 @@ function get_front_url($param='') if($param['type'] == 'list') { //列表页 - $url .= '/cat'.$param['catid'].'.html'; + $url .= '/cat'.$param['catid']; } else if($param['type'] == 'content') { //内容页 - $url .= '/cat'.$param['catid'].'/id'.$param['id'].'.html'; + $url .= '/p/'.$param['id']; } else if($param['type'] == 'tags') { //tags页面 - $url .= '/tag'.$param['tagid'].'.html'; + $url .= '/tag'.$param['tagid']; } else if($param['type'] == 'page') { @@ -40,24 +44,24 @@ function get_front_url($param='') } //wap前台栏目、标签、内容页面地址生成 -function murl(array $param) +function get_wap_front_url(array $param) { $url = ''; if($param['type'] == 'list') { //列表页 - $url .= '/cat'.$param['catid'].'.html'; + $url .= '/cat'.$param['catid']; } else if($param['type'] == 'content') { //内容页 - $url .= '/cat'.$param['catid'].'/id'.$param['id'].'.html'; + $url .= '/p/'.$param['id']; } else if($param['type'] == 'tags') { //tags页面 - $url .= '/tag'.$param['tagid'].'.html'; + $url .= '/tag'.$param['tagid']; } else if($param['type'] == 'page') { @@ -460,10 +464,10 @@ function typeinfo($typeid) } //根据栏目id获取该栏目下文章/商品的数量 -function catarcnum($typeid,$modelname='article') +function catarcnum($typeid, $modelname='article') { $map['typeid']=$typeid; - return db($modelname)->where($map)->count('id'); + return \DB::table($modelname)->where($map)->count('id'); } //根据Tag id获取该Tag标签下文章的数量 @@ -491,12 +495,13 @@ function imgmatch($url) } //将栏目列表生成数组 -function get_category($modelname,$parent_id=0,$pad=0) +function get_category($modelname, $parent_id=0, $pad=0) { $arr=array(); - $cats = db($modelname)->where("reid=$parent_id")->order('id asc')->select(); - + $temp = \DB::table($modelname)->where('reid', $parent_id)->orderBy('id', 'asc')->get(); + $cats = object_to_array($temp); + if($cats) { foreach($cats as $row)//循环数组 @@ -512,9 +517,10 @@ function get_category($modelname,$parent_id=0,$pad=0) } } -function tree($list,$pid=0) +function category_tree($list,$pid=0) { global $temp; + if(!empty($list)) { foreach($list as $v) @@ -523,10 +529,11 @@ function tree($list,$pid=0) //echo $v['id']; if(array_key_exists("child",$v)) { - tree($v['child'],$v['reid']); + category_tree($v['child'],$v['reid']); } } } + return $temp; } @@ -568,6 +575,39 @@ function taglist($id,$tagid=0) if($tags!=""){return db("tagindex")->where($tags)->select();} } +//读取动态配置 +function sysconfig($varname='') +{ + $sysconfig = cache('sysconfig'); + $res = ''; + + if(empty($sysconfig)) + { + cache()->forget('sysconfig'); + + $sysconfig = \App\Http\Model\Sysconfig::orderBy('id')->select('varname', 'value')->get()->toArray(); + + cache(['sysconfig' => $sysconfig], \Carbon\Carbon::now()->addMinutes(86400)); + } + + if($varname != '') + { + foreach($sysconfig as $row) + { + if($varname == $row['varname']) + { + $res = $row['value']; + } + } + } + else + { + $res = $sysconfig; + } + + return $res; +} + //获取https的get请求结果 function get_curl_data($c_url,$data='') { @@ -788,3 +828,85 @@ function dir_delete($dir) closedir($handle); return @rmdir($dir); } + +//对象转数组 +function object_to_array($object, $get=0) +{ + $res = ''; + if($get==0) + { + foreach($object as $key=>$value) + { + $res[$key] = (array)$value; + } + } + else + { + $res = (array)$object; + } + + return $res; +} + +/** + * 操作错误跳转的快捷方法 + * @access protected + * @param string $msg 错误信息 + * @param string $url 页面跳转地址 + * @param mixed $time 当数字时指定跳转时间 + * @return void + */ +function error_jump($msg='', $url='', $time=3) +{ + if ($url=='' && isset($_SERVER["HTTP_REFERER"])) + { + $url = $_SERVER["HTTP_REFERER"]; + } + + if(!headers_sent()) + { + header("Location:".route('admin_jump')."?error=$msg&url=$url&time=$time"); + exit(); + } + else + { + $str = ""; + exit($str); + } +} + +/** + * 操作成功跳转的快捷方法 + * @access protected + * @param string $msg 提示信息 + * @param string $url 页面跳转地址 + * @param mixed $time 当数字时指定跳转时间 + * @return void + */ +function success_jump($msg='', $url='', $time=1) +{ + if ($url=='' && isset($_SERVER["HTTP_REFERER"])) + { + $url = $_SERVER["HTTP_REFERER"]; + } + + if(!headers_sent()) + { + header("Location:".route('admin_jump')."?message=$msg&url=$url&time=$time"); + exit(); + } + else + { + $str = ""; + exit($str); + } +} + + + + + + + + + diff --git a/app/Http/Controllers/Admin/ArticleController.php b/app/Http/Controllers/Admin/ArticleController.php new file mode 100644 index 0000000..8e368d9 --- /dev/null +++ b/app/Http/Controllers/Admin/ArticleController.php @@ -0,0 +1,281 @@ +where('title', 'like', '%'.$_REQUEST['keyword'].'%'); + } + + if(isset($_REQUEST["typeid"]) && $_REQUEST["typeid"]!=0) + { + $query->where('typeid', $_REQUEST["typeid"]); + } + + if(isset($_REQUEST["id"])) + { + $query->where('typeid', $_REQUEST["id"]); + } + + if(isset($_REQUEST["ischeck"])) + { + $query->where('ischeck', $_REQUEST["ischeck"]); //未审核过的文章 + } + }; + + $posts = parent::pageList('article', $where); + foreach($posts as $key=>$value) + { + $info = DB::table('arctype')->select('typename')->where("id", $value->typeid)->first(); + $posts[$key]->typename = $info->typename; + $posts[$key]->body = ''; + } + + $data['posts'] = $posts; + + return view('admin.article.index', $data); + + //if(!empty($_GET["id"])){$id = $_GET["id"];}else {$id="";}if(preg_match('/[0-9]*/',$id)){}else{exit;} + + /* if(!empty($id)){$map['typeid']=$id;} + $Article = M("Article")->field('id')->where($map); + $counts = $Article->count(); + + $pagesize =CMS_PAGESIZE;$page =0; + if($counts % $pagesize){ //取总数据量除以每页数的余数 + $pages = intval($counts/$pagesize) + 1; //如果有余数,则页数等于总数据量除以每页数的结果取整再加一,如果没有余数,则页数等于总数据量除以每页数的结果 + }else{$pages = $counts/$pagesize;} + if(!empty($_GET["page"])){$page = $_GET["page"]-1;$nextpage=$_GET["page"]+1;$previouspage=$_GET["page"]-1;}else{$page = 0;$nextpage=2;$previouspage=0;} + if($counts>0){if($page>$pages-1){exit;}} + $start = $page*$pagesize; + $Article = M("Article")->field('id,typeid,title,pubdate,click,litpic,tuijian')->where($map)->order('id desc')->limit($start,$pagesize)->select(); + + $this->counts = $counts; + $this->pages = $pages; + $this->page = $page; + $this->nextpage = $nextpage; + $this->previouspage = $previouspage; + $this->id = $id; + $this->posts = $Article; */ + + //echo '
';
+        //print_r($Article);
+        //return $this->fetch();
+    }
+    
+    public function add()
+    {
+		$data = '';
+		if(!empty($_REQUEST["catid"])){$data['catid'] = $_REQUEST["catid"];}else{$data['catid'] = 0;}
+		
+        return view('admin.article.add', $data);
+    }
+    
+    public function doadd()
+    {
+        $litpic="";if(!empty($_POST["litpic"])){$litpic = $_POST["litpic"];}else{$_POST['litpic']="";} //缩略图
+        if(empty($_POST["description"])){if(!empty($_POST["body"])){$_POST['description']=cut_str($_POST["body"]);}} //description
+        $content="";if(!empty($_POST["body"])){$content = $_POST["body"];}
+        $_POST['pubdate'] = time();//更新时间
+        $_POST['addtime'] = time();//添加时间
+		$_POST['user_id'] = $_SESSION['admin_user_info']['id']; // 发布者id
+        
+		//关键词
+        if(!empty($_POST["keywords"]))
+		{
+			$_POST['keywords']=str_replace(",",",",$_POST["keywords"]);
+		}
+		else
+		{
+			if(!empty($_POST["title"]))
+			{
+				$title=$_POST["title"];
+				$title=str_replace(",","",$title);
+				$title=str_replace(",","",$title);
+				$_POST['keywords']=get_keywords($title);//标题分词
+			}
+		}
+		
+		if(isset($_POST["dellink"]) && $_POST["dellink"]==1 && !empty($content)){$content=replacelinks($content,array(sysconfig('CMS_BASEHOST')));} //删除非站内链接
+		$_POST['body']=$content;
+		
+		//提取第一个图片为缩略图
+		if(isset($_POST["autolitpic"]) && $_POST["autolitpic"] && empty($litpic))
+		{
+			if(getfirstpic($content))
+			{
+				//获取文章内容的第一张图片
+				$imagepath = '.'.getfirstpic($content);
+				
+				//获取后缀名
+				preg_match_all ("/\/(.+)\.(gif|jpg|jpeg|bmp|png)$/iU",$imagepath,$out, PREG_PATTERN_ORDER);
+				
+				$saveimage='./uploads/'.date('Y/m',time()).'/'.basename($imagepath,'.'.$out[2][0]).'-lp.'.$out[2][0];
+				
+				//生成缩略图,按照原图的比例生成一个最大为240*180的缩略图
+				\Intervention\Image\Facades\Image::make($imagepath)->resize(sysconfig('CMS_IMGWIDTH'), sysconfig('CMS_IMGHEIGHT'))->save($saveimage);
+				
+				//缩略图路径
+				$_POST['litpic']='/uploads/'.date('Y/m',time()).'/'.basename($imagepath,'.'.$out[2][0]).'-lp.'.$out[2][0];
+			}
+		}
+		
+		unset($_POST["dellink"]);
+		unset($_POST["autolitpic"]);
+		unset($_POST["_token"]);
+        if(isset($_POST['editorValue'])){unset($_POST['editorValue']);}
+		if(DB::table('article')->insert($_POST))
+        {
+			success_jump("添加成功!");
+        }
+		else
+		{
+			error_jump("添加失败!请修改后重新添加");
+		}
+    }
+    
+    public function edit()
+    {
+        if(!empty($_GET["id"])){$id = $_GET["id"];}else {$id="";}if(preg_match('/[0-9]*/',$id)){}else{exit;}
+        
+		$data['id'] = $id;
+		$data['post'] = object_to_array(DB::table('article')->where('id', $id)->first(), 1);
+        
+        return view('admin.article.edit', $data);
+    }
+    
+    public function doedit()
+    {
+        if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else{$id="";exit;}
+        $litpic="";if(!empty($_POST["litpic"])){$litpic = $_POST["litpic"];}else{$_POST['litpic']="";} //缩略图
+        if(empty($_POST["description"])){if(!empty($_POST["body"])){$_POST['description']=cut_str($_POST["body"]);}} //description
+        $content="";if(!empty($_POST["body"])){$content = $_POST["body"];}
+        $_POST['pubdate'] = time();//更新时间
+        $_POST['user_id'] = $_SESSION['admin_user_info']['id']; // 修改者id
+        
+		if(!empty($_POST["keywords"]))
+		{
+			$_POST['keywords']=str_replace(",",",",$_POST["keywords"]);
+		}
+		else
+		{
+			if(!empty($_POST["title"]))
+			{
+				$title=$_POST["title"];
+				$title=str_replace(",","",$title);
+				$title=str_replace(",","",$title);
+				$_POST['keywords']=get_keywords($title);//标题分词
+			}
+		}
+		
+		if(isset($_POST["dellink"]) && $_POST["dellink"]==1 && !empty($content)){$content=replacelinks($content,array(CMS_BASEHOST));} //删除非站内链接
+		$_POST['body']=$content;
+		
+		//提取第一个图片为缩略图
+		if(isset($_POST["autolitpic"]) && $_POST["autolitpic"] && empty($litpic))
+		{
+			if(getfirstpic($content))
+			{
+				//获取文章内容的第一张图片
+				$imagepath = '.'.getfirstpic($content);
+				
+				//获取后缀名
+				preg_match_all ("/\/(.+)\.(gif|jpg|jpeg|bmp|png)$/iU",$imagepath,$out, PREG_PATTERN_ORDER);
+				
+				$saveimage='./uploads/'.date('Y/m',time()).'/'.basename($imagepath,'.'.$out[2][0]).'-lp.'.$out[2][0];
+				
+				//生成缩略图,按照原图的比例生成一个最大为240*180的缩略图
+				\Intervention\Image\Facades\Image::make($imagepath)->resize(sysconfig('CMS_IMGWIDTH'), sysconfig('CMS_IMGHEIGHT'))->save($saveimage);
+				
+				//缩略图路径
+				$_POST['litpic']='/uploads/'.date('Y/m',time()).'/'.basename($imagepath,'.'.$out[2][0]).'-lp.'.$out[2][0];
+			}
+		}
+		
+		unset($_POST["dellink"]);
+		unset($_POST["autolitpic"]);
+		unset($_POST["_token"]);
+        if(isset($_POST['editorValue'])){unset($_POST['editorValue']);}
+        if(DB::table('article')->where('id', $id)->update($_POST))
+        {
+            success_jump("修改成功!", route('admin_article'));
+        }
+		else
+		{
+			error_jump("修改失败!");
+		}
+    }
+    
+	//删除文章
+    public function del()
+    {
+		if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump("删除失败!请重新提交");}
+		
+		if(DB::table("article")->whereIn("id", explode(',', $id))->delete())
+        {
+            success_jump("$id ,删除成功");
+        }
+		else
+		{
+			error_jump("$id ,删除失败!请重新提交");
+		}
+    }
+    
+	
+	//重复文章列表
+    public function repetarc()
+    {
+		$data['posts'] = object_to_array(DB::table('article')->select(DB::raw('title,count(*) AS count'))->orderBy('count', 'desc')->groupBy('title')->having('count', '>', 1)->get());
+		
+        return view('admin.article.repetarc', $data);
+    }
+	
+	//推荐文章
+	public function recommendarc()
+    {
+		if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump("您访问的页面不存在或已被删除!");} //if(preg_match('/[0-9]*/',$id)){}else{exit;}
+		
+		$data['tuijian'] = 1;
+		
+        if(DB::table("article")->whereIn("id", explode(',', $id))->update($data))
+        {
+			success_jump("$id ,推荐成功");
+        }
+		else
+		{
+			error_jump("$id ,推荐失败!请重新提交");
+		}
+    }
+    
+	//检测重复文章数量
+    public function articleexists()
+    {
+		$res = '';
+		$where = function ($query) use ($res) {
+			if(isset($_REQUEST["title"]))
+			{
+				$query->where('title', $_REQUEST["title"]);
+			}
+			
+			if(isset($_REQUEST["id"]))
+			{
+				$query->where('id', '<>', $_REQUEST["id"]);
+			}
+        };
+		
+        return DB::table("article")->where($where)->count();
+    }
+}
diff --git a/app/Http/Controllers/Admin/CategoryController.php b/app/Http/Controllers/Admin/CategoryController.php
new file mode 100644
index 0000000..0a2d4c3
--- /dev/null
+++ b/app/Http/Controllers/Admin/CategoryController.php
@@ -0,0 +1,123 @@
+where('id', $id)->first(), 1);
+            }
+			
+            $data['id'] = $id;
+        }
+        else
+        {
+            $data['id'] = 0;
+        }
+        
+        return view('admin.category.add', $data);
+    }
+    
+    public function doadd()
+    {
+        if(!empty($_POST["prid"])){if($_POST["prid"]=="top"){$_POST['reid']=0;}else{$_POST['reid'] = $_POST["prid"];}}//父级栏目id
+        $_POST['addtime'] = time();//添加时间
+		unset($_POST["prid"]);
+		unset($_POST["_token"]);
+		if(isset($_POST['editorValue'])){unset($_POST['editorValue']);}
+		
+		if(DB::table('arctype')->insert($_POST))
+        {
+            success_jump('添加成功!');
+        }
+		else
+		{
+			error_jump('添加失败!请修改后重新添加');
+		}
+    }
+    
+    public function edit()
+    {
+        $id = $_GET["id"];if(preg_match('/[0-9]*/',$id)){}else{exit;}
+        
+		$data['id'] = $id;
+        $post = object_to_array(DB::table('arctype')->where('id', $id)->first(), 1);
+        $reid = $post['reid'];
+        if($reid!=0){$data['postone'] = object_to_array(DB::table('arctype')->where('id', $reid)->first());}
+        
+        $data['post'] = $post;
+		
+        return view('admin.category.edit', $data);
+    }
+    
+    public function doedit()
+    {
+        if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else {$id="";exit;}
+        $_POST['addtime'] = time(); //添加时间
+        unset($_POST["_token"]);
+		if(isset($_POST['editorValue'])){unset($_POST['editorValue']);}
+		
+		if(DB::table('arctype')->where('id', $id)->update($_POST))
+        {
+            success_jump('修改成功!', route('admin_category'));
+        }
+		else
+		{
+			error_jump('修改失败!请修改后重新添加');
+		}
+    }
+    
+    public function del()
+    {
+		if(!empty($_REQUEST["id"])){$id = $_REQUEST["id"];}else{error_jump('删除失败!请重新提交');} //if(preg_match('/[0-9]*/',$id)){}else{exit;}
+		
+		if(DB::table('arctype')->where('reid', $id)->first())
+		{
+			error_jump('删除失败!请先删除子栏目');
+		}
+		else
+		{
+			if(DB::table('arctype')->where('id', $id)->delete())
+			{
+				if(DB::table("article")->where('typeid', $id)->count()>0) //判断该分类下是否有文章,如果有把该分类下的文章也一起删除
+				{
+					if(DB::table("article")->where('typeid', $id)->delete())
+					{
+						success_jump('删除成功');
+					}
+					else
+					{
+						error_jump('栏目下的文章删除失败!');
+					}
+				}
+				else
+				{
+					success_jump('删除成功');
+				}
+			}
+			else
+			{
+				error_jump('删除失败!请重新提交');
+			}
+		}
+    }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Admin/CommonController.php b/app/Http/Controllers/Admin/CommonController.php
new file mode 100644
index 0000000..9bcdde1
--- /dev/null
+++ b/app/Http/Controllers/Admin/CommonController.php
@@ -0,0 +1,54 @@
+user_info = $_SESSION['admin_user_info'];
+		}
+        else
+        {
+            header("Location:".route('page404'));
+			exit();
+        }
+    }
+	
+    /**
+     * 获取分页数据及分页导航
+     * @param string $modelname 模块名与数据库表名对应
+     * @param array  $map       查询条件
+     * @param string $orderby   查询排序
+     * @param string $field     要返回数据的字段
+     * @param int    $listRows  每页数量,默认10条
+     * 
+     * @return 格式化后输出的数据。内容格式为:
+     *     - "code"                 (string):代码
+     *     - "info"                 (string):信息提示
+     * 
+     *     - "result" array
+     * 
+     *     - "img_list"             (array) :图片队列,默认8张
+     *     - "img_title"            (string):车图名称
+     *     - "img_url"              (string):车图片url地址
+     *     - "car_name"             (string):车名称
+     */
+    public function pageList($modelname, $map = '', $orderby = '', $field = '', $listRows = 15)
+    {
+        $orderby = !empty($orderby) ? $orderby : $orderby = ['id', 'desc'];
+        
+		// 查询满足的数据,并且每页显示15条数据
+		$voList = DB::table($modelname)->where($map)->orderBy($orderby[0], $orderby[1])->paginate($listRows);
+		
+        return $voList;
+    }
+}
diff --git a/app/Http/Controllers/Admin/IndexController.php b/app/Http/Controllers/Admin/IndexController.php
new file mode 100644
index 0000000..e84331d
--- /dev/null
+++ b/app/Http/Controllers/Admin/IndexController.php
@@ -0,0 +1,35 @@
+ $username, 'pwd' => $pwd])->orWhere(['email' => $username, 'pwd' => $pwd])->first();
+		
+        if($User)
+        {
+			$admin_user_info = $User->toArray();
+			$admin_user_info['rolename'] = $User->userrole->rolename;
+			
+			$_SESSION['admin_user_info'] = $admin_user_info;
+			
+			$User->logintime = time();
+			$User->save();
+			
+			return redirect()->route('admin');
+        }
+        else
+        {
+            return redirect()->route('admin_login');
+        }
+    }
+
+    //退出登录
+    public function logout()
+    {
+		session_unset();
+        session_destroy();// 退出登录,清除session
+		success_jump('退出成功!', route('home'));
+    }
+    
+    //密码恢复
+    public function recoverpwd()
+    {
+        $data["username"] = "admin888";
+        $data["pwd"] = "21232f297a57a5a743894a0e4a801fc3";
+        
+        if(DB::table('user')->where('id', 1)->update($data))
+        {
+            success_jump('密码恢复成功!', route('admin_login'));
+        }
+		else
+		{
+			error_jump('密码恢复失败!', route('home'));
+		}
+    }
+	
+	/**
+     * 判断用户名是否存在
+     */
+    public function userexists()
+    {
+		$map['username'] = "";
+        if(isset($_POST["username"]) && !empty($_POST["username"]))
+        {
+            $map['username'] = $_POST["username"];
+        }
+		else
+		{
+			return 0;
+		}
+        
+        return DB::table("user")->where($map)->count();
+    }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Admin/PageController.php b/app/Http/Controllers/Admin/PageController.php
new file mode 100644
index 0000000..1da0b42
--- /dev/null
+++ b/app/Http/Controllers/Admin/PageController.php
@@ -0,0 +1,85 @@
+orderBy('id', 'desc')->get());
+        return view('admin.page.index', $data);
+    }
+    
+    public function doadd()
+    {
+        $_POST['pubdate'] = time();//更新时间
+        $_POST['click'] = rand(200,500);//点击
+        
+		unset($_POST["_token"]);
+        if(isset($_POST['editorValue'])){unset($_POST['editorValue']);}
+		
+        if(DB::table("page")->insert($_POST))
+        {
+            success_jump('添加成功!');
+        }
+		else
+		{
+			error_jump('添加失败!请修改后重新添加');
+		}
+    }
+    
+    public function add()
+    {
+        return view('admin.page.add');
+    }
+    
+    public function edit()
+    {
+        if(!empty($_GET["id"])){$id = $_GET["id"];}else{$id="";}
+        if(preg_match('/[0-9]*/',$id)){}else{exit;}
+        
+        $data['id'] = $id;
+		$data['post'] = object_to_array(DB::table('page')->where('id', $id)->first(), 1);
+		
+        return view('admin.page.edit', $data);
+    }
+    
+    public function doedit()
+    {
+        if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else {$id="";exit;}
+        $_POST['pubdate'] = time();//更新时间
+        
+		unset($_POST["_token"]);
+        if(isset($_POST['editorValue'])){unset($_POST['editorValue']);}
+		
+        if(DB::table('page')->where('id', $id)->update($_POST))
+        {
+            success_jump('修改成功!', route('admin_page'));
+        }
+		else
+		{
+			error_jump('修改失败!请修改后重新添加');
+		}
+    }
+    
+    public function del()
+    {
+		if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump("删除失败!请重新提交");} //if(preg_match('/[0-9]*/',$id)){}else{exit;}
+		
+		if(DB::table('page')->whereIn("id", explode(',', $id))->delete())
+        {
+            success_jump('删除成功');
+        }
+		else
+		{
+			error_jump("删除失败!请重新提交");
+		}
+    }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index 03e02a2..29614ad 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -1,13 +1,47 @@
 getActionName();
+		list($class, $method) = explode('@', $action);
+		
+		return ['controller' => $class, 'method' => $method];
+	}
 }
diff --git a/app/Http/Controllers/Home/CommonController.php b/app/Http/Controllers/Home/CommonController.php
new file mode 100644
index 0000000..1b4c96b
--- /dev/null
+++ b/app/Http/Controllers/Home/CommonController.php
@@ -0,0 +1,12 @@
+middleware('guest')->except('logout');
+        parent::__construct();
     }
 	
 	public function index()
 	{
-		dd('home/index');
+		$user = DB::table('article')->where('id', '1')->first();
+		echo $user->title;
+		
+		//$Article = Article::find(1)->arctype;
+		//$Article = Article::find(1);
+		//$Article = Arctype::find(1)->article()->get()->toArray();
+		
+		//$comment = Article::find(1)->arctype()->first()->toArray();
+		//echo $comment->arctype->typename;
+		//print_r($comment);
+		
+		//dd($comment);
+	}
+	
+	public function page404()
+	{
+		return view('home.404');
 	}
 }
diff --git a/app/Http/Controllers/Wap/IndexController.php b/app/Http/Controllers/Wap/IndexController.php
index 2be6b5f..e565cba 100644
--- a/app/Http/Controllers/Wap/IndexController.php
+++ b/app/Http/Controllers/Wap/IndexController.php
@@ -2,9 +2,9 @@
 
 namespace App\Http\Controllers\Wap;
 
-use App\Http\Controllers\Controller;
+use App\Http\Controllers\CommonController;
 
-class IndexController extends Controller
+class IndexController extends CommonController
 {
     /**
      * Create a new controller instance.
diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php
index 66d34c3..ab5b0d1 100644
--- a/app/Http/Kernel.php
+++ b/app/Http/Kernel.php
@@ -56,5 +56,7 @@ class Kernel extends HttpKernel
         'can' => \Illuminate\Auth\Middleware\Authorize::class,
         'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
         'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
+		
+		'check.login' => \App\Http\Middleware\CheckLogin::class,
     ];
 }
diff --git a/app/Http/Middleware/CheckLogin.php b/app/Http/Middleware/CheckLogin.php
new file mode 100644
index 0000000..bac1f0a
--- /dev/null
+++ b/app/Http/Middleware/CheckLogin.php
@@ -0,0 +1,28 @@
+has('admin_user_info'))
+		{
+			redirect()->route('admin_login');
+		}
+		else
+		{
+			
+		}
+		
+        return $next($request);
+    }
+}
diff --git a/app/Http/Model/Arctype.php b/app/Http/Model/Arctype.php
new file mode 100644
index 0000000..b9fc78d
--- /dev/null
+++ b/app/Http/Model/Arctype.php
@@ -0,0 +1,41 @@
+hasMany(Article::class, 'typeid', 'id');
+	}
+	
+}
diff --git a/app/Http/Model/Article.php b/app/Http/Model/Article.php
new file mode 100644
index 0000000..bfb6793
--- /dev/null
+++ b/app/Http/Model/Article.php
@@ -0,0 +1,61 @@
+isValid()) {
+                $newName = md5(rand(1, 1000) . $pic->getClientOriginalName()) . "." . $pic->getClientOriginalExtension();
+                $pic->move('uploads', $newName);
+                return $newName;
+            }
+        }
+        return '';
+    }
+	
+	/**
+     * 获取关联到文章的分类
+     */
+    public function arctype()
+    {
+        return $this->belongsTo(Arctype::class, 'typeid', 'id');
+    }
+	
+}
diff --git a/app/Http/Model/Sysconfig.php b/app/Http/Model/Sysconfig.php
new file mode 100644
index 0000000..c797ef9
--- /dev/null
+++ b/app/Http/Model/Sysconfig.php
@@ -0,0 +1,17 @@
+belongsTo(UserRole::class, 'role_id', 'id');
+    }
 }
diff --git a/app/Http/Model/UserRole.php b/app/Http/Model/UserRole.php
new file mode 100644
index 0000000..9bcf321
--- /dev/null
+++ b/app/Http/Model/UserRole.php
@@ -0,0 +1,25 @@
+hasMany(User::class, 'role_id', 'id');
+	}
+}
diff --git a/composer.json b/composer.json
index 8b179bb..d07f250 100644
--- a/composer.json
+++ b/composer.json
@@ -6,10 +6,11 @@
     "type": "project",
     "require": {
         "php": ">=5.6.4",
+        "intervention/image": "^2.3",
         "laravel/framework": "5.4.*",
-		"overtrue/laravel-wechat": "~3.1",
-		"maatwebsite/excel": "~2.1.0",
-        "laravel/tinker": "~1.0"
+        "laravel/tinker": "~1.0",
+        "maatwebsite/excel": "~2.1.0",
+        "overtrue/laravel-wechat": "~3.1"
     },
     "require-dev": {
         "fzaninotto/faker": "~1.4",
diff --git a/composer.lock b/composer.lock
index c00c639..186696b 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "content-hash": "5fb27d16232b4890e5783a0fd2f70f79",
+    "content-hash": "2367b038aae2731238e00c910f6f6cc3",
     "packages": [
         {
             "name": "dnoegel/php-xdg-base-dir",
@@ -396,6 +396,68 @@
             ],
             "time": "2017-03-20T17:10:46+00:00"
         },
+        {
+            "name": "intervention/image",
+            "version": "2.3.13",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/Intervention/image.git",
+                "reference": "15a517f052ee15d373ffa145c9642d5fec7ddf5c"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://files.phpcomposer.com/files/Intervention/image/15a517f052ee15d373ffa145c9642d5fec7ddf5c.zip",
+                "reference": "15a517f052ee15d373ffa145c9642d5fec7ddf5c",
+                "shasum": ""
+            },
+            "require": {
+                "ext-fileinfo": "*",
+                "guzzlehttp/psr7": "~1.1",
+                "php": ">=5.4.0"
+            },
+            "require-dev": {
+                "mockery/mockery": "~0.9.2",
+                "phpunit/phpunit": "3.*"
+            },
+            "suggest": {
+                "ext-gd": "to use GD library based image processing.",
+                "ext-imagick": "to use Imagick based image processing.",
+                "intervention/imagecache": "Caching extension for the Intervention Image library"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.3-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Intervention\\Image\\": "src/Intervention/Image"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Oliver Vogel",
+                    "email": "oliver@olivervogel.net",
+                    "homepage": "http://olivervogel.net/"
+                }
+            ],
+            "description": "Image handling and manipulation library with support for Laravel integration",
+            "homepage": "http://image.intervention.io/",
+            "keywords": [
+                "gd",
+                "image",
+                "imagick",
+                "laravel",
+                "thumbnail",
+                "watermark"
+            ],
+            "time": "2017-04-23T18:45:36+00:00"
+        },
         {
             "name": "jakub-onderka/php-console-color",
             "version": "0.1",
diff --git a/config/app.php b/config/app.php
index 135e977..e0bf9db 100644
--- a/config/app.php
+++ b/config/app.php
@@ -64,7 +64,7 @@ return [
     |
     */
 
-    'timezone' => 'UTC',
+    'timezone' => 'Asia/Shanghai',
 
     /*
     |--------------------------------------------------------------------------
@@ -162,6 +162,7 @@ return [
         Illuminate\Translation\TranslationServiceProvider::class,
         Illuminate\Validation\ValidationServiceProvider::class,
         Illuminate\View\ViewServiceProvider::class,
+		Intervention\Image\ImageServiceProvider::class,
 
         /*
          * Package Service Providers...
@@ -225,6 +226,7 @@ return [
         'URL' => Illuminate\Support\Facades\URL::class,
         'Validator' => Illuminate\Support\Facades\Validator::class,
         'View' => Illuminate\Support\Facades\View::class,
+		'Image' => Intervention\Image\Facades\Image::class, //图片处理
 
     ],
 
diff --git a/config/custom.php b/config/custom.php
new file mode 100644
index 0000000..8593a09
--- /dev/null
+++ b/config/custom.php
@@ -0,0 +1,12 @@
+ [
+        "0"=>"不推荐",
+        "1"=>"一级推荐",
+        "2"=>"二级推荐",
+        "3"=>"三级推荐",
+        "4"=>"四级推荐"
+    ],
+];
diff --git a/config/database.php b/config/database.php
index cab5d06..be4b663 100644
--- a/config/database.php
+++ b/config/database.php
@@ -49,7 +49,7 @@ return [
             'unix_socket' => env('DB_SOCKET', ''),
             'charset' => 'utf8mb4',
             'collation' => 'utf8mb4_unicode_ci',
-            'prefix' => '',
+            'prefix' => env('DB_PREFIX', 'fl_'),
             'strict' => true,
             'engine' => null,
         ],
diff --git a/public/index.php b/public/index.php
index 1e1d775..607b53a 100644
--- a/public/index.php
+++ b/public/index.php
@@ -19,6 +19,8 @@
 |
 */
 
+session_start(); //开启session
+
 require __DIR__.'/../bootstrap/autoload.php';
 
 /*
diff --git a/resources/views/admin/article/add.blade.php b/resources/views/admin/article/add.blade.php
new file mode 100644
index 0000000..26df9ba
--- /dev/null
+++ b/resources/views/admin/article/add.blade.php
@@ -0,0 +1,164 @@
+发布文章_后台管理@include('admin.common.header')
+
+
+ + +
+
文章列表 > 发布文章
+ +
{{ csrf_field() }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
文章标题:
是否审核: +  是   +  否 +
推荐: + +
seoTitle:
缩略图:
来源:   作者:   浏览次数:
文章栏目: + +
关键词: (多个用","分开)
内容摘要:
附加选项: + + 删除非站内链接 + + 提取第一个图片为缩略图 +
文章内容:
+ + + +
  
+
+ + + \ No newline at end of file diff --git a/resources/views/admin/article/edit.blade.php b/resources/views/admin/article/edit.blade.php new file mode 100644 index 0000000..2cebaa0 --- /dev/null +++ b/resources/views/admin/article/edit.blade.php @@ -0,0 +1,147 @@ +修改文章_后台管理@include('admin.common.header') +
+
+ + +
+
文章列表 > 修改文章
+ +
{{ csrf_field() }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
文章标题:" class="required" style="width:60%" placeholder="在此输入标题">
是否审核: + /> 是   + /> 否 +
推荐: + +
seoTitle:" style="width:60%">
缩略图: " style="width:40%"> " src="" width="120" height="80" id="picview" name="picview">
来源:" size="16">   作者:">   浏览次数:
文章栏目: + +
关键词:"> (多个用","分开)
内容摘要:
附加选项: + + 删除非站内链接 + + 提取第一个图片为缩略图 +
文章内容:
+ + + +
  
+
+ + + \ No newline at end of file diff --git a/resources/views/admin/article/index.blade.php b/resources/views/admin/article/index.blade.php new file mode 100644 index 0000000..3145601 --- /dev/null +++ b/resources/views/admin/article/index.blade.php @@ -0,0 +1,115 @@ +文章列表_<?php echo sysconfig('CMS_WEBNAME'); ?>后台管理@include('admin.common.header') +
+
+ + +
+ + + +
{{ $posts->links() }}
+ + + +
+ \ No newline at end of file diff --git a/resources/views/admin/article/repetarc.blade.php b/resources/views/admin/article/repetarc.blade.php new file mode 100644 index 0000000..00a83f6 --- /dev/null +++ b/resources/views/admin/article/repetarc.blade.php @@ -0,0 +1,26 @@ +重复文档列表_后台管理@include('admin.common.header') +
+
+ + +
+

重复文档列表

[ 文章列表 ] [ 发布文章 ]

+ +
+
+ + + + + + + + + + + + +
文档标题重复数量
">
+ +
+ \ No newline at end of file diff --git a/resources/views/admin/category/add.blade.php b/resources/views/admin/category/add.blade.php new file mode 100644 index 0000000..e56efd5 --- /dev/null +++ b/resources/views/admin/category/add.blade.php @@ -0,0 +1,145 @@ +添加栏目_后台管理@include('admin.common.header') +
+
+ + +
+
栏目管理 > 栏目添加
+ +
{{ csrf_field() }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
栏目名称:
上级目录:">
别名: (包含字母或数字,字母开头)
列表模板:
文章模板:
缩略图:
SEO标题:
关键字: (用","分开)
SEO关键字: (用","分开)
栏目描述:
栏目内容:
+ + + + +
  
+
+
+ + + \ No newline at end of file diff --git a/resources/views/admin/category/index.blade.php b/resources/views/admin/category/index.blade.php new file mode 100644 index 0000000..0d453df --- /dev/null +++ b/resources/views/admin/category/index.blade.php @@ -0,0 +1,21 @@ +栏目列表_后台管理@include('admin.common.header') +
+
+ + +
+

网站栏目管理

[ 增加顶级栏目 ] [ 发布文章 ]

+ +
+
+ \ No newline at end of file diff --git a/resources/views/admin/common/header.blade.php b/resources/views/admin/common/header.blade.php new file mode 100644 index 0000000..128441a --- /dev/null +++ b/resources/views/admin/common/header.blade.php @@ -0,0 +1,12 @@ + + + + + +
\ No newline at end of file diff --git a/resources/views/admin/common/leftmenu.blade.php b/resources/views/admin/common/leftmenu.blade.php new file mode 100644 index 0000000..f1d09de --- /dev/null +++ b/resources/views/admin/common/leftmenu.blade.php @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/resources/views/admin/index/index.blade.php b/resources/views/admin/index/index.blade.php new file mode 100644 index 0000000..5383040 --- /dev/null +++ b/resources/views/admin/index/index.blade.php @@ -0,0 +1,18 @@ +<?php echo sysconfig('CMS_WEBNAME'); ?>后台管理@include('admin.common.header') +
+
+ + +
+

LQYCMS管理中心

+

· 欢迎使用专业的PHP网站管理系统,轻松建站的首选利器,完全免费、开源、无授权限制。
+· LQYCMS采用PHP+Mysql架构,符合企业网站SEO优化理念、功能全面、安全稳定。

+

网站基本信息

+域名/IP: |
+运行环境: +

开发人员

+ FLi、当代范蠡

+我们的联系方式:374861669@qq.com

+© LQYCMS 版权所有 +
+ \ No newline at end of file diff --git a/resources/views/admin/index/jump.blade.php b/resources/views/admin/index/jump.blade.php new file mode 100644 index 0000000..5610c87 --- /dev/null +++ b/resources/views/admin/index/jump.blade.php @@ -0,0 +1,47 @@ + + +跳转提示 + + + +
+ +

:)

+

+ +

:(

+

+ +

+

页面自动 跳转 等待时间:

+
+ + \ No newline at end of file diff --git a/resources/views/admin/login/login.blade.php b/resources/views/admin/login/login.blade.php new file mode 100644 index 0000000..9efc9c4 --- /dev/null +++ b/resources/views/admin/login/login.blade.php @@ -0,0 +1,172 @@ + +后台登录 + + +
+
+
+
+
+

后台登录

+

请输入您的用户名、密码:

+
+
+ +
+
+
+ +
+
+
+
+ + \ No newline at end of file diff --git a/resources/views/admin/page/add.blade.php b/resources/views/admin/page/add.blade.php new file mode 100644 index 0000000..a42cb47 --- /dev/null +++ b/resources/views/admin/page/add.blade.php @@ -0,0 +1,160 @@ +新建单页面_后台管理@include('admin.common.header') +
+
+ + +
+
页面列表 > 新建页面
+ +
{{ csrf_field() }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
页面标题:
别名:
模板文件名:
seoTitle:
缩略图:
页面关键字: (用","分开)
页面摘要信息:
页面内容:
+ + + +
  
+
+ + + \ No newline at end of file diff --git a/resources/views/admin/page/edit.blade.php b/resources/views/admin/page/edit.blade.php new file mode 100644 index 0000000..6e037e0 --- /dev/null +++ b/resources/views/admin/page/edit.blade.php @@ -0,0 +1,156 @@ +修改单页面_后台管理@include('admin.common.header') +
+
+ + +
+
页面列表 > 新建页面
+ +
{{ csrf_field() }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
页面标题:" class="required" style="width:60%" placeholder="在此输入标题">
别名:" size="30">
模板文件名:" size="30">
seoTitle:" style="width:60%">
缩略图: " style="width:40%"> " src="" width="120" height="80" id="picview" name="picview">
页面关键字:"> (用","分开)
页面摘要信息:
页面内容:
+ + + +
  
+
+ + + \ No newline at end of file diff --git a/resources/views/admin/page/index.blade.php b/resources/views/admin/page/index.blade.php new file mode 100644 index 0000000..b197392 --- /dev/null +++ b/resources/views/admin/page/index.blade.php @@ -0,0 +1,33 @@ +单页面列表_后台管理@include('admin.common.header') +
+
+ + +
+

单页文档管理

[ 增加一个页面 ]

+ +
+ + + + + + + + + + + + + + + + + + + + +
编号页面名称别名更新时间管理
">"page","pagename"=>$row["filename"])); ?>">预览 ">修改 ')" href="javascript:;">删除
+ +
+ \ No newline at end of file diff --git a/resources/views/home/404.blade.php b/resources/views/home/404.blade.php new file mode 100644 index 0000000..cf6e77b --- /dev/null +++ b/resources/views/home/404.blade.php @@ -0,0 +1,20 @@ + + +您访问的页面不存在或已被删除! + + +
+

:(

+

您访问的页面不存在或已被删除!

+

返回首页

+
+ \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index b3cade6..714f995 100644 --- a/routes/web.php +++ b/routes/web.php @@ -13,7 +13,7 @@ //wap路由,要放到最前面,否则解析不到 Route::group(['domain' => env('APP_SUBDOMAIN'), 'namespace' => 'Wap'], function () { - Route::get('/', 'IndexController@index'); + Route::get('/', 'IndexController@index')->name('wap_home'); Route::get('/tags', 'IndexController@tags'); Route::get('/search', 'IndexController@search'); Route::get('/cat{cat}/id{id}', 'IndexController@detail'); //详情页 @@ -21,7 +21,7 @@ Route::group(['domain' => env('APP_SUBDOMAIN'), 'namespace' => 'Wap'], function Route::get('/cat{cat}', 'IndexController@category'); //分类页 Route::get('/tag{tag}/{page}', 'IndexController@tag'); //标签页,分页 Route::get('/tag{tag}', 'IndexController@tag'); //标签页 - Route::get('/{id}', 'IndexController@page'); //单页 + Route::get('/page/{id}', 'IndexController@singlepage')->name('wap_singlepage'); //单页 Route::get('/aaa', function () { dd('wap'); }); @@ -30,15 +30,16 @@ Route::group(['domain' => env('APP_SUBDOMAIN'), 'namespace' => 'Wap'], function //前台路由 Route::group(['namespace' => 'Home'], function () { - Route::get('/', 'IndexController@index'); - Route::get('/tags', 'IndexController@tags'); + Route::get('/', 'IndexController@index')->name('home'); + Route::get('/page404', 'IndexController@page404')->name('page404'); //404页面 + Route::get('/tags', 'IndexController@tags')->name('tags'); Route::get('/search', 'IndexController@search'); Route::get('/cat{cat}/id{id}', 'IndexController@detail'); //详情页 Route::get('/cat{cat}/{page}', 'IndexController@category'); //分类页,分页 Route::get('/cat{cat}', 'IndexController@category'); //分类页 Route::get('/tag{tag}/{page}', 'IndexController@tag'); //标签页,分页 Route::get('/tag{tag}', 'IndexController@tag'); //标签页 - Route::get('/{id}', 'IndexController@page'); //单页 + Route::get('/page/{id}', 'IndexController@page')->name('page'); //单页 Route::get('/aaa', function () { dd('wap'); @@ -47,12 +48,56 @@ Route::group(['namespace' => 'Home'], function () { //后台路由 -Route::group(['prefix' => 'Admin'], function () { - Route::get('/bbb', function () { - // 匹配 "/fladmin/users" URL - }); +Route::group(['prefix' => 'fladmin', 'namespace' => 'Admin', 'middleware' => ['web']], function () { + Route::get('/', 'IndexController@index')->name('admin'); + //文章 + Route::get('/article', 'ArticleController@index')->name('admin_article'); + Route::get('/article/add', 'ArticleController@add')->name('admin_article_add'); + Route::post('/article/doadd', 'ArticleController@doadd')->name('admin_article_doadd'); + Route::get('/article/edit', 'ArticleController@edit')->name('admin_article_edit'); + Route::post('/article/doedit', 'ArticleController@doedit')->name('admin_article_doedit'); + Route::get('/article/del', 'ArticleController@del')->name('admin_article_del'); + Route::get('/article/repetarc', 'ArticleController@repetarc')->name('admin_article_repetarc'); + Route::get('/article/recommendarc', 'ArticleController@recommendarc')->name('admin_article_recommendarc'); + Route::get('/article/articleexists', 'ArticleController@articleexists')->name('admin_article_articleexists'); + //栏目 + Route::get('/category', 'CategoryController@index')->name('admin_category'); + Route::get('/category/add', 'CategoryController@add')->name('admin_category_add'); + Route::post('/category/doadd', 'CategoryController@doadd')->name('admin_category_doadd'); + Route::get('/category/edit', 'CategoryController@edit')->name('admin_category_edit'); + Route::post('/category/doedit', 'CategoryController@doedit')->name('admin_category_doedit'); + Route::get('/category/del', 'CategoryController@del')->name('admin_category_del'); + //单页 + Route::get('/page', 'PageController@index')->name('admin_page'); + Route::get('/page/add', 'PageController@add')->name('admin_page_add'); + Route::post('/page/doadd', 'PageController@doadd')->name('admin_page_doadd'); + Route::get('/page/edit', 'PageController@edit')->name('admin_page_edit'); + Route::post('/page/doedit', 'PageController@doedit')->name('admin_page_doedit'); + Route::get('/page/del', 'PageController@del')->name('admin_page_del'); + + Route::get('/friendlink', 'FriendlinkController@index')->name('admin_friendlink'); + Route::get('/guestbook', 'GuestbookController@index')->name('admin_guestbook'); + Route::get('/keyword', 'KeywordController@index')->name('admin_keyword'); + Route::get('/product', 'ProductController@index')->name('admin_product'); + + Route::get('/search', 'SearchController@index')->name('admin_search'); + Route::get('/slide', 'SlideController@index')->name('admin_slide'); + Route::get('/tag', 'TagController@index')->name('admin_tag'); + Route::get('/sysconfig', 'SysconfigController@index')->name('admin_sysconfig'); + //后台登录注销 + Route::get('/login', 'LoginController@login')->name('admin_login'); + Route::post('/dologin', 'LoginController@dologin'); + Route::get('/logout', 'LoginController@logout')->name('admin_logout'); + Route::get('/recoverpwd', 'LoginController@recoverpwd')->name('admin_recoverpwd'); + }); +Route::get('/fladmin/jump', 'Admin\IndexController@jump')->name('admin_jump'); +//Route::get('/fladmin', 'Admin\IndexController@index')->name('admin'); +//Route::get('/fladmin/login', 'Admin\LoginController@login')->name('admin_login'); +//Route::post('/fladmin/dologin', 'Admin\LoginController@dologin'); +//Route::get('/fladmin/logout', 'Admin\LoginController@logout'); + //接口路由 Route::group(['prefix' => 'Api'], function () {