当前位置: 首页>>代码示例>>PHP>>正文


PHP Flight::dateTime方法代码示例

本文整理汇总了PHP中Flight::dateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Flight::dateTime方法的具体用法?PHP Flight::dateTime怎么用?PHP Flight::dateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Flight的用法示例。


在下文中一共展示了Flight::dateTime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: insert

 public static function insert()
 {
     $connection = Flight::dbMain();
     $dateTime = Flight::dateTime();
     try {
         $company = json_decode(file_get_contents("php://input"));
         if ($company == null) {
             throw new Exception(json_get_error());
         }
         $sql = "\n\t\t\tINSERT INTO company \n\t\t\t(company_name, company_desc, company_dt_created, e_status_id)\n\t\t\tVALUES\n\t\t\t(:company_name, :company_desc, :company_dt_created, :e_status_id);";
         $query = $connection->prepare($sql);
         $query->bindParam(':company_name', $company->Name, PDO::PARAM_STR);
         $query->bindParam(':company_desc', $company->Desc, PDO::PARAM_STR);
         $query->bindParam(':company_dt_created', $dateTime, PDO::PARAM_STR);
         $query->bindParam(':e_status_id', $company->Status->Id, PDO::PARAM_INT);
         $query->execute();
         $result = new Result();
         $result->Status = Result::INSERTED;
         $result->Id = $connection->lastInsertId();
         $result->Message = 'Done';
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:29,代码来源:company.php

示例2: insert

 public static function insert()
 {
     $connection = Flight::dbMain();
     $dateTime = Flight::dateTime();
     try {
         $unit = json_decode(file_get_contents("php://input"));
         if ($unit == null) {
             throw new Exception(json_get_error());
         }
         /* Begin Transaction */
         $connection->beginTransaction();
         //Query 1 //=================================
         $sql = "\n\t\t\tINSERT INTO unit \n\t\t\t(unit_imei, unit_serial_number, sim_id, unit_type_id, company_id, e_status_unit_id, unit_dt_created)\n\t\t\tVALUES\n\t\t\t(:unit_imei, :unit_serial_number, :sim_id, :unit_type_id, :company_id, :e_status_unit_id, :unit_dt_created);";
         $query = $connection->prepare($sql);
         $query->bindParam(':unit_imei', $unit->Imei, PDO::PARAM_INT);
         $query->bindParam(':unit_serial_number', $unit->SerialNumber, PDO::PARAM_STR);
         $query->bindParam(':sim_id', $unit->Sim->Id, PDO::PARAM_INT);
         $query->bindParam(':unit_type_id', $unit->UnitType->Id, PDO::PARAM_INT);
         $query->bindParam(':company_id', $unit->Company->Id, PDO::PARAM_INT);
         $query->bindParam(':e_status_unit_id', $unit->UnitStatus->Id, PDO::PARAM_INT);
         $query->bindParam(':unit_dt_created', $dateTime, PDO::PARAM_STR);
         $query->execute();
         $result = new Result();
         $result->Status = Result::INSERTED;
         $result->Id = $connection->lastInsertId();
         $result->Message = 'Done';
         //Query 2 //=================================
         $year = date('Y');
         $schema = "app_data_{$year}";
         // $tableName = "data_id_" .  $result->Id;
         $imei = $unit->Imei;
         $tableName = "data_{$imei}";
         $sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `" . $schema . "`.`" . $tableName . "` (\n\t\t`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '',\n\t\t`dt_server` DATETIME NULL COMMENT '',\n\t\t`dt_device` DATETIME NULL COMMENT '',\n\t\t`command` SMALLINT NULL COMMENT '',\n\t\t`event` SMALLINT NULL COMMENT '',\n\t\t`byte` BIGINT NULL COMMENT '',\n\t\t`latitude` DOUBLE NULL COMMENT '',\n\t\t`longitude` DOUBLE NULL COMMENT '',\n\t\t`altitude` DOUBLE NULL COMMENT '',\n\t\t`rfid` BIGINT NULL COMMENT '',\n\t\t`mode` TINYINT NULL COMMENT '',\n\t\t`speed` SMALLINT NULL COMMENT '',\n\t\t`time` BIGINT NULL COMMENT '',\n\t\t`odometer` BIGINT NULL COMMENT '',\n\t\t`heading` SMALLINT NULL COMMENT '',\n\t\t`picture` BIGINT NULL COMMENT '',\n\t\t`gps_satellite` SMALLINT NULL COMMENT '',\n\t\t`gps_status` SMALLINT NULL COMMENT '',\n\t\t`gps_accuracy` SMALLINT NULL COMMENT '',\n\t\t`gprs_signal` SMALLINT NULL COMMENT '',\n\t\t`gprs_status` VARCHAR(25) NULL COMMENT '',\n\t\t`reserve` INT NULL COMMENT '',\n\t\t`di_0` SMALLINT NULL COMMENT '',\n\t\t`di_1` SMALLINT NULL COMMENT '',\n\t\t`di_2` SMALLINT NULL COMMENT '',\n\t\t`di_3` SMALLINT NULL COMMENT '',\n\t\t`di_4` SMALLINT NULL COMMENT '',\n\t\t`di_5` SMALLINT NULL COMMENT '',\n\t\t`di_6` SMALLINT NULL COMMENT '',\n\t\t`di_7` SMALLINT NULL COMMENT '',\n\t\t`di_8` SMALLINT NULL COMMENT '',\n\t\t`di_9` SMALLINT NULL COMMENT '',\n\t\t`di_10` SMALLINT NULL COMMENT '',\n\t\t`do_0` SMALLINT NULL COMMENT '',\n\t\t`do_1` SMALLINT NULL COMMENT '',\n\t\t`do_2` SMALLINT NULL COMMENT '',\n\t\t`do_3` SMALLINT NULL COMMENT '',\n\t\t`ai_0` SMALLINT NULL COMMENT '',\n\t\t`ai_1` SMALLINT NULL COMMENT '',\n\t\t`ai_2` SMALLINT NULL COMMENT '',\n\t\t`ai_3` SMALLINT NULL COMMENT '',\n\t\t`ai_4` SMALLINT NULL COMMENT '',\n\t\t`ai_5` SMALLINT NULL COMMENT '',\n\t\t`ai_6` SMALLINT NULL COMMENT '',\n\t\t`ai_7` SMALLINT NULL COMMENT '',\n\t\t`ai_8` SMALLINT NULL COMMENT '',\n\t\t`ai_9` SMALLINT NULL COMMENT '',\n\t\t`ai_10` SMALLINT NULL COMMENT '',\n\t\t`ao_0` SMALLINT NULL COMMENT '',\n\t\t`ao_1` SMALLINT NULL COMMENT '',\n\t\t`ao_2` SMALLINT NULL COMMENT '',\n\t\t`ao_3` SMALLINT NULL COMMENT '',\n\t\tPRIMARY KEY (`id`)  COMMENT '')\n\t\tENGINE = InnoDB\n\t\tPACK_KEYS = DEFAULT\n\t\tKEY_BLOCK_SIZE = 8\n\t\t";
         $query = $connection->prepare($sql);
         $query->execute();
         $connection->commit();
         $result = new Result();
         $result->Status = Result::INSERTED;
         $result->Message = 'Done';
         $result->Id = $connection->lastInsertId();
         return $result;
     } catch (PDOException $pdoException) {
         $connection->rollBack();
         throw $pdoException;
     } catch (Exception $exception) {
         $connection->rollBack();
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:51,代码来源:unit.php

示例3: insert

 public static function insert()
 {
     $connection = Flight::dbMain();
     $dateTime = Flight::dateTime();
     try {
         $driver = json_decode(file_get_contents("php://input"));
         if ($driver == null) {
             throw new Exception(json_get_error());
         }
         $sql = "\n\t\t\tINSERT INTO driver \n\t\t\t(driver_id, driver_name, driver_name_f, driver_name_m, driver_name_l, driver_rfid, e_status_id, company_id, driver_dt_created)\n\t\t\tVALUES\n\t\t\t(:driver_id, :driver_name, :driver_name_f, :driver_name_m, :driver_name_l, :driver_rfid, :e_status_id, :company_id, :driver_dt_created);";
         $query = $connection->prepare($sql);
         $query->bindParam(':driver_id', $driver->DriverId, PDO::PARAM_STR);
         $query->bindParam(':driver_name', $driver->Name, PDO::PARAM_STR);
         $query->bindParam(':driver_name_f', $driver->NameFirst, PDO::PARAM_STR);
         $query->bindParam(':driver_name_m', $driver->NameMiddle, PDO::PARAM_STR);
         $query->bindParam(':driver_name_l', $driver->NameLast, PDO::PARAM_STR);
         $query->bindParam(':driver_rfid', $driver->Rfid, PDO::PARAM_STR);
         $query->bindParam(':e_status_id', $driver->Status->Id, PDO::PARAM_INT);
         $query->bindParam(':company_id', $driver->Company->Id, PDO::PARAM_INT);
         $query->bindParam(':driver_dt_created', $dateTime, PDO::PARAM_STR);
         $query->execute();
         $result = new Result();
         $result->Status = Result::INSERTED;
         $result->Id = $connection->lastInsertId();
         $result->Message = 'Done';
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:34,代码来源:driver.php

示例4: insert

 public static function insert()
 {
     $connection = Flight::dbMain();
     $dateTime = Flight::dateTime();
     try {
         $user = json_decode(file_get_contents("php://input"));
         if ($user == null) {
             throw new Exception(json_get_error());
         }
         $sql = "\n\t\t\tINSERT INTO user \n\t\t\t(user_name, user_password, user_dt_created, user_dt_expired, e_privilege_id, e_status_id, company_id, sim_id)\n\t\t\tVALUES\n\t\t\t(:user_name, :user_password, :user_dt_created, :user_dt_expired, :e_privilege_id, :e_status_id, :company_id, :sim_id);";
         $query = $connection->prepare($sql);
         $query->bindParam(':user_name', $user->Name, PDO::PARAM_STR);
         $password = hash('sha256', $user->Password);
         $query->bindParam(':user_password', $password, PDO::PARAM_STR);
         $query->bindParam(':user_dt_created', $dateTime, PDO::PARAM_STR);
         $query->bindParam(':user_dt_expired', $user->DtExpired, PDO::PARAM_STR);
         // $query->bindParam(':e_privilege_id', $user->Privilege, PDO::PARAM_INT);
         // $query->bindParam(':e_status_id', $user->Status, PDO::PARAM_INT);
         // $query->bindParam(':company_id', $user->Company, PDO::PARAM_INT);
         // $query->bindParam(':sim_id', $user->Sim, PDO::PARAM_INT);
         $query->bindParam(':e_privilege_id', $user->Privilege->Id, PDO::PARAM_INT);
         $query->bindParam(':e_status_id', $user->Status->Id, PDO::PARAM_INT);
         $query->bindParam(':company_id', $user->Company->Id, PDO::PARAM_INT);
         $query->bindParam(':sim_id', $user->Sim->Id, PDO::PARAM_INT);
         $query->execute();
         $result = new Result();
         $result->Status = Result::INSERTED;
         $result->Id = (int) $connection->lastInsertId();
         $result->Message = 'Done';
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:38,代码来源:user.php

示例5: insert

 public static function insert()
 {
     $connection = Flight::dbMain();
     $dateTime = Flight::dateTime();
     try {
         $sim = json_decode(file_get_contents("php://input"));
         if ($sim == null) {
             throw new Exception(json_get_error());
         }
         $sql = "\n\t\t\tINSERT INTO sim \n\t\t\t(sim_imei, sim_number, sim_roaming,  e_sim_vendor_id, e_status_id, sim_dt_created, company_id)\n\t\t\tVALUES\n\t\t\t(:sim_imei, :sim_number, :sim_roaming, :e_sim_vendor_id, :e_status_id, :sim_dt_created, :company_id);";
         $query = $connection->prepare($sql);
         $query->bindParam(':sim_imei', $sim->Imei, PDO::PARAM_STR);
         $query->bindParam(':sim_number', $sim->Number, PDO::PARAM_STR);
         $query->bindParam(':sim_roaming', $sim->Roaming, PDO::PARAM_BOOL);
         $query->bindParam(':e_sim_vendor_id', $sim->SimVendor->Id, PDO::PARAM_INT);
         $query->bindParam(':e_status_id', $sim->Status->Id, PDO::PARAM_INT);
         $query->bindParam(':sim_dt_created', $dateTime, PDO::PARAM_STR);
         $query->bindParam(':company_id', $sim->Company->Id, PDO::PARAM_INT);
         $query->execute();
         $result = new Result();
         $result->Status = Result::INSERTED;
         $result->Id = (int) $connection->lastInsertId();
         $result->Message = 'Done';
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:32,代码来源:sim.php

示例6: insert

 public static function insert()
 {
     $connection = Flight::dbMain();
     $dateTime = Flight::dateTime();
     try {
         $vehicle = json_decode(file_get_contents("php://input"));
         if ($vehicle == null) {
             throw new Exception(json_get_error());
         }
         $sql = "\n\t\t\tINSERT INTO vehicle \n\t\t\t(\n\t\t\tvehicle_dt_created,\n\t\t\tvehicle_dt_subscribed, \n\t\t\tvehicle_plate, \n\t\t\tvehicle_ma_initial, \n\t\t\tvehicle_ma_limit, \n\t\t\tvehicle_ma_maintenance, \n\t\t\tvehicle_speed_max, \n\t\t\te_status_id, \n\t\t\tvehicle_name, \n\t\t\tvehicle_model,\n\t\t\tvehicle_fuel_max, \n\t\t\tdriver_id,\n\t\t\tunit_id, \n\t\t\tcompany_id,\n\t\t\te_trackee_type_id\n\t\t\t)\n\t\t\t\n\t\t\tVALUES\n\t\t\t(\n\t\t\t:vehicle_dt_created,\n\t\t\t:vehicle_dt_subscribed, \n\t\t\t:vehicle_plate, \n\t\t\t:vehicle_ma_initial, \n\t\t\t:vehicle_ma_limit, \n\t\t\t:vehicle_ma_maintenance, \n\t\t\t:vehicle_speed_max, \n\t\t\t:e_status_id, \n\t\t\t:vehicle_name, \n\t\t\t:vehicle_model,\n\t\t\t:vehicle_fuel_max, \n\t\t\t:driver_id,\n\t\t\t:unit_id, \n\t\t\t:company_id,\n\t\t\t:e_trackee_type_id\n\t\t\t);";
         $query = $connection->prepare($sql);
         $query->bindParam(':vehicle_dt_created', $dateTime, PDO::PARAM_STR);
         $query->bindParam(':vehicle_dt_subscribed', $vehicle->DtSubscribed, PDO::PARAM_STR);
         $query->bindParam(':vehicle_plate', $vehicle->Plate, PDO::PARAM_STR);
         $query->bindParam(':vehicle_ma_initial', $vehicle->MaInitial, PDO::PARAM_INT);
         $query->bindParam(':vehicle_ma_limit', $vehicle->MaLimit, PDO::PARAM_INT);
         $query->bindParam(':vehicle_ma_maintenance', $vehicle->MaMaintenance, PDO::PARAM_INT);
         $query->bindParam(':vehicle_speed_max', $vehicle->SpeedMax, PDO::PARAM_INT);
         $query->bindParam(':e_status_id', $vehicle->Status->Id, PDO::PARAM_INT);
         $query->bindParam(':vehicle_name', $vehicle->Name, PDO::PARAM_STR);
         $query->bindParam(':vehicle_model', $vehicle->Model, PDO::PARAM_STR);
         $query->bindParam(':vehicle_fuel_max', $vehicle->FuelMax, PDO::PARAM_INT);
         $query->bindParam(':driver_id', $vehicle->Driver->Id, PDO::PARAM_INT);
         $query->bindParam(':unit_id', $vehicle->Unit->Id, PDO::PARAM_INT);
         $query->bindParam(':company_id', $vehicle->Company->Id, PDO::PARAM_INT);
         $query->bindParam(':e_trackee_type_id', $vehicle->TrackeeType->Id, PDO::PARAM_INT);
         $query->execute();
         $result = new Result();
         $result->Status = Result::INSERTED;
         $result->Id = $connection->lastInsertId();
         $result->Message = 'Done';
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:40,代码来源:vehicle.php


注:本文中的Flight::dateTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。