public function init() { parent::init(); $code = trim($this->_getParam('vehicleCode', '')); $verify = strtoupper(trim($this->_getParam('vehicleCodeVerify', ''))); $driver = new Model_Driver($code); if (empty($code) || empty($verify) || !$driver->exists() || $driver->get('code_verify') != $verify) { $this->error('Verify Failed. Unauthorized access.'); } $this->code = $code; }
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); }