city_id = Yii::$app->request->get('id'); $rows = $model->CityRecordPrice(); if (!empty($rows)) { $arr = []; foreach ($rows as &$val) { $val['price_at'] = trim(date('m', $val['price_at']) . '月', '0'); $arr['categories'][] = $val['price_at']; $arr['data'][] = $val['price']; $arr['region'][] = $val['city_name']; } return Help::JsonCode(Help::SUCCESS, '成功', $arr); } return Help::JsonCode(Help::ERROR, '暂无数据'); } /** * 楼盘价格走势 * @return mixed */ public function actionHouseprice() { $input = Yii::$app->request->post(); if (is_numeric($input['id'])) { $model = new HousePriceRecord(); $model->hid = $input['id']; $rows = $model->getList([]); if (!empty($rows)) { $arr = []; foreach ($rows as $val) { $arr['categories'][] = $val['create_time']; $arr['data'][] = $val['price']; } return Help::JsonCode(Help::SUCCESS, '成功', $arr); } } return Help::JsonCode(Help::ERROR, '失败'); } /** * 底部推荐楼盘 * @param $input * @return mixed */ public function actionall() { $input = Yii::$app->request->post(); switch ($input['type']) { case 'price': $model = new House(); $model->sale_price = $input['content']; $a['sale_price'] = $input['content']; $result = $model->HomegetList(4, $a); break; case 'quyu': $model = new House(); $model->city = $input['content']; $result = $model->HomegetList(4); break; } if (!empty($result)) { foreach ($result as &$val) { $val['thumb'] = Yii::$app->params['httpImg']['hosts'] . Yii::$app->params['httpImg']['houses'] . $val['thumb'] . '/same'; } return Help::JsonCode(Help::SUCCESS, '成功', $result); } return Help::JsonCode(Help::ERROR, '暂无数据'); } /** * 楼盘所有相册 * @return mixed */ public function actionAlbumlist() { $model = new HouseServer(); $album = $model->AlbumAll(); if ($album != null) { return Help::JsonCode(Help::SUCCESS, '成功', $album); } return Help::JsonCode(Help::ERROR, '暂无数据'); } /** * 楼盘户型数据 * @return mixed */ public function actionHousetypeall() { $model = new HouseServer(); $rows = $model->TypeAll(Yii::$app->request->post(), false); if ($rows != null) { return Help::JsonCode(Help::SUCCESS, '成功', $rows); } } /** * 弹窗搜索结果 * @return mixed */ public function actionSearchresult() { $model = new HouseServer(); $res = $model->SearchHouseName(Yii::$app->request->get()); if (!empty($res)) { return Help::JsonCode(Help::SUCCESS, '成功', $res); } return Help::JsonCode(Help::ERROR, '暂无数据'); } /** * 首页-大家都在关注 * @return mixed */ public function actionHousefollow() { $input = Yii::$app->request->get(); $query = House::find(); $query->select(['id', 'name'])->where(['is_push' => 2, 'del' => 1, 'province' => 68]); $query->limit = $input['limit']; $data = $query->orderBy('RAND()')->asArray()->all(); if ($data) { return Help::JsonCode(Help::SUCCESS, '成功', $data); } return Help::JsonCode(Help::ERROR, '失败', $data); } //2020.10.22 vr改版获取推送区域的楼盘数据 public function actionPushcityhouselist() { $input = Yii::$app->request->post(); $model = new HouseServer(); $data = $model->getHouseListByCity($input['city'], 6); return Help::JsonCode(Help::SUCCESS, '成功', $data); } //2020.10.25 v2改版首页推送资讯数据获取 public function actionPushnewslist() { $input = Yii::$app->request->post(); $data = (new News())->getNewsByCategory($input['news'],14); foreach ($data as &$val){ $val['thumb'] = Yii::$app->params['httpImg']['host']. Yii::$app->params['httpImg']['newsthumb']. json_decode($val['thumb'],true)[0]; } return Help::JsonCode(Help::SUCCESS, '成功', $data); } /** * 底部推荐楼盘 * @param $input * @return mixed */ public function actionTall() { $input = Yii::$app->request->post(); switch ($input['type']) { case 'price': $model = new House(); $model->sale_price = $input['content']; $a['sale_price'] = $input['content']; $result = $model->HomegetList(4, $a); break; case 'quyu': $model = new House(); $model->city = $input['content']; $result = $model->HomegetList(4); break; } if (!empty($result)) { foreach ($result as &$val) { $val['thumb'] = Yii::$app->params['httpImg']['hosts'] . Yii::$app->params['httpImg']['houses'] . $val['thumb'] . '/same'; } return Help::JsonCode(Help::SUCCESS, '成功', $result); } return Help::JsonCode(Help::ERROR, '暂无数据'); } }