|
|
|
@ -101,10 +101,12 @@ class Keyworlds extends CI_Controller {
|
|
|
|
|
// 每条线
|
|
|
|
|
$data['rank_json'] .='{"name":"' . $ra[$data_time[0]]->kw_keyworlds . '","data":[';
|
|
|
|
|
// 每个点
|
|
|
|
|
$tmp_rank = "";
|
|
|
|
|
foreach ($ra as $v) {
|
|
|
|
|
$kwr_rank = (intval($v->kwr_rank) > 0) ? $v->kwr_rank : "null";
|
|
|
|
|
$kwr_rank = ($v->kwr_rank==151) ? "null" : $v->kwr_rank;
|
|
|
|
|
$kwr_rank = trim($kwr_rank)=="" ? "null" : $kwr_rank;
|
|
|
|
|
$tmp_rank = $v->kwr_rank;
|
|
|
|
|
$kwr_rank = intval(trim($v->kwr_rank))>0 ? $v->kwr_rank : "null";
|
|
|
|
|
$kwr_rank = ($v->kwr_rank==151) ? "null" : $tmp_rank;
|
|
|
|
|
// $kwr_rank = trim($kwr_rank)=="" ? $tmp_rank : $kwr_rank;
|
|
|
|
|
if ($v->kwr_rank == '>150') {
|
|
|
|
|
$kwr_rank = 100;
|
|
|
|
|
}
|
|
|
|
@ -337,12 +339,15 @@ class Keyworlds extends CI_Controller {
|
|
|
|
|
$add = $this->Keywordsrank_model->add_rank($kw_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines']);
|
|
|
|
|
}
|
|
|
|
|
// rank 变化
|
|
|
|
|
if ($client_flag === 'PC' && trim($last_rank[0]->kwr_rank) != "") {
|
|
|
|
|
$this->load->model('InfoSMS_model');
|
|
|
|
|
$last_rank_pc = isset($last_rank[0]) ? $last_rank[0]->kwr_rank : $rank['rank'];
|
|
|
|
|
$this->InfoSMS_model->readed_for_info($kw_id, 'keywords_rank');
|
|
|
|
|
$this->InfoSMS_model->add('keywords_rank', $kw_id, $rank['rank'], $last_rank_pc, (string) ($rank['rank'] - $last_rank_pc));
|
|
|
|
|
if ($client_flag === 'PC') {
|
|
|
|
|
$this->Keywords_model->update_time($kw_id);
|
|
|
|
|
$last_rank_pc = $this->Keywordsrank_model->get_last_pc_rank($kw_id);
|
|
|
|
|
if (trim($last_rank_pc[0]->kwr_rank) != "") {
|
|
|
|
|
$this->load->model('InfoSMS_model');
|
|
|
|
|
$last_rank_pc = isset($last_rank_pc[0]) ? $last_rank_pc[0]->kwr_rank : $rank['rank'];
|
|
|
|
|
$this->InfoSMS_model->readed_for_info($kw_id, 'keywords_rank');
|
|
|
|
|
$this->InfoSMS_model->add('keywords_rank', $kw_id, $rank['rank'], $last_rank_pc, (string) ($rank['rank'] - $last_rank_pc));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
echo json_encode($data);
|
|
|
|
|
return TRUE;
|
|
|
|
@ -376,7 +381,6 @@ class Keyworlds extends CI_Controller {
|
|
|
|
|
$rank_flag = 'rank_m';
|
|
|
|
|
$source_flag = 'source_m';
|
|
|
|
|
}
|
|
|
|
|
$last_rank_pc = $this->Keywordsrank_model->get_rank_list($worldsList[0]->kw_id);
|
|
|
|
|
|
|
|
|
|
$today_0 = strtotime(date('Ymd000000'));
|
|
|
|
|
$today_24 = strtotime(date('Ymd235959'));
|
|
|
|
@ -423,13 +427,14 @@ class Keyworlds extends CI_Controller {
|
|
|
|
|
$add = $this->Keywordsrank_model->add_rank($v->kw_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines']);
|
|
|
|
|
}
|
|
|
|
|
// rank 变化
|
|
|
|
|
if ($client_flag === 'PC' && trim($last_rank_pc[0]->kwr_rank) != "") {
|
|
|
|
|
$this->load->model('InfoSMS_model');
|
|
|
|
|
$last_rank_pc = isset($last_rank_pc[0]) ? $last_rank_pc[0]->kwr_rank : $rank['rank'];
|
|
|
|
|
$this->InfoSMS_model->readed_for_info($v->kw_id, 'keywords_rank');
|
|
|
|
|
$this->InfoSMS_model->add('keywords_rank', $v->kw_id, $rank['rank'], $last_rank_pc, (string) ($rank['rank'] - $last_rank_pc));
|
|
|
|
|
if ($engines != 'yandex') {
|
|
|
|
|
$this->Keywords_model->update_time($v->kw_id);
|
|
|
|
|
if ($client_flag === 'PC') {
|
|
|
|
|
$this->Keywords_model->update_time($v->kw_id);
|
|
|
|
|
$last_rank_pc = $this->Keywordsrank_model->get_last_pc_rank($v->kw_id);
|
|
|
|
|
if (trim($last_rank_pc[0]->kwr_rank) != "") {
|
|
|
|
|
$this->load->model('InfoSMS_model');
|
|
|
|
|
$last_rank_pc = isset($last_rank_pc[0]) ? $last_rank_pc[0]->kwr_rank : $rank['rank'];
|
|
|
|
|
$this->InfoSMS_model->readed_for_info($v->kw_id, 'keywords_rank');
|
|
|
|
|
$this->InfoSMS_model->add('keywords_rank', $v->kw_id, $rank['rank'], $last_rank_pc, (string) ($rank['rank'] - $last_rank_pc));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -728,4 +733,30 @@ class Keyworlds extends CI_Controller {
|
|
|
|
|
var_dump($rank_info);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testpc()
|
|
|
|
|
{
|
|
|
|
|
$last_rank_pc = $this->Keywordsrank_model->get_last_pc_rank('297');
|
|
|
|
|
var_dump($last_rank_pc);
|
|
|
|
|
var_dump($last_rank_pc[0]->kwr_rank);
|
|
|
|
|
var_dump(trim($last_rank_pc[0]->kwr_rank));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function test_next($fix_site_code='', $client_flag = 'PC')
|
|
|
|
|
{
|
|
|
|
|
if ($client_flag == 'PC') {
|
|
|
|
|
$worldsList = $this->Keywords_model->get_keyworld_list_old(1, 'en', $fix_site_code);
|
|
|
|
|
}
|
|
|
|
|
if (empty($worldsList) || $client_flag === 'm') {
|
|
|
|
|
$worldsList = $this->Keywords_model->get_keyworld_list(1, 'en', $fix_site_code);
|
|
|
|
|
// 如果没有需要更新的则返回
|
|
|
|
|
if (empty($worldsList)) {
|
|
|
|
|
echo 'all done';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$client_flag = "m";
|
|
|
|
|
}
|
|
|
|
|
var_dump($client_flag);
|
|
|
|
|
var_dump($worldsList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|