public function indexAction()
 {
     $this->nowCity->id;
     // 设置布局、页面资源
     $this->setLayout(new Layout_Default());
     $this->_view->headTitle("爱车估价,就上公平价!{$this->nowCity->name}二手车在线评估_{$this->nowCity->name}二手车估价网");
     $this->_view->headMeta("{$this->nowCity->name}二手车估价网,{$this->nowCity->name}二手车评估网,{$this->nowCity->name}二手车网,{$this->nowCity->name}二手车交易市场");
     $this->_view->headMeta("{$this->nowCity->name}公平价-国内首创免费二手车估值服务平台,每天收集分析{$this->nowCity->name}二手车交易的真实交易信息,为您提供:{$this->nowCity->name}二手车买车估价/卖车估价/价格评估/估价计算器等服务!");
     // 设置页面资源
     $this->_view->headStylesheet('/css/jquery.autocomplete.css');
     $this->_view->headStylesheet('/css/index/index.css');
     $this->_view->headScript('/js/jquery/jquery-migrate-1.2.1.min.js')->appendFile('/js/jquery/jquery.autocomplete.min.js')->appendFile('/js/pagejs/index.js');
     /*
      * $b = new Auto_Model_Brand ();
      * $brands = $b->getBrand ();
      * $first_letter = array ();
      * foreach ( $brands as $brand )
      * {
      * if (isset ( $first_letter [$brand->first_letter] ['name'] ))
      * {
      * $first_letter [$brand->first_letter] ['brandNames'] [] = $brand->name;
      * } else
      * {
      * $first_letter [$brand->first_letter] ['name'] = $brand->first_letter;
      * $first_letter [$brand->first_letter] ['brandNames'] [] = $brand->name;
      * }
      * }
      */
     // $this->_view->brands = $first_letter;
     // /////是否为AJAX请求
     if ($this->_request->isXmlHttpRequest()) {
         $num = $this->getParam('num');
         $u = new Used_Model_Used();
         $useds = $u->getIndexUsed($this->nowCity->id, $num);
         $data = array();
         $newImgUrlTemp = '';
         $newImgUrl = '';
         $newGrayImgUrl = '';
         foreach ($useds as $k => $used) {
             $data[$k]['title'] = $used->model_slug__name . " " . $used->dmodel;
             $data[$k]['modelSlugName'] = $used->model_slug__name;
             $newImgUrlTemp = str_replace('gongpingjia.qiniudn.com', 'static.souchela.com/qiniudn', $used->thumbnail);
             $newImgUrl = $newImgUrlTemp . '?19812x';
             $newGrayImgUrl = $newImgUrlTemp . '?gray19812x';
             $data[$k]['imgUrl'] = $newImgUrl;
             $data[$k]['imgGrayUrl'] = $newGrayImgUrl;
             $data[$k]['modelSlugId'] = $used->model_slug__id;
         }
         // print_r($data);
         // exit;
         die(json_encode(array('status' => 'OK', 'result' => $data)));
     }
     $this->_view->title = 'welcome to gongpingjia';
     $this->_view->my = 'abiao';
 }
 public function displaceAction()
 {
     $gpj_session = new XF_Session("gpj_session");
     $sessionAry = $gpj_session->read();
     //        获取4s
     $used = new Used_Model_Used();
     $carDealers = $used->getUsedCarDealers($sessionAry["province"], "4s", "", "1", "1000");
     $this->_view->fourshop = $carDealers;
     $this->setLayout(new Layout_Default());
     $this->_view->headStylesheet('/css/common.css');
     $this->_view->headStylesheet('/css/displace/displace.css');
     $this->_view->headScript('/js/pagejs/displace.js')->appendFile("/js/jquery/jquery-migrate-1.2.1.min.js");
     $this->_view->detailModel = $sessionAry["detail_model"];
     $this->_view->detailYear = $sessionAry["detail_year"];
     $this->_view->detailMile = $sessionAry["detail_mile"];
     $this->_view->detailPrice = $sessionAry["detail_price"];
 }
 public function getUsedListAction()
 {
     if ($this->_request->isPost() && $this->_request->isXmlHttpRequest()) {
         $page = $this->getParam("page");
         $brandId = $this->getParam("brandId");
         $brandName = $this->getParam("brandName");
         $minAge = $this->getParam("minAge");
         $maxAge = $this->getParam("maxAge");
         $minMile = $this->getParam("minMile");
         $maxMile = $this->getParam("maxMile");
         $minPrice = $this->getParam("minPrice");
         $maxPrice = $this->getParam("maxPrice");
         $classify = $this->getParam("classify");
         $control = $this->getParam("control");
         $minVolume = $this->getParam("minvolume");
         $maxVolume = $this->getParam("maxvolume");
         $order_key = $this->getParam("order_key");
         if ($minAge == 0) {
             $minAge = "";
         }
         if ($maxAge == 0) {
             $maxAge = "";
         }
         if ($minMile == 0) {
             $minMile = "";
         }
         if ($maxMile == 0) {
             $maxMile = "";
         }
         if ($minPrice == 0) {
             $minPrice = "";
         }
         if ($maxPrice == 0) {
             $maxPrice = "";
         }
         if ($minVolume == 0) {
             $minVolume = "";
         }
         if ($maxVolume == 0) {
             $maxVolume = "";
         }
         if ($order_key == "") {
             $order_key = "price";
         }
         $searchCon = array("brandId" => $brandId, "brandName" => $brandName, "minAge" => $minAge, "maxAge" => $maxAge, "minMile" => $minMile, "maxMile" => $maxMile, "minPrice" => $minPrice, "maxPrice" => $maxPrice, "classify" => $classify, "control" => $control, "minVolume" => $minVolume, "maxVolume" => $maxVolume, 'order_key' => $order_key);
         if (!isset($page) || XF_Functions::isEmpty($page) || !is_numeric($page) || $page < 2) {
             $page = 2;
         }
         $used = new Used_Model_Used();
         $usedList = $used->getUsedList($this->nowCity->id, $page, 10, $searchCon);
         foreach ($usedList->cars as $key => $val) {
             $val->mile = round($val->mile);
             if (!XF_Functions::isEmpty($val->year)) {
                 $val->car_age = date("Y") - $val->year;
             }
             if (!XF_Functions::isEmpty($val->source_type)) {
                 $val->source_val = $this->source_type[$val->source_type];
             }
             if (!XF_Functions::isEmpty($val->thumbnail)) {
                 $val->thumbnail = $val->thumbnail . "?imageView2/1/w/190/h/142";
             } else {
             }
         }
         $carJsons = json_encode($usedList->cars);
         die('{"code":"200", "cars":' . $carJsons . ' }');
     }
 }