public function actionFind() { if (isset($_POST['flightNumber'])) { $current = date('Y-m-d'); $flightNumber = $_POST['flightNumber']; $criteria = new CDbCriteria(); $criteria->join = 'LEFT JOIN tbl_mry_user ON tbl_mry_plan.userId=tbl_mry_user.userId'; $criteria->addCondition('flightNumber=:flightNumber'); $criteria->params = array(':flightNumber' => $flightNumber); $criteria->order = 'startDate DESC'; $UserModel = User::model(); $total = $UserModel->count($criteria); $pager = new CPagination($total); $pager->pageSize = 10; $pager->applyLimit($criteria); $UserList = $UserModel->findAll($criteria); //删除PASSWORD相关的信息 $dataFormat = new DataFormat(); $format = $dataFormat->format($userList, null, null); $clientFlash = new ClientFlash(); if ($total > 0) { $clientFlash->pushMobile(0, $format); } else { _echo(3, 数据为空); } } }
public function actionDropList() { $dataFormat = new DataFormat(); $currentCity = UserRefreshForm::model()->getCurrentCity(); $criteria1 = new CDbCriteria(); $criteria2 = new CDbCriteria(); $criteria3 = new CDbCriteria(); $dropListModel = DropList::model(); $dropListData1 = null; $dropListData2 = null; $dropListData3 = null; $format2 = array(); $format3 = array(); $format1 = array(); if (isset($_POST['DropList']['secenicName']) && !empty($_POST['DropList']['secenicName'])) { $secenicName = $_POST['DropList']['secenicName']; $criteria1->addSearchCondition(' secenicName', $secenicName); $criteria1->addCondition("cityName='{$currentCity}'"); $dropListData1 = $dropListModel->findAll($criteria1); $format1 = $dataFormat->format($dropListData1, null); if (count($format1) <= 0) { //匹配整个数据库 $criteria2->addSearchCondition(' secenicName', $secenicName); $dropListData2 = $dropListModel->findAll($criteria2); //分词 $scws = new SCWS(); $scws->sendMobile($secenicName); $param1 = $scws->result[0]; if ($param1 != null) { $criteria3->addCondition("cityName='{$param1}'"); } if (count($scws->result) > 1) { $param2 = $scws->result[1]; $criteria3->addSearchCondition(' secenicName', $param2); } // $total = $dropListModel->count($criteria); // $pager = new CPagination($total); // $pager->pageSize = 100; // $pager->applyLimit($criteria); $dropListData3 = $dropListModel->findAll($criteria3); $format2 = $dataFormat->format($dropListData2, null); $format3 = $dataFormat->format($dropListData3, null); } $format = array_merge($format1, $format2, $format3); //去除重复的ID if (count($format) > 0) { $this->sendMobile(0, $format); } else { $this->sendMobile(3, '数据为空'); } } else { $this->sendMobile(1, '数据错误'); } $this->render('dropList', array('dropList' => $dropListModel)); }
public function actionIndex() { $searchForm = new SearchForm(); $gender = null; $residenceFlag = null; $location = null; $latitude = UserRefreshForm::model()->getLatitude(); $longitude = UserRefreshForm::model()->getLongitude(); $criteria = new CDbCriteria(); if (isset($_POST['SearchForm'])) { $gender = $_POST['SearchForm']['gender']; $residenceFlag = $_POST['SearchForm']['residence']; } $nearPersons = MGetNear::getNearPersonsNoOrder(); $criteria->select = ' t.*,tbl_myr_refresh.status as status,(ACOS(SIN((' . $latitude . '* 3.1415) / 180 ) *SIN((tbl_myr_refresh.latitude * 3.1415) / 180 ) +COS((' . $latitude . '* 3.1415) / 180 ) * COS((tbl_myr_refresh.latitude * 3.1415) / 180 ) *COS((' . $longitude . '* 3.1415) / 180 - (tbl_myr_refresh.longitude * 3.1415) / 180 ) ) * 6378.137) as distance'; $criteria->join = 'LEFT JOIN tbl_myr_refresh ON tbl_myr_refresh.userId=t.userId'; $criteria->addInCondition('t.userId', $nearPersons); if ($gender != null) { $criteria->addCondition("gender={$gender}"); } if ($residenceFlag != null) { $currentCity = UserRefreshForm::model()->getCurrentCity(); $residence = Yii::app()->user->residence; switch ($residenceFlag) { case 0: $criteria->addCondition("t.residence='{$currentCity}'"); break; case 1: $criteria->addCondition("t.residence!='{$currentCity}'"); break; default: break; } } $criteria->order = 'distance ASC'; $UserModel = User::model(); $total = $UserModel->count($criteria); $pager = new CPagination($total); $pager->pageSize = 10; $pager->applyLimit($criteria); $userList = $UserModel->findAll($criteria); $dataFormat = new DataFormat(); $format = $dataFormat->format($userList, null, 'distance', 'status'); $data = array('userList' => $format, 'pages' => $pager, 'searchForm' => $searchForm); $clientFlash = new clientFlash(); if ($total > 0) { $clientFlash->pushMobile(0, $format); } else { $clientFlash->pushMobile(3, '数据为空'); } $this->render('index', $data); }
public function billAction() { $tx = $this->getTransaction(); $tx->tti = 22; $tx->accountNo = $tx->userID; $token = new vng_zingme_payment_thrift_T_Token(); $token->pToken = DataFormat::hex2str($this->_getParam("pToken")); $token->timestamp = $this->_getParam("timestamp"); $billing = new Billing($tx, $token); try { $resCode = $billing->bill(); } catch (Exception $e) { print_r($e); } $url = $this->_getParam("resURL"); $url .= "?userID=" . $this->_getParam("userID"); $url .= "&billNo=" . $tx->orderNo; $url .= "&appID=" . $this->_getParam("appID"); $url .= "&txTime=" . $this->_getParam("txTime"); $url .= "&itemIDs=" . $tx->itemIDs; $url .= "&quantities=" . $tx->itemQuantities; $url .= "&prices=" . $tx->amounts; $url .= "&amount=" . $this->_getParam("amount"); $url .= "&state=" . $resCode->code; $url .= "&balance=" . $resCode->mxuBalance; $url .= "&refNo=" . $resCode->refNo; $this->_redirect($url); }
public function billAction() { //validate params if (!$this->validateParams() || $this->_getParam("pToken") == null) { $this->redirectError(); return; } $token = new vng_zingme_payment_thrift_T_Token(); $pToken = $this->_getParam("pToken"); $token->pToken = DataFormat::hex2str($pToken); $this->updateTokenCached(); $billing = new Billing($this->_getParam("appID"), $this->_getParam("data"), $token, $_SERVER['REMOTE_ADDR']); $resCode = $billing->bill(); $this->view->billNo = $this->_getParam("refID"); $this->view->title = "Ví Zing Me - Kết quả xác nhận thanh toán sản phẩm"; $this->view->billresult = $resCode->code; $this->view->refID = $resCode->refNo; //sure that this is 3th time when server finish process user's bill ScriberPayment::sendLogStep3($this->userID, $this->_getParam("appID"), $this->_getParam("refID"), $resCode->code, $resCode->refNo); if ($resCode->code != 0) { $this->render('billingfail'); } else { $this->view->success = 1; $appCache = $this->getAppCache($this->userID, $this->_getParam("appID")); if ($appCache && $appCache == '1') { $this->view->isLite = 1; } $this->render('billingresult'); } }
public function actionCommentList($shareId) { $currentTime = time(); $criteria = new CDbCriteria(); $criteria->addCondition('shareId=:shareId'); $criteria->params = array(':shareId' => $shareId); $criteria->order = 't.commentId DESC'; $comment = Comment::model(); $total = $comment->count($criteria); $pager = new CPagination($total); $pager->pageSize = 10; $pager->applyLimit($criteria); $commentList = $comment->findAll($criteria); $dataFormat = new DataFormat(); $format = array(); $clientFlash = new ClientFlash(); $format = $dataFormat->format($commentList); if ($total > 0) { $clientFlash = new ClientFlash(); $clientFlash->pushMobile(0, $format); } else { _echo(3, '数据为空'); } }