keyword 更新时间; 图标为null时取上一个值

hotfix/远程访问多媒体中心
lyt 8 years ago
parent b7cbdaca37
commit c500df1f2a

@ -101,10 +101,12 @@ class Keyworlds extends CI_Controller {
// 每条线 // 每条线
$data['rank_json'] .='{"name":"' . $ra[$data_time[0]]->kw_keyworlds . '","data":['; $data['rank_json'] .='{"name":"' . $ra[$data_time[0]]->kw_keyworlds . '","data":[';
// 每个点 // 每个点
$tmp_rank = "";
foreach ($ra as $v) { foreach ($ra as $v) {
$kwr_rank = (intval($v->kwr_rank) > 0) ? $v->kwr_rank : "null"; $tmp_rank = $v->kwr_rank;
$kwr_rank = ($v->kwr_rank==151) ? "null" : $v->kwr_rank; $kwr_rank = intval(trim($v->kwr_rank))>0 ? $v->kwr_rank : "null";
$kwr_rank = trim($kwr_rank)=="" ? "null" : $kwr_rank; $kwr_rank = ($v->kwr_rank==151) ? "null" : $tmp_rank;
// $kwr_rank = trim($kwr_rank)=="" ? $tmp_rank : $kwr_rank;
if ($v->kwr_rank == '>150') { if ($v->kwr_rank == '>150') {
$kwr_rank = 100; $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']); $add = $this->Keywordsrank_model->add_rank($kw_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines']);
} }
// rank 变化 // rank 变化
if ($client_flag === 'PC' && trim($last_rank[0]->kwr_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) != "") {
$this->load->model('InfoSMS_model'); $this->load->model('InfoSMS_model');
$last_rank_pc = isset($last_rank[0]) ? $last_rank[0]->kwr_rank : $rank['rank']; $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->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)); $this->InfoSMS_model->add('keywords_rank', $kw_id, $rank['rank'], $last_rank_pc, (string) ($rank['rank'] - $last_rank_pc));
$this->Keywords_model->update_time($kw_id); }
} }
echo json_encode($data); echo json_encode($data);
return TRUE; return TRUE;
@ -376,7 +381,6 @@ class Keyworlds extends CI_Controller {
$rank_flag = 'rank_m'; $rank_flag = 'rank_m';
$source_flag = 'source_m'; $source_flag = 'source_m';
} }
$last_rank_pc = $this->Keywordsrank_model->get_rank_list($worldsList[0]->kw_id);
$today_0 = strtotime(date('Ymd000000')); $today_0 = strtotime(date('Ymd000000'));
$today_24 = strtotime(date('Ymd235959')); $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']); $add = $this->Keywordsrank_model->add_rank($v->kw_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines']);
} }
// rank 变化 // rank 变化
if ($client_flag === 'PC' && trim($last_rank_pc[0]->kwr_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) != "") {
$this->load->model('InfoSMS_model'); $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[0]) ? $last_rank_pc[0]->kwr_rank : $rank['rank'];
$this->InfoSMS_model->readed_for_info($v->kw_id, 'keywords_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)); $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);
} }
} }
} }
@ -728,4 +733,30 @@ class Keyworlds extends CI_Controller {
var_dump($rank_info); 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);
}
} }

@ -62,6 +62,24 @@ class infoKeywordsrank_model extends CI_Model
$query = $this->HT->query($sql); $query = $this->HT->query($sql);
return $query->result(); return $query->result();
} }
public function get_last_pc_rank($kw_id_string, $top=1)
{
$sql = "SELECT top 2 kwr_id,
kwr_kw_id,
kwr_rank,
kwr_mobile_rank,
kwr_source,
kwr_mobile_source,
kwr_engines,
kwr_datetime
FROM infoKeywordsrank
WHERE 1=1
and kwr_kw_id in ($kw_id_string)
and kwr_rank > 0
ORDER BY kwr_id DESC ";
$query = $this->HT->query($sql);
return $query->result();
}
//删除指定关键词的所有排名 //删除指定关键词的所有排名
public function delete($kw_id) public function delete($kw_id)

@ -43,7 +43,7 @@
<div id="zhexiantu" class="span12" style="height:<?php if($wordcount==1) {echo '620px';}else{echo '1000px;';} ?>;margin-left:0;padding-right: 15px;"></div> <div id="zhexiantu" class="span12" style="height:<?php if($wordcount==1) {echo '620px';}else{echo '1000px;';} ?>;margin-left:0;padding-right: 15px;"></div>
<?php } if (!empty($rank_info)) { ?> <?php } if (!empty($rank_info)) { ?>
<legend>排名情况</legend> <legend>排名情况</legend>
<!-- update time ? --> <!-- update time 2 -->
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>

Loading…
Cancel
Save