request->isAjax){ $id = Yii::$app->request->get('id'); Yii::$app->response->format = 'json'; $request = Yii::$app->request; $page = $request->get('page', 1); $limit = $request->get('limit', 10); $app_ids = CoinAppCate::getAppIdByCateId($id); $app_items =[]; $where = []; if($app_ids){ $app_items = array_column($app_ids,'app_id'); } $where[] = ['in','id',[$app_items]]; $data = CoinApplication::getList($page, $limit, $where); return $data; }else{ $id = Yii::$app->request->get('id'); if($id){ $parent_category = CoinApplicationCategory::getCategoryById($id); if($parent_category){ return $this->render('list',['parent_category' => $parent_category]); }else{ $this->error('id参数不合法', Yii::$app->request->getReferrer()); } }else{ $this->error('id参数不能为空', Yii::$app->request->getReferrer()); } } } public function actionAdd() { if(Yii::$app->request->isPost){ $category_id = Yii::$app->request->get('category_id'); Yii::$app->response->format = 'json'; $fields = ['name','sort','icon','type','native_url','h5_url','android_url','ios_url','app_store_url','advertise','description','redirect_type']; $params = array_merge(Yii::$app->request->post(),['category_id' => $category_id]); $params = $this->initParams($params, $fields); var_dump($params);die; } return $this->render('add'); } }