getTopUrl(); $data['topUrl']=$topUrl;*/ $banner =$this->getBanner('轮播图'); $data['banner']=$banner; $category =$this->getBanner('分类'); $data['category']=$category; $this->success('',$data); } public function getIndexTwo() { $data =$this->getBlockShow(); $this->success('',$data); } public function getBlockShow() { $where['status']=1; $where['showType']=array('egt',1); $wheres['showType']=array('elt',7); $data=Db::name('appindex')->where($where)->where($wheres)->select(); $new =array(); foreach ($data as $k=> $v){ $new[$k]=$this->doHandle($v); } return $new; } public function doHandle($v) { $data=array(); $data['title'] = $v['name']; $data['showType'] = $v['showType'];// 1: best seller 2:new in 3:图片check now 4:flash deal 5:图片 wholesale 6:shop by looking 7: membership $data['imgUrl'] =''; $url=input('server.REQUEST_SCHEME') . '://' . input('server.SERVER_NAME'); if($v['image']){ $data['imgUrl'] =$url.$v['image']; } $data['type'] = $v['type']; $data['typeId'] = $v['link']; $data['titleArr'] = array(); if($data['showType'] ==6){ $ndata =array(); foreach ($this->getDetail($v['id']) as $k=> $vs){ $ndata[$k]['type'] = $vs['type']; $ndata[$k]['title'] = $vs['title']; $ndata[$k]['imgUrl'] = $url.$vs['image']; $ndata[$k]['typeId'] = $vs['link']; } $data['titleArr'] =$ndata; } $data['productList'] = array(); if($data['showType'] ==1||$data['showType'] ==2||$data['showType'] ==4){ $ndatas =array(); foreach ($this->getDetail($v['id']) as $ks=> $vul){ if($vul['images']){ $ndatas[$ks]['img'] = $vul['images']; }else{ $ndatas[$ks]['img'] = $url.$vul['image']; } $ndatas[$ks]['Id'] = $vul['link']; $ndatas[$ks]['title'] = $vul['title']; $ndatas[$ks]['oldPrice'] = $vul['oldPrice']; $ndatas[$ks]['nowPrice'] = $vul['nowPrice']; $ndatas[$ks]['sale_num'] = $vul['sale_num']; } $data['productList'] =$ndatas; } return $data; } public function getBanner($code) { $banner=$this->getBlockDetail($code); $new=array(); $url=input('server.REQUEST_SCHEME') . '://' . input('server.SERVER_NAME'); foreach ($banner as $k=> $v){ $new[$k]['title'] = $v['title']; $new[$k]['link'] = $v['link']; $new[$k]['type'] = $v['type']; $new[$k]['image'] =$url.$v['image']; } return $new; } public function getTopUrl($code) { $block =$this->getBlock($code); $new['title'] = $block['title']; $new['name'] = $block['name']; $new['link'] = $block['link']; $new['type'] = $block['type']; return $new; } public function getBlock($code) { $where['status']=1; $where['title']=$code; return Db::name('appindex')->where($where)->find(); } public function getDetail($id) { $where['pid']=$id; return Db::name('appindexdes')->where($where)->select(); } public function getBlockDetail($code) { $where['status']=1; $where['title']=$code; $block= Db::name('appindex')->where($where)->find(); unset($where); $where['pid']=$block['id']; return Db::name('appindexdes')->where($where)->select(); } }