|
|
|
@ -21,10 +21,15 @@ class Index extends CI_Controller
|
|
|
|
|
, 'gl' => 'guilinchina'
|
|
|
|
|
, 'sht' => 'shanghaihighlights'
|
|
|
|
|
, 'gm' => 'chinarundreisen'
|
|
|
|
|
, 'gmhw' => 'chinarundreisen'
|
|
|
|
|
, 'jp' => 'arachina'
|
|
|
|
|
, 'jphw' => 'arachina'
|
|
|
|
|
, 'ru' => 'chinahighlights_ru'
|
|
|
|
|
, 'ruhw' => 'chinahighlights_ru'
|
|
|
|
|
, 'it' => 'viaggio-in-cina'
|
|
|
|
|
, 'ithw' => 'viaggio-in-cina'
|
|
|
|
|
, 'vac' => 'viaje-a-china'
|
|
|
|
|
, 'vachw' => 'viaje-a-china'
|
|
|
|
|
, 'vc' => 'voyageschine'
|
|
|
|
|
, 'vchw' => 'voyageschine',
|
|
|
|
|
); //站点日志存储库,每个网站对应一个
|
|
|
|
@ -43,7 +48,13 @@ class Index extends CI_Controller
|
|
|
|
|
$orders = $this->wwwlogs_model->get_update_list(10);
|
|
|
|
|
if ($orders) {
|
|
|
|
|
foreach ($orders as $item) {
|
|
|
|
|
$this->orders_view_path($item->COLI_SN, strtolower($item->COLI_WebCode), $item->COLI_SenderIP);
|
|
|
|
|
$site_code = strtolower($item->COLI_WebCode);
|
|
|
|
|
if (in_array($site_code, array('gm', 'gmhw', 'jp', 'jphw', 'ru', 'ruhw', 'it', 'ithw', 'vac', 'vachw', 'vc', 'vchw'))) {
|
|
|
|
|
print_r($item);die();
|
|
|
|
|
$this->orders_view_path_int($item->COLI_SN, $site_code, $item->COLI_SenderIP);
|
|
|
|
|
} else {
|
|
|
|
|
$this->orders_view_path($item->COLI_SN, $site_code, $item->COLI_SenderIP);
|
|
|
|
|
}
|
|
|
|
|
echo 'COLI_WebCode:' . $item->COLI_WebCode . ' COLI_ID:' . $item->COLI_ID . ' COLI_SenderIP:' . $item->COLI_SenderIP . '<br/>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -116,38 +127,23 @@ class Index extends CI_Controller
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//定时抓取订单日志 - 国际站
|
|
|
|
|
public function orders_view_path_int( /*$COLI_SN, $sitecode = 'cht', $ip, $offset = 0*/)
|
|
|
|
|
public function orders_view_path_int($COLI_SN, $sitecode = 'cht', $ip, $offset = 0)
|
|
|
|
|
{
|
|
|
|
|
// 测试数据 - 2
|
|
|
|
|
$COLI_SN = 1004250;
|
|
|
|
|
$sitecode = 'vchw';
|
|
|
|
|
$ip = '2a01:cb1c:8190:df00:dc11:12fb:3ed1:1bcb';
|
|
|
|
|
$offset = 0;
|
|
|
|
|
// $COLI_SN = 1004250;
|
|
|
|
|
// $sitecode = 'gmhw';
|
|
|
|
|
// $ip = '2a00:6020:41c7:3900:20c1:3c5c:c854:7095';
|
|
|
|
|
// $client_id = '1682234553117123196';
|
|
|
|
|
// $offset = 0;
|
|
|
|
|
|
|
|
|
|
$query_string = "
|
|
|
|
|
* | 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
|
|
|
|
|
request_uri NOT like '%.jpg'
|
|
|
|
|
and request_uri NOT like '%.JPG'
|
|
|
|
|
and request_uri NOT like '%.png'
|
|
|
|
|
and request_uri NOT like '%.gif'
|
|
|
|
|
and request_uri NOT like '%.css'
|
|
|
|
|
and request_uri NOT like '%.webp'
|
|
|
|
|
and request_uri NOT like '%.js'
|
|
|
|
|
and request_uri NOT like '%.woff'
|
|
|
|
|
and request_uri NOT like '%.ttf'
|
|
|
|
|
and request_uri NOT like '%.eot'
|
|
|
|
|
and request_uri NOT like '%.ico'
|
|
|
|
|
and request_uri NOT like '/guide-use.php%'
|
|
|
|
|
and request_uri NOT like '/index.php%'
|
|
|
|
|
and request_uri NOT like '/secureforms/form_token'
|
|
|
|
|
and request_uri NOT like '/ip/'
|
|
|
|
|
and request_uri NOT like '/ajax/getads/'
|
|
|
|
|
and request_uri NOT like '/public/template/footer.html'
|
|
|
|
|
and request_uri NOT like '/public/%'
|
|
|
|
|
and (remote_addr='$ip' OR http_x_forwarded_for like '%$ip%')
|
|
|
|
|
"; //ORDER BY time_local ASC 时间精度不够,会导致相同排序错误,只能用系统默认排序
|
|
|
|
|
$from = time() - 604800; //往前 604800(7天), 1296000(15天)
|
|
|
|
|
request_uri like '/io/?event=pageview%'
|
|
|
|
|
and (remote_addr='$ip' OR http_x_forwarded_for like '%$ip%' OR request_uri like '%$client_id%')
|
|
|
|
|
ORDER BY __time__ ASC
|
|
|
|
|
"; // 同时使用IP和用户ID
|
|
|
|
|
$from = time() - 604800 * 4; //往前 604800(7天), 1296000(15天)
|
|
|
|
|
$to = time();
|
|
|
|
|
$request = new Aliyun_Log_Models_GetLogsRequest('globalhoghlights', $this->logstore[$sitecode], $from, $to, '', $query_string, 100, $offset, true);
|
|
|
|
|
try {
|
|
|
|
@ -159,8 +155,27 @@ class Index extends CI_Controller
|
|
|
|
|
foreach ($log->getContents() as $key => $value) {
|
|
|
|
|
$LogData->$key = $value;
|
|
|
|
|
}
|
|
|
|
|
// $this->wwwlogs_model->add('wwwlogs', $LogData);
|
|
|
|
|
print_r($LogData);
|
|
|
|
|
|
|
|
|
|
// 调整数据: http_referer -> request_uri, request_uri.ref -> http_referer
|
|
|
|
|
if (isset($LogData->http_referer) && isset($LogData->request_uri)) {
|
|
|
|
|
$request_uri = $LogData->request_uri;
|
|
|
|
|
$http_referer = $LogData->http_referer;
|
|
|
|
|
|
|
|
|
|
// http_referer -> request_uri
|
|
|
|
|
$LogData->request_uri = $LogData->http_referer;
|
|
|
|
|
// request_uri.ref -> http_referer
|
|
|
|
|
$query_string_tmp = urldecode($request_uri);
|
|
|
|
|
parse_str($query_string_tmp, $params);
|
|
|
|
|
if (isset($params['ref'])) {
|
|
|
|
|
$LogData->http_referer = $params['ref'];
|
|
|
|
|
} else {
|
|
|
|
|
$LogData->http_referer = '(not set)';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// print_r($LogData);
|
|
|
|
|
$this->wwwlogs_model->add('wwwlogs', $LogData);
|
|
|
|
|
}
|
|
|
|
|
} catch (Aliyun_Log_Exception $ex) {
|
|
|
|
|
print_r($ex);
|
|
|
|
|