国际表单路径fix

hotfix/paypal-note
LMR 2 years ago
parent b7509b2dc1
commit 6288defd11

@ -13,23 +13,22 @@ class Index extends CI_Controller
//private $logstore = 'globalhoghlights'; //private $logstore = 'globalhoghlights';
private $token = ""; private $token = "";
private $Log_Client; private $Log_Client;
private $logstore=array('cht'=>'globalhoghlights' private $logstore = array('cht' => 'globalhoghlights'
,'ah'=>'asiahighlights' , 'ah' => 'asiahighlights'
,'gh'=>'globalhighlights' , 'gh' => 'globalhighlights'
,'ct'=>'chinatravel' , 'ct' => 'chinatravel'
,'yz'=>'yangtzeriver' , 'yz' => 'yangtzeriver'
,'gl'=>'guilinchina' , 'gl' => 'guilinchina'
,'sht'=>'shanghaihighlights' , 'sht' => 'shanghaihighlights'
,'gm'=>'chinarundreisen' , 'gm' => 'chinarundreisen'
,'jp'=>'arachina' , 'jp' => 'arachina'
,'ru'=>'chinahighlights_ru' , 'ru' => 'chinahighlights_ru'
,'it'=>'viaggio-in-cina' , 'it' => 'viaggio-in-cina'
,'vac'=>'viaje-a-china' , 'vac' => 'viaje-a-china'
,'vc'=>'voyageschine' , 'vc' => 'voyageschine',
);//站点日志存储库,每个网站对应一个 ); //站点日志存储库,每个网站对应一个
public function __construct()
function __construct()
{ {
parent::__construct(); parent::__construct();
$this->load->model('wwwlogs_model'); $this->load->model('wwwlogs_model');
@ -39,25 +38,26 @@ class Index extends CI_Controller
public function index() public function index()
{ {
$data=array(); $data = array();
$orders=$this->wwwlogs_model->get_update_list(10); $orders = $this->wwwlogs_model->get_update_list(10);
if($orders){ if ($orders) {
foreach ($orders as $item){ foreach ($orders as $item) {
$this->orders_view_path($item->COLI_SN,strtolower($item->COLI_WebCode),$item->COLI_SenderIP); $this->orders_view_path($item->COLI_SN, strtolower($item->COLI_WebCode), $item->COLI_SenderIP);
echo 'COLI_WebCode:'.$item->COLI_WebCode.' COLI_ID:'.$item->COLI_ID.' COLI_SenderIP:'.$item->COLI_SenderIP.'<br/>'; echo 'COLI_WebCode:' . $item->COLI_WebCode . ' COLI_ID:' . $item->COLI_ID . ' COLI_SenderIP:' . $item->COLI_SenderIP . '<br/>';
} }
} }
$this->load->view('welcome'); $this->load->view('welcome');
} }
//定时抓取订单日志 //定时抓取订单日志
public function orders_view_path($COLI_SN,$sitecode='cht',$ip,$offset=0){ public function orders_view_path($COLI_SN, $sitecode = 'cht', $ip, $offset = 0)
$query_string=" {
$query_string = "
* | select time_local,http_referer,request_uri,http_user_agent,http_x_forwarded_for * | select time_local,http_referer,request_uri,http_user_agent,http_x_forwarded_for
remote_addr,request_method,request_time,status,body_bytes_sent,upstream_response_time from log where remote_addr,request_method,request_time,status,body_bytes_sent,upstream_response_time from log where
request_uri NOT like '%.jpg' request_uri NOT like '%.jpg'
and request_uri NOT like '%.JPG' and request_uri NOT like '%.JPG'
and request_uri NOT like '%.png' and request_uri NOT like '%.png'
and request_uri NOT like '%.gif' and request_uri NOT like '%.gif'
and request_uri NOT like '%.css' and request_uri NOT like '%.css'
and request_uri NOT like '%.webp' and request_uri NOT like '%.webp'
@ -74,55 +74,54 @@ class Index extends CI_Controller
and request_uri NOT like '/public/template/footer.html' and request_uri NOT like '/public/template/footer.html'
and request_uri NOT like '/public/%' and request_uri NOT like '/public/%'
and (remote_addr='$ip' OR http_x_forwarded_for like '%$ip%') and (remote_addr='$ip' OR http_x_forwarded_for like '%$ip%')
";//ORDER BY time_local ASC 时间精度不够,会导致相同排序错误,只能用系统默认排序 "; //ORDER BY time_local ASC 时间精度不够,会导致相同排序错误,只能用系统默认排序
/* /*
remote_addr :'23.99.99.139' remote_addr :'23.99.99.139'
AND NOT request_uri :"/secureforms/form_token" AND NOT request_uri :"/secureforms/form_token"
AND NOT request_uri :".jpg" AND NOT request_uri :".jpg"
AND NOT request_uri :".png" AND NOT request_uri :".png"
AND NOT request_uri :".gif" AND NOT request_uri :".gif"
AND NOT request_uri :"guide-use.php" AND NOT request_uri :"guide-use.php"
AND NOT request_uri : "/index.php" AND NOT request_uri : "/index.php"
and remote_addr='$ip' and remote_addr='$ip'
*/ */
$from = time()-604800;//往前 604800(7天), 1296000(15天) $from = time() - 604800; //往前 604800(7天), 1296000(15天)
$to = time(); $to = time();
$request = new Aliyun_Log_Models_GetLogsRequest('globalhoghlights', $this->logstore[$sitecode], $from, $to, '', $query_string, 100, $offset, true); $request = new Aliyun_Log_Models_GetLogsRequest('globalhoghlights', $this->logstore[$sitecode], $from, $to, '', $query_string, 100, $offset, true);
try { try {
$LogData = new StdClass; $LogData = new StdClass;
$LogData->wl_sitecode=$sitecode; $LogData->wl_sitecode = $sitecode;
$LogData->wl_COLI_SN=$COLI_SN;//订单SN $LogData->wl_COLI_SN = $COLI_SN; //订单SN
$response = $this->Log_Client->getLogs($request); $response = $this->Log_Client->getLogs($request);
foreach ($response -> getLogs() as $log) { foreach ($response->getLogs() as $log) {
foreach ($log -> getContents() as $key => $value) { foreach ($log->getContents() as $key => $value) {
$LogData->$key=$value; $LogData->$key = $value;
} }
$this->wwwlogs_model->add('wwwlogs',$LogData); $this->wwwlogs_model->add('wwwlogs', $LogData);
} }
} catch (Aliyun_Log_Exception $ex) { } catch (Aliyun_Log_Exception $ex) {
print_r($ex); print_r($ex);
} catch (Exception $ex) { } catch (Exception $ex) {
print_r($ex); print_r($ex);
} }
} }
public function getLogs(Aliyun_Log_Client $client, $project, $logstore) public function getLogs(Aliyun_Log_Client $client, $project, $logstore)
{ {
$topic = ''; $topic = '';
$from = time()-604800;//往前7天 $from = time() - 604800; //往前7天
$to = time(); $to = time();
$request = new Aliyun_Log_Models_GetLogsRequest($project, $logstore, $from, $to, $topic, "", 100, 0, false); $request = new Aliyun_Log_Models_GetLogsRequest($project, $logstore, $from, $to, $topic, "", 100, 0, false);
try { try {
$response = $client->getLogs($request); $response = $client->getLogs($request);
foreach ($response -> getLogs() as $log) { foreach ($response->getLogs() as $log) {
print $log -> getTime()."\t"; print $log->getTime() . "\t";
foreach ($log -> getContents() as $key => $value) { foreach ($log->getContents() as $key => $value) {
print $key.":".$value."\t"; print $key . ":" . $value . "\t";
} }
print "\n"; print "\n";
} }
} catch (Aliyun_Log_Exception $ex) { } catch (Aliyun_Log_Exception $ex) {
logVarDump($ex); logVarDump($ex);
} catch (Exception $ex) { } catch (Exception $ex) {

Loading…
Cancel
Save