|
@@ -28,6 +28,68 @@ class Appindex extends Api
|
|
$this->success('',$data);
|
|
$this->success('',$data);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function getIndexTwo()
|
|
|
|
+ {
|
|
|
|
+ $data =$this->getBlockShow();
|
|
|
|
+ $this->success('',$data);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function getBlockShow()
|
|
|
|
+ {
|
|
|
|
+ $where['status']=1;
|
|
|
|
+ $where['showType']=array('egt',1);
|
|
|
|
+ $where['showType']=array('elt',7);
|
|
|
|
+ $data=Db::name('appindex')->where($where)->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)
|
|
public function getBanner($code)
|
|
{
|
|
{
|
|
$banner=$this->getBlockDetail($code);
|
|
$banner=$this->getBlockDetail($code);
|
|
@@ -37,7 +99,7 @@ class Appindex extends Api
|
|
$new[$k]['title'] = $v['title'];
|
|
$new[$k]['title'] = $v['title'];
|
|
$new[$k]['link'] = $v['link'];
|
|
$new[$k]['link'] = $v['link'];
|
|
$new[$k]['type'] = $v['type'];
|
|
$new[$k]['type'] = $v['type'];
|
|
- $new[$k]['image'] =$url. $v['image'];
|
|
|
|
|
|
+ $new[$k]['image'] =$url.$v['image'];
|
|
}
|
|
}
|
|
return $new;
|
|
return $new;
|
|
}
|
|
}
|
|
@@ -56,6 +118,11 @@ class Appindex extends Api
|
|
$where['title']=$code;
|
|
$where['title']=$code;
|
|
return Db::name('appindex')->where($where)->find();
|
|
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)
|
|
public function getBlockDetail($code)
|
|
{
|
|
{
|
|
$where['status']=1;
|
|
$where['status']=1;
|