林一峰
8 years ago
12 changed files with 236 additions and 81 deletions
-
35app/Common/function.php
-
5app/Http/Controllers/Admin/IndexController.php
-
12app/Http/Controllers/Api/CommonController.php
-
86app/Http/Controllers/Api/IndexController.php
-
55app/Http/Controllers/Home/IndexController.php
-
93lqycms.sql
-
2public/js/ad.js
-
2resources/views/home/common/footer.blade.php
-
8resources/views/home/index/category.blade.php
-
8resources/views/home/index/category2.blade.php
-
4resources/views/home/index/page.blade.php
-
7routes/web.php
@ -0,0 +1,12 @@ |
|||
<?php |
|||
namespace App\Http\Controllers\Api; |
|||
|
|||
use App\Http\Controllers\Controller; |
|||
|
|||
class CommonController extends Controller |
|||
{ |
|||
public function __construct() |
|||
{ |
|||
parent::__construct(); |
|||
} |
|||
} |
@ -0,0 +1,86 @@ |
|||
<?php |
|||
namespace App\Http\Controllers\Api; |
|||
|
|||
use App\Http\Controllers\Api\CommonController; |
|||
use Illuminate\Support\Facades\DB; |
|||
|
|||
class IndexController extends CommonController |
|||
{ |
|||
public function __construct() |
|||
{ |
|||
parent::__construct(); |
|||
} |
|||
|
|||
//文章列表页
|
|||
public function listarc() |
|||
{ |
|||
$res["code"] = 0; |
|||
$res["msg"] = "success"; |
|||
$res["data"] = ""; |
|||
|
|||
$where = array(); |
|||
$result = ""; |
|||
|
|||
$PageIndex = request('PageIndex',1); |
|||
$PageSize = request('PageSize', sysconfig('CMS_PAGESIZE')); |
|||
$skip = ($PageIndex-1)*$PageSize; |
|||
|
|||
$typeid = request('typeid');if(!empty($typeid)){ $where['typeid']=$typeid; } |
|||
$tuijian = request('tuijian');if(!empty($tuijian)){ $where['tuijian']=$tuijian; } |
|||
$field = array('field','id,typeid,click,title,writer,litpic,pubdate'); |
|||
$orderby = request('orderby',['pubdate','desc']); |
|||
$mname = request('mname','article'); |
|||
|
|||
$model = DB::table($mname); |
|||
if($where){$model->where($where);} |
|||
|
|||
$count = $model->count(); |
|||
$list = object_to_array($model->orderBy($orderby[0], $orderby[1])->skip($skip)->take($PageSize)->get()); |
|||
|
|||
if(!empty($list) && $PageIndex<=10) |
|||
{ |
|||
/* foreach($list as $key=>$row) |
|||
{ |
|||
//$list[$key]["pubdate"] = date("Y-m-d", $list[$key]["pubdate"]);
|
|||
$result .= '<div class="list">'; |
|||
|
|||
if(!empty($row['litpic']) && file_exists($_SERVER['DOCUMENT_ROOT'].$row['litpic'])) |
|||
{ |
|||
$result .= '<a class="'; |
|||
//判断图片长宽
|
|||
if(getimagesize($row['litpic'])[0]>getimagesize($row['litpic'])[1]) |
|||
{ |
|||
$result .= 'limg'; |
|||
} |
|||
else |
|||
{ |
|||
$result .= 'simg'; |
|||
} |
|||
|
|||
$result .= '" href="'.WEBHOST.'/p/'.$row['id'].'"><img alt="'.$row['title'].'" src="'.$row['litpic'].'"></a>'; |
|||
} |
|||
|
|||
$result .= '<strong class="tit"><a href="'.WEBHOST.'/p/'.$row['id'].'">'.$row['title'].'</a></strong><p>'.mb_strcut(strip_tags($row['description']),0,126,'UTF-8').'..<a href="'.WEBHOST.'/p/'.$row['id'].'" class="more">[详情]</a></p>'; |
|||
$result .= '<div class="info"><span class="fl"><i class="pub-v"></i><em>'.date("Y-m-d H:i",$row['pubdate']).'</em></span><span class="fr"><em>'.$row['click'].'</em>人阅读</span></div><div class="cl"></div></div>'; |
|||
} */ |
|||
|
|||
foreach($list as $key=>$row) |
|||
{ |
|||
$list[$key]["url"] = get_front_url(array("id"=>$row['id'],"catid"=>$row['typeid'],"type"=>'content')); |
|||
} |
|||
|
|||
$res["data"] = $list; |
|||
} |
|||
/* $result['List']=$list; |
|||
$result['Count']=$count>0?$count:0; */ |
|||
|
|||
//return $res;
|
|||
exit(json_encode($res)); |
|||
} |
|||
|
|||
//测试页面
|
|||
public function test() |
|||
{ |
|||
return date("Y-m-d H:i:s",strtotime("2017-04")); |
|||
} |
|||
} |
93
lqycms.sql
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1 +1 @@ |
|||
<div id="footer" class="box">©<?php echo sysconfig('CMS_WEBNAME'); ?> 部分文章来源于网络,如果侵犯了您的权益,请<a href="<?php echo sysconfig('CMS_BASEHOST'); ?>/contact.html">联系我们</a>。<a target="_blank" href="<?php echo sysconfig('CMS_BASEHOST'); ?>/sitemap.xml">网站地图</a><div class="m-auto"><script>count_js();</script></div></div>
|
|||
<div id="footer" class="box">© <?php echo sysconfig('CMS_WEBNAME'); ?> 部分文章来源于网络,如果侵犯了您的权益,请<a href="<?php echo sysconfig('CMS_BASEHOST'); ?>/contact.html">联系我们</a>。<a target="_blank" href="<?php echo sysconfig('CMS_BASEHOST'); ?>/sitemap.xml">网站地图</a><div class="m-auto"><script>count_js();</script></div></div>
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue