static function get_instance() { if (self::$instance instanceof self) { return self::$instance; } return self::$instance = new self(); }
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); } }
public function updateCoordinatesAction() { $lng = trim($this->_getParam('lng', '')); $lat = trim($this->_getParam('lat', '')); $coordinates = "{$lng},{$lat}"; $now = time(); $driver = new Model_Driver($this->code); $driver->set('coordinates', $coordinates); $driver->set('locate_time', $now); $driver->save(); $this->sendResult(); }
static function get_instance() { if (self::$ins_driver instanceof self) { return self::$ins_driver; } return self::$ins_driver = new self(); }
private function __construct() { try { $this->ins_driver = Model_Driver::get_instance(); } catch (DbException $e) { exit; } }
public function driverCoordinatesAction() { $ofd = new Model_OrderForDriver($this->sn); if (!$ofd->exists() || empty($ofd->get('driver_code'))) { $this->sendResult(array()); return; } $driver = new Model_Driver($ofd->get('driver_code')); if (!$driver->exists()) { $this->sendResult(array()); return; } $result = []; $result['coordinates'] = $driver->get('coordinates'); $result['time'] = $driver->get('locate_time'); $this->sendResult($result); }
public function __construct($page, $table_name, $page_count, $max_pages_list) { $this->page = $page; $this->table_name = $table_name; $this->page_count = $page_count; $this->max_pages_list = $max_pages_list; $this->db = Model_Driver::get_instance(); }
public function __construct() { try { $this->ins_driver = Model_Driver::get_instance(); // throw new DBException(); } catch (DBException $e) { exit; } }
public function __construct($page, $tablename, $where = array(), $order = '', $napr = '', $post_number, $number_link, $operand = "=", $match = array()) { $this->page = $page; $this->tablename = $tablename; $this->where = $where; $this->order = $order; $this->napr = $napr; $this->post_number = $post_number; $this->number_link = $number_link; $this->operand = $operand; $this->match = $match; $this->db = Model_Driver::get_instance(); }
private function __construct() { $this->ins_driver = Model_Driver::get_instance(); }
private function __construct() { $this->ins_driver_user = Model_Driver::get_instance(); $this->td = mcrypt_module_open($this->cyfer, '', $this->mode, ''); }
public function deleteDriverAction() { $code = $this->_getParam('code', ''); $driver = new Model_Driver($code); $driver->delete(); $this->_redirect('drivers'); }