50 lines
2.3 KiB
PHP
50 lines
2.3 KiB
PHP
<?php
|
|
class OutgoingRef_v2 extends MY_Controller
|
|
{
|
|
function __construct() {
|
|
parent::__construct();
|
|
$this->db = $this->load->database("onedev", true);
|
|
}
|
|
function debug($no) {
|
|
$sql = "select tx_branch_status.*, M_BranchName
|
|
from tx_branch_status
|
|
join m_branch on TxBranchStatusM_BranchID = M_BranchID
|
|
where TxBranchStatusID=?";
|
|
$qry = $this->db->query($sql,$no);
|
|
if ($qry) {
|
|
$rows = $qry->result_array();
|
|
foreach($rows as $r) {
|
|
$param = $r["TxBranchStatusJson"];
|
|
$stage = $r["TxBranchStatusStage"];
|
|
$ipAddress = $r["TxBranchStatusM_BranchIP"];
|
|
$branchName = $r["M_BranchName"];
|
|
$txID = $r["TxBranchStatusID"];
|
|
|
|
$url = "http://$ipAddress/one-api/tools/xstatusbranch_v2/update";
|
|
echo "URL: $url \n";
|
|
print_r($param);
|
|
//$rst = $this->post($url,$param);
|
|
}
|
|
} else {
|
|
$this->xlog("Err: " . print_r($this->db->error(),true));
|
|
}
|
|
}
|
|
function xlog($message) {
|
|
$dt = date("Y-m-d H:i:s");
|
|
echo "$dt $message\n";
|
|
}
|
|
function post($url,$data) {
|
|
$ch = curl_init($url);
|
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
//curl_setopt($ch, CURLOPT_VERBOSE, true);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
|
'Content-Type: application/json',
|
|
'Content-Length: ' . strlen($data))
|
|
);
|
|
$result = curl_exec($ch);
|
|
return json_decode($result,true);
|
|
}
|
|
}
|