From f6e2383ec17b57334f2d1664ad10aa0d7e775b11 Mon Sep 17 00:00:00 2001 From: lyt Date: Mon, 30 Oct 2017 13:51:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E9=94=AE=E8=AF=8D=20=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=80=92=E5=BA=8F;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/keyworlds.php | 19 +++++++++++-------- application/views/keyworlds/index.php | 4 ++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/application/controllers/keyworlds.php b/application/controllers/keyworlds.php index 1c6706db..4a0e7cbf 100644 --- a/application/controllers/keyworlds.php +++ b/application/controllers/keyworlds.php @@ -95,8 +95,6 @@ class Keyworlds extends CI_Controller { } } } -// print_r($data['wordcount']); -// print_r($rank_json); // 拼接highcharts数据格式 $data['rank_json'] = '['; foreach ($rank_json as &$ra) { @@ -134,10 +132,10 @@ class Keyworlds extends CI_Controller { } } $data['rank_json'] = substr($data['rank_json'], 0, -1) . ']'; -// print_r($data['rank_json']); $data['data_time'] = json_encode($data_time); $data['rank_info'] = ''; isset($rank_json[$data['current_keyworld']->kw_id]) && $data['rank_info'] = $rank_json[$data['current_keyworld']->kw_id]; + arsort($data['rank_info']); } } else { redirect(site_url("Keyworlds/index")); @@ -297,7 +295,7 @@ class Keyworlds extends CI_Controller { $j = $i; $rank = $this->$method($client_flag, $keyworlds, $site_url, $j, $site_code); // 仅更新一个字段 - if (intval($rank['rank']) == 0) { + if (intval($rank['rank']) === 0) { $rank['rank'] = $last_rank[0]->kwr_rank; $rank['source'] = $last_rank[0]->kwr_source; } else { @@ -327,7 +325,11 @@ class Keyworlds extends CI_Controller { $this->Keywords_model->update_time($kw_id); } } - $data[] = array('name' => 'rank', 'value' => ($rank['rank'] . " -- " . $rank["rank_m"])); + $data[] = array( + 'name' => 'rank', + 'value' => ($rank['rank'] . " / " . $rank["rank_m"]), + 'real' => $rank_flag . " : " . $rank[$rank_flag] + ); echo json_encode($data); return TRUE; } @@ -368,7 +370,8 @@ class Keyworlds extends CI_Controller { } else if ($engines == 'yandex') {//俄语站的yangdex $rank = $this->get_search_content_by_yandex($client_flag,$v->kw_keyworlds, $site_url, $i - 1); } - if (intval($rank['rank']) == 0) { + + if (intval($rank['rank']) === 0) { $rank['rank'] = $last_rank[0]->kwr_rank; $rank['source'] = $last_rank[0]->kwr_source; } else { @@ -648,8 +651,8 @@ class Keyworlds extends CI_Controller { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_USERAGENT, $useragent); - // curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME); - // curl_setopt($ch, CURLOPT_PROXY, "202.103.68.28:11111"); // 本地代理 + curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME); + curl_setopt($ch, CURLOPT_PROXY, "202.103.68.28:11111"); // 本地代理 if ($referer) { curl_setopt($ch, CURLOPT_REFERER, $referer); } diff --git a/application/views/keyworlds/index.php b/application/views/keyworlds/index.php index 0fb8187d..979c8b6b 100644 --- a/application/views/keyworlds/index.php +++ b/application/views/keyworlds/index.php @@ -62,8 +62,8 @@
kwr_mobile_source; ?> - kwr_rank; ?> --  - kwr_mobile_rank ? $rank->kwr_mobile_rank : '未抓取'; echo $kwr_mobile_rank; ?> + kwr_rank; ?>  /   + kwr_mobile_rank ? $rank->kwr_mobile_rank : '--'; echo $kwr_mobile_rank; ?>