本文整理汇总了PHP中Model_Order::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Order::get方法的具体用法?PHP Model_Order::get怎么用?PHP Model_Order::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Order
的用法示例。
在下文中一共展示了Model_Order::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendPush
public function sendPush($sender, $sn, $message)
{
return;
//发送推送通知
include APPLICATION_PATH . 'libs/ApnsPHP/Log/Interface.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Log/Embedded.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Log/Null.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Abstract.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Exception.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Feedback.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Message.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Push.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Message/Custom.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Message/Exception.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Push/Server.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Push/Exception.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Push/Server/Exception.php';
$order = new Model_Order($sn);
$passengerDeviceId = $order->get('passenger_device_id');
$ofd = new Model_OrderForDriver($sn);
$driver = new Model_Driver($ofd->get('driver_code'));
$driverDeviceId = $driver->get('device_id');
//$certSuffix = APPLICATION_ENV == 'development' ? '-dev.pem' : '.pem';
$certSuffix = '-dev.pem';
$passengerCert = APPLICATION_PATH . '/data/passenger' . $certSuffix;
$driverCert = APPLICATION_PATH . '/data/driver' . $certSuffix;
if ($sender == Model_OrderConversation::SENDER_DRIVER) {
$this->sendPushToDevice($passengerCert, $passengerDeviceId, $message, $sn);
} elseif ($sender == Model_OrderConversation::SENDER_PASSENGER) {
$this->sendPushToDevice($driverCert, $driverDeviceId, $message, $sn);
} else {
$this->sendPushToDevice($passengerCert, $passengerDeviceId, $message, $sn);
$this->sendPushToDevice($driverCert, $driverDeviceId, $message, $sn);
}
}
示例2: orderDetailAction
public function orderDetailAction()
{
$this->view->activeMenu = 'orders';
$sn = trim($this->_getParam('sn'));
if (empty($sn)) {
$this->error('SN Does not exists.');
return;
}
$order = new Model_Order($sn);
if (!$order->exists() || $order->get('user_id') != $this->user->get('id')) {
$this->error('Order does not exists.');
return;
}
$this->view->order = $order;
$ofd = new Model_OrderForDriver($sn);
$driverAssigned = false;
$vehicleAssigned = false;
if ($ofd->exists() && !empty($ofd->get('driver_code'))) {
$driverAssigned = new Model_Driver($ofd->get('driver_code'));
}
if ($ofd->exists() && !empty($ofd->get('vehicle_id'))) {
$vehicleAssigned = new Model_Vehicle($ofd->get('vehicle_id'));
}
$this->view->driverAssigned = $driverAssigned;
$this->view->vehicleAssigned = $vehicleAssigned;
$this->view->vehicleTypes = (new Model_VehicleType())->fetchPagedList(1, 999999)['rows'];
if (!$this->_request->isXmlHttpRequest()) {
return;
}
// edit order
$arp = new AjaxResponse();
$arp->setStatus(AjaxResponse::STATUS_FAILED);
$availableParams = array('forwho', 'city', 'contact-name', 'contact-email', 'contact-phone', 'passenger-names', 'passenger-phone', 'passenger-num', 'when', 'pickup-address', 'dropoff-address', 'vehicle', 'payment-method', 'notes');
$via = $this->_getParam('via-address');
$viaToSave = array();
if (is_array($via)) {
foreach ($via as $k => $v) {
if (!empty($v)) {
$viaToSave[] = $v;
}
}
}
$via = json_encode($viaToSave);
foreach ($availableParams as $paramName) {
$value = trim($this->getParam($paramName, ''));
$colName = str_replace('-', '_', $paramName);
$order->set($colName, $value);
}
$order->set('via', $via);
$order->save();
$arp->setStatus(AjaxResponse::STATUS_OK);
$arp->setMessage($sn);
$this->json($arp);
}
示例3: passengerCoordinatesAction
public function passengerCoordinatesAction()
{
$sn = strtoupper(trim($this->_getParam('sn')));
$ofd = new Model_OrderForDriver($sn);
$order = new Model_Order($sn);
if (!$ofd->exists() || $ofd->get('driver_code') != $this->code) {
$this->sendResult(array());
return;
}
$result = [];
$result['coordinates'] = $order->get('passenger_coordinates');
$result['time'] = $order->get('passenger_locate_time');
$this->sendResult($result);
}
示例4: editOrderForDriverAction
public function editOrderForDriverAction()
{
$sn = $this->_getParam('sn');
if (empty($sn)) {
$this->error('nothing to edit');
return;
}
$order = new Model_Order($sn);
$ofd = new Model_OrderForDriver($sn);
$ofd->set('sn', $sn);
$availableParams = array('driver-code', 'vehicle-id', 'contact-name', 'contact-phone', 'pickup-address', 'pickup-coordinates', 'dropoff-address', 'dropoff-coordinates', 'payment-method', 'notes');
foreach ($availableParams as $paramName) {
$value = trim($this->_getParam($paramName, ''));
$colName = str_replace('-', '_', $paramName);
$ofd->set($colName, $value);
}
$when = strtotime(trim($this->_getParam('when', '')));
$ofd->set('when', $when);
$via = trim($this->_getParam('via', ''));
$viaArray = explode("\n", $via);
foreach ($viaArray as $k => $v) {
$viaArray[$k] = trim($v);
if (empty($viaArray[$k])) {
unset($viaArray[$k]);
}
}
$ofd->set('via', json_encode($viaArray));
$viaCoordinates = trim($this->_getParam('via-coordinates', ''));
$viaCoordinatesArray = explode("\n", $viaCoordinates);
foreach ($viaCoordinatesArray as $k => $v) {
$viaCoordinatesArray[$k] = trim($v);
if (empty($viaCoordinatesArray[$k])) {
unset($viaCoordinatesArray[$k]);
}
}
$ofd->set('via_coordinates', json_encode($viaCoordinatesArray));
$ofd->save();
if ($this->_getParam('driver-code', '') && $order->get('status') < Model_Order::STATUS_DRIVER_ASSIGNED) {
$order->set('status', Model_Order::STATUS_DRIVER_ASSIGNED);
$order->save();
}
$this->_redirect('order-detail?sn=' . $sn);
}