FreshController.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: xiaofeng
  5. * Date: 2018/4/20
  6. * Time: 上午1:00
  7. */
  8. namespace frontend\controllers;
  9. use frontend\base\CommonController;
  10. use Yii;
  11. use frontend\base\Help;
  12. use common\models\PushFreshimg;
  13. use common\models\PushFreshcity;
  14. use common\models\PushFreshcityhouse;
  15. use common\models\PushCharacteristic;
  16. class FreshController extends CommonController
  17. {
  18. public $enableCsrfValidation = false;
  19. public function actionHome()
  20. {
  21. $img = (new PushFreshimg())->Oneinfo();
  22. $img['img'] = Yii::$app->params['httpImg']['host'].Yii::$app->params['httpImg']['fresh'].$img['img'];
  23. $city = (new PushFreshcity())->Homegetlist();
  24. $ctype = new PushCharacteristic();
  25. $cmodel = $ctype->Homegetlist(4);
  26. return $this->render('home',['img'=>$img,'city'=>$city,'cmodel'=>$cmodel]);
  27. }
  28. public function actionHomecityhouse()
  29. {
  30. $model = new PushFreshcityhouse();
  31. $model->city_id = Yii::$app->request->post('id');
  32. $rows = $model->Homegetlist();
  33. if(!empty($rows))
  34. {
  35. $tel = new \frontend\server\HouseServer();
  36. foreach ($rows as &$val)
  37. {
  38. $val['tel'] = $tel->RandTel($val['cid']);
  39. $val['thumb'] = Yii::$app->params['httpImg']['hosts'].Yii::$app->params['httpImg']['houses'].$val['thumb'];
  40. }
  41. return Help::JsonCode(Help::SUCCESS,'成功',$rows);
  42. }
  43. }
  44. }