Batch 6a: application controllers base
This commit is contained in:
49
application/controllers/debug/Outgoingref_v2.php
Normal file
49
application/controllers/debug/Outgoingref_v2.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user