123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- /**
- * Created by PhpStorm.
- * User: xiaofeng
- * Date: 2018/4/24
- * Time: 下午3:51
- */
- namespace frontend\server;
- use Yii;
- use common\models\ListHouse;
- class ZtServer
- {
- public function GuoQingZhongQiu()
- {
- //获取推送楼盘
- $model = new ListHouse();
- $data = [];
- $data['one'] =$this->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'];
- }
- }
|