Commit 5c968ee3 authored by ZhuChunYang's avatar ZhuChunYang

首页修改

parent c7f5bb74
...@@ -22,7 +22,7 @@ class ApplicationController extends BaseController ...@@ -22,7 +22,7 @@ class ApplicationController extends BaseController
{ {
$recommendData = ApplicationBusiness::getRecommendList(); $recommendData = ApplicationBusiness::getRecommendList();
$data['recommend'] =$recommendData; $data['recommend'] =$recommendData;
$cate_app_data = ApplicationBusiness::getCategoryAppList(); $cate_app_data = ApplicationBusiness::getCategoryAppList(4);
$data['cate_app_data'] = $cate_app_data; $data['cate_app_data'] = $cate_app_data;
$result['code'] = 0; $result['code'] = 0;
$result['data'] = $data; $result['data'] = $data;
......
...@@ -34,7 +34,7 @@ class ApplicationBusiness ...@@ -34,7 +34,7 @@ class ApplicationBusiness
return $data; return $data;
} }
public static function getCategoryAppList() public static function getCategoryAppList($limit=0)
{ {
$data = CoinApplicationCategory::getAllList(); $data = CoinApplicationCategory::getAllList();
$cate_app_data = []; $cate_app_data = [];
...@@ -42,7 +42,7 @@ class ApplicationBusiness ...@@ -42,7 +42,7 @@ class ApplicationBusiness
$banner_Items = array_column($data,'banner'); $banner_Items = array_column($data,'banner');
$image_Items = array_merge($icon_Items,$banner_Items); $image_Items = array_merge($icon_Items,$banner_Items);
$icon_Infos = CoinImage::getItemsByIds($image_Items); $icon_Infos = CoinImage::getItemsByIds($image_Items);
$cate_app_Infos = self::getCateAppInfo(); $cate_app_Infos = self::getCateAppInfo($limit);
foreach($data as $value){ foreach($data as $value){
$cate_app_item['id'] = $value['id']; $cate_app_item['id'] = $value['id'];
$cate_app_item['name'] = $value['name']; $cate_app_item['name'] = $value['name'];
...@@ -72,7 +72,7 @@ class ApplicationBusiness ...@@ -72,7 +72,7 @@ class ApplicationBusiness
* @return mixed * @return mixed
* 获取分类以及应用 * 获取分类以及应用
*/ */
public static function getCateAppInfo() public static function getCateAppInfo($limit=0)
{ {
$app_cate_Model = CoinAppCate::find(); $app_cate_Model = CoinAppCate::find();
$data = $app_cate_Model->JoinWith(['application'], false) $data = $app_cate_Model->JoinWith(['application'], false)
...@@ -90,7 +90,11 @@ class ApplicationBusiness ...@@ -90,7 +90,11 @@ class ApplicationBusiness
} }
} }
foreach($data as $item){ foreach($data as $item){
$cate_app_item[$item['cate_id']] []= $item; if($limit && isset($cate_app_item[$item['cate_id']]) && count($cate_app_item[$item['cate_id']])>=$limit){
continue;
}else{
$cate_app_item[$item['cate_id']] []= $item;
}
} }
return $cate_app_item; return $cate_app_item;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment