Commit f7fd62cb authored by ZhuChunYang's avatar ZhuChunYang

update

parent 43b86d1d
......@@ -12,6 +12,7 @@ use api\base\BaseController;
use common\business\ApplicationBusiness;
use common\models\psources\CoinApplicateRank;
use common\models\psources\CoinApplication;
use common\models\psources\CoinApplicationCategory;
use common\models\psources\CoinImage;
use Yii;
......@@ -140,7 +141,30 @@ class ApplicationController extends BaseController
}
}
return ['code' => 0,'data' => []];
}
/**
* 分类下的应用列表
*/
public function actionGetAppsByCate()
{
$request = Yii::$app->request;
$cate_id = $request->get('cate_id','');
if($cate_id){
$cate_info = CoinApplicationCategory::getCategoryById($cate_id);
$cate_info_data['id'] = $cate_info->id;
$cate_info_data['name'] = $cate_info->name;
$appItems = ApplicationBusiness::getCateAppInfo(0,[['cate_id' => $cate_id]]);
if($appItems){
$appItems = array_shift($appItems);
foreach($appItems as &$value){
$value['app_user_num'] = ApplicationBusiness::getAppUserNum($value['app_id']);
}
$cate_info_data['apps'] = $appItems;
return ['code' => 0,'data' => $cate_info_data];
}
}
return ['code' => 0,'data' => []];
}
}
\ No newline at end of file
......@@ -72,12 +72,16 @@ class ApplicationBusiness
* @return mixed
* 获取分类以及应用
*/
public static function getCateAppInfo($limit=0)
public static function getCateAppInfo($limit=0,$condition = [])
{
$app_cate_Model = CoinAppCate::find();
$data = $app_cate_Model->JoinWith(['application'], false)
$query = $app_cate_Model->JoinWith(['application'], false)
->select('cate_id,app_id,name,icon,type,native_url,native_login_url,h5_url,android_url,ios_url,app_store_url,redirect_type,'.CoinAppCate::tableName().'.sort')
->orderBy(CoinAppCate::tableName().'.sort asc')->asArray()->all();
->orderBy(CoinAppCate::tableName().'.sort asc');
foreach ($condition as $item) {
$query = $query->andWhere($item);
}
$data = $query->asArray()->all();
$icon_Items = array_column($data,'icon');
$icon_Items = array_unique($icon_Items);
$icon_Infos = CoinImage::getItemsByIds($icon_Items);
......
......@@ -104,4 +104,5 @@ class CoinApplicationCategory extends BaseActiveRecord
}
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