|
|
@ -3,6 +3,8 @@ |
|
|
|
namespace App\Http\Controllers\Home; |
|
|
|
|
|
|
|
use App\Http\Controllers\Home\CommonController; |
|
|
|
use App\Http\Model\Article; |
|
|
|
use App\Http\Model\Slide; |
|
|
|
use Illuminate\Support\Facades\DB; |
|
|
|
use Illuminate\Http\Request; |
|
|
|
|
|
|
@ -28,29 +30,37 @@ class IndexController extends BaseController |
|
|
|
$data['tjlist'] = $res['data']['list']; |
|
|
|
|
|
|
|
//列表
|
|
|
|
$pagesize = 10; |
|
|
|
$offset = 0; |
|
|
|
|
|
|
|
$res = logic('article')->getList([], array('id', 'desc'), '*', 0, 10); |
|
|
|
|
|
|
|
$postdata = array( |
|
|
|
'limit' => $pagesize, |
|
|
|
'offset' => $offset |
|
|
|
); |
|
|
|
$url = env('APP_API_URL') . "/article_list"; |
|
|
|
$res = curl_request($url, $postdata, 'GET'); |
|
|
|
if($res['count']>0) |
|
|
|
{ |
|
|
|
foreach($res['list'] as $k=>$v) |
|
|
|
{ |
|
|
|
$res['list'][$k]->url = get_front_url(array("id"=>$v->id,"type"=>'content')); |
|
|
|
$res['list'][$k]->pubdatetext = date("Y-m-d", $v->pubdate); |
|
|
|
|
|
|
|
$data['article_list'] = $res['data']['list']; |
|
|
|
$data['article_count'] = intval($res['data']['count']); |
|
|
|
} |
|
|
|
} |
|
|
|
$data['article_list'] = $res['list']; |
|
|
|
$data['article_count'] = intval($res['count']); |
|
|
|
|
|
|
|
//banner轮播图
|
|
|
|
$postdata = array( |
|
|
|
'type' => 0, |
|
|
|
'limit' => 5, |
|
|
|
'offset' => 0 |
|
|
|
); |
|
|
|
$url = env('APP_API_URL') . "/slide_list"; |
|
|
|
$res = curl_request($url, $postdata, 'GET'); |
|
|
|
$data['slide_list'] = $res['data']['list']; |
|
|
|
$where = [ |
|
|
|
"type"=>0 |
|
|
|
]; |
|
|
|
$where['is_show'] = Slide::IS_SHOW; |
|
|
|
|
|
|
|
$res = logic('Slide')->getList($where, array('listorder', 'asc'), '*', 0, 5); |
|
|
|
|
|
|
|
if($res['count']>0) |
|
|
|
{ |
|
|
|
foreach($res['list'] as $k=>$v) |
|
|
|
{ |
|
|
|
if(!empty($res['list'][$k]->pic)){$res['list'][$k]->pic = http_host().$v->pic;} |
|
|
|
} |
|
|
|
} |
|
|
|
$data['slide_list'] = collect($res['list'])->toArray(); |
|
|
|
|
|
|
|
return view('home.index.index', $data); |
|
|
|
} |
|
|
|