diff --git a/application/controllers/keyworlds.php b/application/controllers/keyworlds.php index 099945ad..a6b7108c 100644 --- a/application/controllers/keyworlds.php +++ b/application/controllers/keyworlds.php @@ -341,10 +341,10 @@ class Keyworlds extends CI_Controller { // rank 变化 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) != "") { + $last_rank_pc = $this->Keywordsrank_model->get_last_pc_rank($kw_id, 2); + if (trim($last_rank_pc[1]->kwr_rank) != "") { $this->load->model('InfoSMS_model'); - $last_rank_pc = isset($last_rank_pc[0]) ? $last_rank_pc[0]->kwr_rank : $rank['rank']; + $last_rank_pc = isset($last_rank_pc[1]) ? $last_rank_pc[1]->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)); } @@ -429,10 +429,10 @@ class Keyworlds extends CI_Controller { // rank 变化 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) != "") { + $last_rank_pc = $this->Keywordsrank_model->get_last_pc_rank($v->kw_id, 2); + if (trim($last_rank_pc[1]->kwr_rank) != "") { $this->load->model('InfoSMS_model'); - $last_rank_pc = isset($last_rank_pc[0]) ? $last_rank_pc[0]->kwr_rank : $rank['rank']; + $last_rank_pc = isset($last_rank_pc[1]) ? $last_rank_pc[1]->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)); } diff --git a/application/models/infokeywordsrank_model.php b/application/models/infokeywordsrank_model.php index df0c8039..7c4e31c2 100644 --- a/application/models/infokeywordsrank_model.php +++ b/application/models/infokeywordsrank_model.php @@ -64,7 +64,7 @@ class infoKeywordsrank_model extends CI_Model } public function get_last_pc_rank($kw_id_string, $top=1) { - $sql = "SELECT top 2 kwr_id, + $sql = "SELECT top $top kwr_id, kwr_kw_id, kwr_rank, kwr_mobile_rank,