Пример #1
0
 /**
  * 获取根据基金筛选条件进行筛选的结果
  * @return array|string
  */
 public function actionFundFilter()
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     if (Yii::$app->request->isPost) {
         $type = Yii::$app->request->post('type');
         if (!$type) {
             return '';
         }
         $num = [];
         foreach ($type as $v) {
             $data = FundFilter::find()->select('fund_num')->distinct()->where(['type' => $v])->all();
             $n = ArrayHelper::getColumn($data, 'fund_num');
             $num = array_merge($n, $num);
         }
         $res = array_count_values($num);
         $array = [];
         foreach ($res as $num => $v) {
             if ($v === count($type)) {
                 $array[] = $num;
             }
         }
         return $array;
     }
     return '';
 }