|
@@ -17,11 +17,52 @@ class Appindex extends Api
|
|
|
* 首页
|
|
|
*
|
|
|
*/
|
|
|
- public function getBanner()
|
|
|
+ public function getIndexOne()
|
|
|
{
|
|
|
+ $topUrl =$this->getTopUrl();
|
|
|
+ $data['topUrl']=$topUrl;
|
|
|
+ $banner =$this->getBanner('轮播图');
|
|
|
+ $data['banner']=$banner;
|
|
|
+ $category =$this->getBanner('分类');
|
|
|
+ $data['category']=$category;
|
|
|
+ $this->success('',$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()
|
|
|
+ {
|
|
|
+ $block =$this->getBlock('顶部链接');
|
|
|
+ $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 getBlockDetail($code)
|
|
|
+ {
|
|
|
$where['status']=1;
|
|
|
- $banner = Db::name('message_read')->where($where)->select();
|
|
|
- $this->success('',$banner);
|
|
|
+ $where['title']=$code;
|
|
|
+ $block= Db::name('appindex')->where($where)->find();
|
|
|
+ unset($where);
|
|
|
+ $where['pid']=$block['id'];
|
|
|
+ return Db::name('appindexdes')->where($where)->select();
|
|
|
}
|
|
|
}
|