disposeHouse($model->zhongQiuGuoQing(101)); $data['two'] =$this->disposeHouse($model->zhongQiuGuoQing(102)); $data['three'] =$this->disposeHouse($model->zhongQiuGuoQing(103)); return $data; } public function GuoQingZhongQiuY() { //获取推送楼盘 $model = new ListHouse(); $data = []; $data['one'] =$this->disposeHouse($model->zhongQiuGuoQing(101)); $data['two'] =$this->disposeHouse($model->zhongQiuGuoQing(102)); return $data; } public function disposeHouse($data) { if (!empty($data)) { foreach ($data as &$val) { $val['thumb'] = Yii::$app->params['httpImg']['hosts'] . Yii::$app->params['httpImg']['houses'] . $val['thumb'] . '/same'; $val['tel'] = $this->RandTel($val['city']); } } return $data; } //楼盘随机电话 public function RandTel($city) { $tel = new \common\models\CategoryTelCity(); $tel->cid = $city; $telModel = $tel->CityTelOne(); if ($telModel != null) { $telArr = explode(',', $telModel['tel']); $randNum = array_rand($telArr, 1); if (!empty($telArr[$randNum])) { return $telArr[$randNum]; } } return Yii::$app->params['default_dialtel']; } }