瀏覽代碼

add ticket_type == 3

station_14109
altob.rd 8 年之前
父節點
當前提交
e9ab438846
共有 3 個文件被更改,包括 72 次插入14 次删除
  1. +7
    -14
      controllers/Cars.php
  2. +41
    -0
      models/Cars_model.php
  3. +24
    -0
      phplibs/Altob.Sync.Integration.php

+ 7
- 14
controllers/Cars.php 查看文件

@@ -44,20 +44,13 @@ class Cars extends CI_Controller
ignore_user_abort(); // 接受client斷線, 繼續run
$method_name = $this->router->fetch_method();
if ($method_name == 'ipcam' || $method_name == 'check_lpr_etag')
{
ob_end_clean();
ignore_user_abort();
ob_start();
echo 'ok';
header('Connection: close');
header('Content-Length: ' . ob_get_length());
ob_end_flush();
flush();
}
else if($method_name == 'opendoor' || $method_name == 'temp_opendoors' || $method_name == 'member_opendoors')
if(in_array($method_name, array(
'ipcam', 'ipcam_meta',
'check_lpr_etag',
'opendoor',
'temp_opendoors', 'member_opendoors'
)))
{
ob_end_clean();
ignore_user_abort();


+ 41
- 0
models/Cars_model.php 查看文件

@@ -29,6 +29,47 @@ class Cars_model extends CI_Model
public function ipcam_meta($parms)
{
trigger_error(__FUNCTION__ . '|特殊註記:' . print_r($parms, true));
if($parms['token'] != 1)
{
trigger_error(__FUNCTION__ . '|未定義|' . print_r($parms, true));
return false;
}
// 讀取最近一筆入場資料
$rows_cario = $this->db->select('cario_no, obj_id, in_time, out_before_time')
->from('cario')
->where(array(
'station_no' => $parms['sno'],
'obj_id' => $parms['lpr'],
'err' => 0
))
->order_by('cario_no', 'desc')
->limit(1)
->get()
->row_array();
if (!isset($rows_cario['cario_no']))
{
trigger_error(__FUNCTION__ . '|查無入場記錄|' . print_r($parms, true));
return false;
}
// 更新入場記錄
$data = array('ticket_type' => 3);
$this->db->update('cario', $data, array('cario_no' => $rows_cario['cario_no']));
trigger_error(__FUNCTION__ . '|悠遊卡離場,更新入場記錄|');
$affect_rows = $this->db->affected_rows();
if ($affect_rows > 0)
{
// 傳送更新記錄
$sync_agent = new AltobSyncAgent();
$sync_agent->init($parms['sno'], $this->now_str);
$sync_agent->cario_no = $rows_cario['cario_no']; // 進出編號
$sync_result = $sync_agent->sync_st_io_meta($data);
trigger_error( __FUNCTION__ . "..sync_st_io_meta.." . $sync_result);
}
}
// 車輛進出傳入車牌號碼 (2016/07/27)


+ 24
- 0
phplibs/Altob.Sync.Integration.php 查看文件

@@ -158,6 +158,30 @@ class AltobSyncAgent
return $oService->ServerPost($this->post_parms);
}
// 傳送進出更新記錄
public function sync_st_io_meta($meta)
{
$error_parms_msg = $this->check_init_parms();
if(!empty($error_parms_msg)) { return $error_parms_msg; }
if(empty($meta))
return 'meta not found';
if(empty($this->cario_no))
return 'cario_no not found';
$this->post_parms['meta'] = $meta; // 需設定
$this->post_parms['cario_no'] = $this->cario_no; // 需設定
// 初始化網路服務物件。
$oService = new AltobSyncService();
$oService->ServiceURL = AltobSyncAgent::SYNC_CARS_URL;
$oService->ServiceCMD = 'st_io_meta';
// 傳遞參數至遠端。
return $oService->ServerPost($this->post_parms);
}
// ===============================================
// SOS
// ===============================================


Loading…
取消
儲存