|
@@ -7,12 +7,49 @@ class IndexController extends HomeBaseController
|
|
|
public function index()
|
|
public function index()
|
|
|
{
|
|
{
|
|
|
//一级分类+二级分类
|
|
//一级分类+二级分类
|
|
|
- $catearr = Db::name('category')->where('parent_id',0)->order('list_order')->limit(0,8)->select();
|
|
|
|
|
|
|
+ $catearr = Db::name('category')
|
|
|
|
|
+ ->where('parent_id',0)
|
|
|
|
|
+ ->field('id,catname,enname')
|
|
|
|
|
+ ->order('list_order')
|
|
|
|
|
+ ->limit(0,12)
|
|
|
|
|
+ ->select();
|
|
|
foreach($catearr as $k=>$v){
|
|
foreach($catearr as $k=>$v){
|
|
|
- $erji_cate = Db::name('category')->where('parent_id',$v['id'])->order('list_order')->limit(0,2)->select();
|
|
|
|
|
|
|
+ $erji_cate = Db::name('category')
|
|
|
|
|
+ ->where('parent_id',$v['id'])
|
|
|
|
|
+ ->field('id,enname,catname')
|
|
|
|
|
+ ->order('list_order')
|
|
|
|
|
+ ->limit(0,2)
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ $v['son'] = $erji_cate;
|
|
|
|
|
+
|
|
|
|
|
+ $xmList = Db::name('jiameng')
|
|
|
|
|
+ ->where(['catid|pcatid'=> $v['id'],'status'=> 1])
|
|
|
|
|
+ ->field('id,title')
|
|
|
|
|
+ ->order('list_order')
|
|
|
|
|
+ ->limit(12)
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ $data = $v;
|
|
|
|
|
+ $data['xmList'] = $xmList;
|
|
|
|
|
+ $v['sonData'][] = $data;
|
|
|
|
|
+
|
|
|
|
|
+ // 子类的ID
|
|
|
|
|
+ foreach ($erji_cate as $val){
|
|
|
|
|
+ $xmList = Db::name('jiameng')
|
|
|
|
|
+ ->where(['catid|pcatid'=> $val['id'],'status'=> 1])
|
|
|
|
|
+ ->field('id,title')
|
|
|
|
|
+ ->order('list_order')
|
|
|
|
|
+ ->limit(12)
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ $data = $val;
|
|
|
|
|
+ $data['xmList'] = $xmList;
|
|
|
|
|
+ $v['sonData'][] = $data;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
$v['son'] = $erji_cate;
|
|
$v['son'] = $erji_cate;
|
|
|
$catearr[$k] = $v;
|
|
$catearr[$k] = $v;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//推荐品牌 3
|
|
//推荐品牌 3
|
|
|
$brand3 = Db::name('jiameng')->field('id,title,logo,guanggaowei')->where('level',3)->order('list_order')->limit(8)->select();
|
|
$brand3 = Db::name('jiameng')->field('id,title,logo,guanggaowei')->where('level',3)->order('list_order')->limit(8)->select();
|
|
|
//广告位 4
|
|
//广告位 4
|
|
@@ -23,8 +60,29 @@ class IndexController extends HomeBaseController
|
|
|
$brand5 = Db::name('jiameng')->field('id,logo,touzi_level,title,guanggaowei')->where('level',5)->order('list_order')->limit(6)->select();
|
|
$brand5 = Db::name('jiameng')->field('id,logo,touzi_level,title,guanggaowei')->where('level',5)->order('list_order')->limit(6)->select();
|
|
|
$brand7 = Db::name('jiameng')->field('id,title,mendian,area,logo,guanggaowei,product,touzi_level')->where('level',7)->order('list_order')->limit(10)->select();
|
|
$brand7 = Db::name('jiameng')->field('id,title,mendian,area,logo,guanggaowei,product,touzi_level')->where('level',7)->order('list_order')->limit(10)->select();
|
|
|
//横幅广告位
|
|
//横幅广告位
|
|
|
|
|
+ $banner = Db::name('slide_item')->where(['slide_id'=>1,'status'=> 1])
|
|
|
|
|
+ ->field('id,title,image,url,target')
|
|
|
|
|
+ ->order('list_order')
|
|
|
|
|
+ ->limit(6)
|
|
|
|
|
+ ->select()
|
|
|
|
|
+ ->toArray();
|
|
|
|
|
+
|
|
|
|
|
+ $banner1 = Db::name('slide_item')->where(['slide_id'=>3,'status'=> 1])
|
|
|
|
|
+ ->field('id,title,image,url,target')
|
|
|
|
|
+ ->order('list_order')
|
|
|
|
|
+ ->limit(1)
|
|
|
|
|
+ ->select()
|
|
|
|
|
+ ->toArray();
|
|
|
|
|
+
|
|
|
|
|
+ $bannerMin = Db::name('slide_item')->where(['slide_id'=>2,'status'=> 1])
|
|
|
|
|
+ ->field('id,title,image,url,target')
|
|
|
|
|
+ ->order('list_order')
|
|
|
|
|
+ ->limit(5)
|
|
|
|
|
+ ->select()
|
|
|
|
|
+ ->toArray();
|
|
|
|
|
+
|
|
|
$brand8 = Db::name('jiameng')->field('id,title,logo,guanggaowei')->where('level',8)->order('list_order')->limit(3)->select()->toArray();
|
|
$brand8 = Db::name('jiameng')->field('id,title,logo,guanggaowei')->where('level',8)->order('list_order')->limit(3)->select()->toArray();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//资讯
|
|
//资讯
|
|
|
$news1 = Db::name('news')->where('status',1)->field('id,title,create_time')->where('ncatid',1)->order('list_order,id desc')->limit(8)->select();
|
|
$news1 = Db::name('news')->where('status',1)->field('id,title,create_time')->where('ncatid',1)->order('list_order,id desc')->limit(8)->select();
|
|
|
$news2 = Db::name('news')->where('status',1)->field('id,title')->where('ncatid',2)->order('list_order,id desc')->limit(8)->select();
|
|
$news2 = Db::name('news')->where('status',1)->field('id,title')->where('ncatid',2)->order('list_order,id desc')->limit(8)->select();
|
|
@@ -63,7 +121,14 @@ class IndexController extends HomeBaseController
|
|
|
$xinwen3 = Db::name('news')->where('status',1)->field('id,title,guanggaowei')->where('level',3)->limit(5)->select();
|
|
$xinwen3 = Db::name('news')->where('status',1)->field('id,title,guanggaowei')->where('level',3)->limit(5)->select();
|
|
|
$xinwen4 = Db::name('news')->where('status',1)->field('id,title,guanggaowei')->where('level',4)->limit(5)->select();
|
|
$xinwen4 = Db::name('news')->where('status',1)->field('id,title,guanggaowei')->where('level',4)->limit(5)->select();
|
|
|
$xinwen5 = Db::name('news')->where('status',1)->field('id,title,guanggaowei')->where('level',5)->limit(2)->select();
|
|
$xinwen5 = Db::name('news')->where('status',1)->field('id,title,guanggaowei')->where('level',5)->limit(2)->select();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 新增
|
|
|
|
|
+ $this->assign('banner',$banner);
|
|
|
|
|
+ $this->assign('banner1',$banner1);
|
|
|
|
|
+ $this->assign('bannerMin',$bannerMin);
|
|
|
|
|
+ // end
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
$this->assign('xinwen3',$xinwen3);
|
|
$this->assign('xinwen3',$xinwen3);
|
|
|
$this->assign('xinwen4',$xinwen4);
|
|
$this->assign('xinwen4',$xinwen4);
|
|
|
$this->assign('xinwen5',$xinwen5);
|
|
$this->assign('xinwen5',$xinwen5);
|