hostserver->hostId != 0) { $model->city = Yii::$app->hostserver->hostId; $result=$model->HomeGetList(); if(empty($result)){ return $model->GetAllList(); }else{ return $model->HomeGetList(); } } return $model->GetAllList(); } /* * 搜索框-热门筛选 * */ public function shaixuan() { $model = new PushmHouse(); $model->type = 2; $rows = $model->Homegetlist(10); if(!empty($rows)) { return $rows; } } /* * 搜索框 - 价格 * */ public function PriceList() { $PriceModel = new HousesPrice(); $PriceList = $PriceModel->getList([],['price','id']); if($PriceList != null) { return $PriceList; } } /* * 特色推荐 * */ public function tese() { $model = new PushmCharacteristic(); return $model->Homegetlist(3); } /* * 热销楼盘 * */ public function Hothouse($input) { $row = []; if(empty($input['city'])) { $model = new PushmHouse(); $model->type = $input['type']; $rows = $model->Homegetlist(6,$input['rand']); } else { $id = CategoryCity::find()->select(['id'])->andWhere(['pid'=>$input['city']])->asArray()->all(); $city = array_column($id,'id'); $h = new PushmHouse(); $h->type = $input['type']; $rows = $h->CityGetHome($city); } // if(isset($input['city']) && $input['city'] == 0) // { // $model = new PushmHouse(); // $model->type = $input['type']; // $rows = $model->Homegetlist(6,$input['rand']); // } // else if ( $input['city'] != 0) // { // $id = CategoryCity::find()->select(['id'])->andWhere(['pid'=>$input['city']])->asArray()->all(); // $city = array_column($id,'id'); // $h = new PushmHouse(); // $h->type = $input['type']; // $rows = $h->CityGetHome($city); // } if(!empty($rows)) { foreach ($rows as &$val) { if(!empty($val['characteristic'])) { // $val['characteristic'] = $this->Subject(json_decode($val['characteristic']),3); $val['characteristic'] = \common\fm\HouseHandle::ChangeCharacteristic($val['characteristic']); } // $val['tel'] = $this->RandTel($val['cid']); $val['tel'] = \common\fm\HouseHandle::ChangeCityTel($val['cid']); //查询是否单独设置楼盘号码 if (!empty(HouseNumber::SearchNumber($val['id']))) { $val['tel'] = HouseNumber::SearchNumber($val['id']); } //楼盘状态 $val['state'] = Yii::$app->params['HouseSalesStatus'][$val['state']]; } } return $rows; } /* * 品房推荐 * */ public function tuijian() { $model = new PushmRecommend(); return $model->Homegetlist(10); } /* * 热门地区 * */ public function hotCity() { $model = new \common\models\PushmCity(); $model->type = 1; $rows = $model->Homegetlist(6); return $rows; } //资讯 public function newslist() { $model = new \common\models\PushmNews(); $model->type = 1; return $model->Homegetlist(4); } //资讯栏目 public function NewsColumn() { $model = new \common\models\PushmNewscolumn(); return $model->Homegetlist(4); } //特色主题 超过3个随机返回3个元素 public function Subject($id,$num = 3) { $char = new Characteristic(); if(is_array($id) && !empty($id)) { $char->id = $id; $charMode = array_column($char->getList([],['id','name']),'name','id'); if($charMode != null) { $count = count($charMode); $arr = []; if($count >= 3) { $rand = array_rand($charMode,$num); foreach ($rand as $key=>$val) { $arr[$key] = $charMode[$val]; } } else { $arr = $charMode; } return $arr; } } } //楼盘随机电话 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); return $telArr[$randNum]; } } public function getProvinceName($province) { $model = new \common\models\CategoryCity(); $data = $model::find()->select(['city_name'])->andWhere(['id'=>$province])->asArray()->one(); if(!empty($data)){ return $data; } } public function getHouseTouTiao($list_id, $limit = null) { $model = new ListNews(); $data = $model->getPushInfo($list_id, $limit); return $data; } public function getHotHouse($list_id, $limit = null) { $model = new ListHouse(); $data = $model->getIndexPushHouseDetail($list_id, $limit); foreach ($data as &$val) { if (empty($val['is_tel'])) { $val['is_tel'] = $this->RandTel($val['city']); } $val['thumb'] = Yii::$app->params['httpImg']['hosts'] . Yii::$app->params['httpImg']['houses'] . $val['thumb'] . '/same'; } return $data; } }