<?php /** * Created by PhpStorm. * User: xiaofeng * Date: 2018/4/20 * Time: δΈε1:00 */ namespace frontend\controllers; use frontend\base\CommonController; use Yii; use frontend\base\Help; use common\models\PushFreshimg; use common\models\PushFreshcity; use common\models\PushFreshcityhouse; use common\models\PushCharacteristic; class FreshController extends CommonController { public $enableCsrfValidation = false; public function actionHome() { $img = (new PushFreshimg())->Oneinfo(); $img['img'] = Yii::$app->params['httpImg']['host'].Yii::$app->params['httpImg']['fresh'].$img['img']; $city = (new PushFreshcity())->Homegetlist(); $ctype = new PushCharacteristic(); $cmodel = $ctype->Homegetlist(4); return $this->render('home',['img'=>$img,'city'=>$city,'cmodel'=>$cmodel]); } public function actionHomecityhouse() { $model = new PushFreshcityhouse(); $model->city_id = Yii::$app->request->post('id'); $rows = $model->Homegetlist(); if(!empty($rows)) { $tel = new \frontend\server\HouseServer(); foreach ($rows as &$val) { $val['tel'] = $tel->RandTel($val['cid']); $val['thumb'] = Yii::$app->params['httpImg']['hosts'].Yii::$app->params['httpImg']['houses'].$val['thumb']; } return Help::JsonCode(Help::SUCCESS,'ζε',$rows); } } }