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 voteReportAction() { if ($this->_request->isXmlHttpRequest() && $this->_request->isPost()) { $typeId = $this->getParam("typeId"); $voteType = $this->getParam("voteType"); $gpjSession = new XF_Session("gpj_vote"); if (!$gpjSession->isEmpty()) { if (in_array($typeId, $gpjSession->read())) { die('{"code": "101"}'); } } $cookie = new XF_Cookie("gpj_vote"); $cookieAry = array(); if (!$cookie->isEmpty()) { $cookieAry = explode(",", $cookie->read()); if (in_array($typeId, $cookieAry)) { die('{"code": "101"}'); } } $vote = new Report_Model_Vote(); $reportVote = $vote->getVoteByTypeId($typeId); if ($reportVote) { if ($voteType == "right") { $voteAry["right_vote"] = $reportVote->right_vote + 1; } elseif ($voteType == "noright") { $voteAry["noright_vote"] = $reportVote->noright_vote + 1; } $res = $vote->upVoteById($reportVote->id, $voteAry); } else { if ($voteType == "right") { $voteAry["right_vote"] = 1; $voteAry["noright_vote"] = 0; } elseif ($voteType == "noright") { $voteAry["right_vote"] = 0; $voteAry["noright_vote"] = 1; } $voteAry["car_id"] = $typeId; $res = $vote->addVote($voteAry); } if ($res) { $cookieAry[] = $typeId; $cookie->write(implode(",", $cookieAry), 86400); if (!$gpjSession->isEmpty()) { $gpjAry = $gpjSession->read(); $gpjAry[] = $typeId; } $gpjSession->write($gpjAry); die('{"code":"200"}'); } } }
/** * 检测图片验证码是否正确 * @param int $imgCode 验证码 */ public function checkImgCodeAction() { $sess = new XF_Session('XF_ImageVerify'); if ($sess->read() != strtolower($this->getParameter('imgCode'))) { $this->responseError('图形验证码不正确'); } $this->responseOK(); }