diff --git a/.gitignore b/.gitignore index e721c211..c4ecb2c8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ /kcfinder/upload/* /kcfinder/cache/* */cache/* - +/author/document/* diff --git a/application/controllers/info_tags.php b/application/controllers/info_tags.php new file mode 100644 index 00000000..ff90be1e --- /dev/null +++ b/application/controllers/info_tags.php @@ -0,0 +1,144 @@ +permission->is_admin(); + //$this->output->enable_profiler(TRUE); + $this->load->model('Information_model'); + $this->load->model('InfoTags_model'); + } + + /** + * 添加标签 + */ + public function add_tag() + { + $this->InfoTags_model->it_title = $this->input->get_post('title'); + $this->InfoTags_model->it_memo = $this->input->get_post('memo'); + $return = $this->InfoTags_model->add_tag(); + if ($return) + { + echo(json_encode(array( + 'status' => 1, + 'message' => $return + ))); + } + else + { + echo(json_encode(array( + 'status' => -1, + 'message' => '添加标签失败' + ))); + } + } + + /** + * 删除标签 + */ + public function remove_tag() + { + $this->InfoTags_model->it_title = $this->input->get_post('title'); + $return = $this->InfoTags_model->remove_tag(); + if ($return == 'success') + { + echo(json_encode(array( + 'status' => 1, + 'message' => '删除标签成功' + ))); + } + else + { + echo(json_encode(array( + 'status' => -1, + 'message' => '删除标签失败' + ))); + } + } + + /** + * 展示标签 + */ + public function list_tag($ic_id = '') + { + $ic_id ? $this->InfoTags_model->ic_id = $ic_id : $this->InfoTags_model->ic_id = $this->input->post('ic_id'); + $return = $this->InfoTags_model->list_tag(); + if ($return != 'fail') + { + echo(json_encode(array( + 'status' => 1, + 'data' => $return + ))); + } + else + { + echo(json_encode(array( + 'status' => -1, + 'message' => '读出标签失败' + ))); + } + } + + /** + * 添加关联信息+标签 + */ + public function add_tag_to_content() + { + $this->InfoTags_model->ic_id = $this->input->get_post('ic_id'); + $this->InfoTags_model->it_id = $this->input->get_post('it_id'); + $return = $this->InfoTags_model->add_tag_to_content(); + if ($return == 'success') + { + echo(json_encode(array( + 'status' => 1, + 'message' => '关联信息标签成功' + ))); + } + else if ($return == 'exist') + { + echo(json_encode(array( + 'status' => 2, + 'message' => '关联信息标签已存在' + ))); + } + else + { + echo(json_encode(array( + 'status' => -1, + 'message' => '关联信息标签失败' + ))); + } + } + + /** + * 移除关联信息+标签 + */ + public function remove_tag_to_content() + { + $this->InfoTags_model->ic_id = $this->input->get_post('ic_id'); + $this->InfoTags_model->it_id = $this->input->get_post('it_id'); + $return = $this->InfoTags_model->remove_tag_to_content(); + if ($return == 'success') + { + echo(json_encode(array( + 'status' => 1, + 'message' => '移除关联信息标签成功' + ))); + } + else + { + echo(json_encode(array( + 'status' => -1, + 'message' => '移除关联信息标签失败' + ))); + } + } + +} + diff --git a/application/controllers/information.php b/application/controllers/information.php index 662f3639..b3885d40 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -20,6 +20,10 @@ class Information extends CI_Controller { $this->load->model('Infoauthors_model'); $this->load->model('InfoKeywordsanalytics_model', 'analytics_model'); $this->load->model('InfoSMS_model'); + + if (is_series_site()) { + $this->load->model('InfoTags_model'); + } $this->load->library('Accesscheck'); $this->accesscheck->check_access(); @@ -254,6 +258,29 @@ class Information extends CI_Controller { //所属导航栏目 $data['setting_website_nav'] = $this->InfoMetas_model->get_list(0, 'setting_website_nav_' . strtolower($this->config->item('site_code'))); + $data['my_tags'] = array(); + $data['all_tags'] = array(); + if (is_series_site()) { + //信息标签 + $this->InfoTags_model->ic_id = null; + $data['all_tags'] = $this->InfoTags_model->list_tag(); + $this->InfoTags_model->ic_id = $data['information']->ic_id; + $data['my_tags'] = $this->InfoTags_model->list_tag(); + //差集 + foreach ($data['all_tags'] as &$it) + { + foreach ($data['my_tags'] as $it2) + { + if ($it->it_id == $it2->icit_it_id) + { + $it = null; + break; + } + } + } + $data['all_tags'] = array_filter($data['all_tags']); + } + $this->load->view('bootstrap3/header', $data); $this->load->view('bootstrap3/information_edit'); $this->load->view('bootstrap3/footer'); diff --git a/application/controllers/keyworlds.php b/application/controllers/keyworlds.php index 1c6706db..61769f65 100644 --- a/application/controllers/keyworlds.php +++ b/application/controllers/keyworlds.php @@ -46,7 +46,6 @@ class Keyworlds extends CI_Controller { //查询当前关键词的排名情况 $data['rank_json'] = ''; $data['current_keyworld'] = $this->Keywords_model->get_keyworld_bytreeid($kw_is_id); - //如果是根目录,则展示最新关键词排名变化情况 if ($root_key) { $data['compare_rank'] = $this->Keywords_model->get_compare_rank($data['order']); @@ -95,8 +94,6 @@ class Keyworlds extends CI_Controller { } } } -// print_r($data['wordcount']); -// print_r($rank_json); // 拼接highcharts数据格式 $data['rank_json'] = '['; foreach ($rank_json as &$ra) { @@ -106,13 +103,10 @@ class Keyworlds extends CI_Controller { // 每个点 foreach ($ra as $v) { $kwr_rank = $v->kwr_rank; - if ($v->kwr_rank == '>150') + if ($v->kwr_rank == '>150') { $kwr_rank = 100; - if (strtolower($this->config->item('site_code')) == 'gm') { - $data['rank_json'] .=-$kwr_rank . ','; - } else { - $data['rank_json'] .=$kwr_rank . ','; } + $data['rank_json'] .=$kwr_rank . ','; } $data['rank_json'] = substr($data['rank_json'], 0, -1); $data['rank_json'] .=']},'; @@ -121,32 +115,28 @@ class Keyworlds extends CI_Controller { $data['rank_json'] .='{"name":"' . $ra[$data_time[0]]->kw_keyworlds . '(mobile)","data":['; foreach ($ra as $v) { $kwr_mobile_rank = $v->kwr_mobile_rank ? $v->kwr_mobile_rank : 'null' ; - if ($v->kwr_mobile_rank == '>150') + if ($v->kwr_mobile_rank == '>150') { $kwr_mobile_rank = 100; - if (strtolower($this->config->item('site_code')) == 'gm') { - $data['rank_json'] .=-$kwr_mobile_rank . ','; - } else { - $data['rank_json'] .=$kwr_mobile_rank . ','; } + $data['rank_json'] .= $kwr_mobile_rank . ','; } $data['rank_json'] = substr($data['rank_json'], 0, -1); $data['rank_json'] .=']},'; } } $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]; + if($data['wordcount'] == 1) { + arsort($data['rank_info']); + } } } else { redirect(site_url("Keyworlds/index")); } - // $data['analytics'] = $this->analytics_model->get_keyword_analytics($data['current_keyworld']->kw_keyworlds, 30); $data['site_code'] = strtolower($this->config->item('site_code')); -// print_r($data['rank_info']); -// print_r($data["rank_json"]); $this->load->view('bootstrap/header', $data); $this->load->view('keyworlds/index'); $this->load->view('bootstrap/footer'); @@ -285,26 +275,33 @@ class Keyworlds extends CI_Controller { $data[] = array('name' => 'rank', 'value' => '查询过于频繁,请等待三分钟!'); echo json_encode($data); return TRUE; - } else if (empty($last_rank[0]->kwr_mobile_rank) && - intval($last_rank[0]->kwr_datetime) > intval($today)) { + } + if ((intval($last_rank[0]->kwr_mobile_rank) == 0 || !isset($last_rank[0]->kwr_mobile_rank)) && + (intval($last_rank[0]->kwr_datetime) >= intval($today)) ) { $client_flag = 'm'; $rank_flag = 'rank_m'; $source_flag = 'source_m'; } + $today_0 = strtotime(date('Ymd000000')); + $today_24 = strtotime(date('Ymd235959')); + $last_rank_today = $this->Keywordsrank_model->get_rank_list($kw_id,1,$today_0,$today_24); + + $orignal = array(); //获取排名详细情况,排名超过150的停止搜索 for ($i = 1; $i <= 15; $i++) { $j = $i; $rank = $this->$method($client_flag, $keyworlds, $site_url, $j, $site_code); + $orignal[] = $rank['orignal']; // 仅更新一个字段 - if (intval($rank['rank']) == 0) { - $rank['rank'] = $last_rank[0]->kwr_rank; - $rank['source'] = $last_rank[0]->kwr_source; + if ($client_flag === 'm') { + $rank['rank'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_rank : null; + $rank['source'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_source : null; } else { - $rank['rank_m'] = null; - $rank['source_m'] = null; + $rank['rank_m'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_mobile_rank : null; + $rank['source_m'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_mobile_source : null; } - if ($rank[$rank_flag] != 0) { + if (intval($rank[$rank_flag]) != 0) { if ($rank[$rank_flag] > 150) $rank[$rank_flag] = '151'; break; @@ -315,46 +312,71 @@ class Keyworlds extends CI_Controller { break; } } + $data[] = array( + 'name' => 'rank', + 'value' => ($rank['rank'] . " / " . $rank["rank_m"]), + 'real' => $rank_flag . " : " . $rank[$rank_flag] + // ,'tmp' => intval($last_rank[0]->kwr_datetime) . "-" . intval($today) . $client_flag + // ,'orignal' => $orignal + // ,"site" => $site_url + ); + if ($rank[$rank_flag] < 0) { + echo json_encode($data); + return false; + } //保存排名数据 - if ($rank[$rank_flag] == '151') { //超过151的排名则不记录 + if ( isset($last_rank_today[0]) && ! empty($last_rank_today[0])) { + $this->Keywordsrank_model->update_rank($last_rank_today[0]->kwr_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines']); $this->Keywords_model->update_time($kw_id); - } elseif (isset($last_rank[0]->kwr_datetime) and $last_rank[0]->kwr_datetime > strtotime(date('Y-m-d'))) { - if ($rank[$rank_flag] != -1 and $rank[$rank_flag] != -2 and $this->Keywordsrank_model->update_rank($last_rank[0]->kwr_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'])) { - $this->Keywords_model->update_time($kw_id); - } } else { - if ($rank[$rank_flag] != -1 and $rank[$rank_flag] != -2 and $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 变化 + if ($add && $client_flag === 'PC') { + $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)); $this->Keywords_model->update_time($kw_id); } } - $data[] = array('name' => 'rank', 'value' => ($rank['rank'] . " -- " . $rank["rank_m"])); echo json_encode($data); return TRUE; } //自动爬取排名 - public function get_auto_rank($engines = '', $fix_site_code = '') { + public function get_auto_rank($engines = '', $fix_site_code = '', $client='PC') { set_time_limit(60); - $rank = array(); + $rank = array(); + $orignal = array(); + $worldsList = array(); $site_config = $this->config->item('site'); - $engines = trim($engines); + $engines = trim($engines); //取出需要更新排名的关键词 - $worldsList = $this->Keywords_model->get_keyworld_list(1, $engines, $fix_site_code); - //如果没有需要更新的则返回 - if (empty($worldsList)) { - echo 'all done'; - return; - } - $today = strtotime(date('Y-m-d')); - $client_flag = "PC"; - $rank_flag = 'rank'; - $source_flag = 'source'; - if (intval($worldsList[0]->kwr_datetime) >= intval($today) ) { + // 先取时间最久没更新的 + $today = strtotime(date('Y-m-d')); + $client_flag = $client ? $client : "PC"; + $rank_flag = 'rank'; + $source_flag = 'source'; + if ($client_flag == 'PC') { + $worldsList = $this->Keywords_model->get_keyworld_list_old(1, $engines, $fix_site_code); + } + if (empty($worldsList) || $client_flag === 'm') { + $worldsList = $this->Keywords_model->get_keyworld_list(1, $engines, $fix_site_code); + //如果没有需要更新的则返回 + if (empty($worldsList)) { + echo 'all done'; + return; + } $client_flag = "m"; $rank_flag = 'rank_m'; $source_flag = 'source_m'; + $last_rank = $this->Keywordsrank_model->get_rank_list($worldsList[0]->kw_id); } - $last_rank = $this->Keywordsrank_model->get_rank_list($worldsList[0]->kw_id); + $last_rank_pc = $this->Keywordsrank_model->get_rank_list($worldsList[0]->kw_id); + + $today_0 = strtotime(date('Ymd000000')); + $today_24 = strtotime(date('Ymd235959')); + $last_rank_today = $this->Keywordsrank_model->get_rank_list($worldsList[0]->kw_id,1,$today_0,$today_24); //获取排名并保存 foreach ($worldsList as $v) { @@ -368,35 +390,48 @@ 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) { - $rank['rank'] = $last_rank[0]->kwr_rank; - $rank['source'] = $last_rank[0]->kwr_source; + $orignal[] = $rank['orignal']; + if ($client_flag === 'm') { + $rank['rank'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_rank : null; + $rank['source'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_source : null; } else { - $rank['rank_m'] = null; - $rank['source_m'] = null; + $rank['rank_m'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_mobile_rank : null; + $rank['source_m'] = isset($last_rank_today[0]) ? $last_rank_today[0]->kwr_mobile_source : null; } if ($rank[$rank_flag] != 0) { - if ($rank[$rank_flag] > 150) + if (intval($rank[$rank_flag]) > 150) $rank[$rank_flag] = '151'; break; }elseif ($i == 15) { $rank[$rank_flag] = '151'; + break; } elseif ($rank[$rank_flag] == -2) { break; } } - if ($rank[$rank_flag] == '151') { //超过151的排名则不记录 - $this->Keywords_model->update_time($v->kw_id); - }else if ($rank[$rank_flag] != -1 and $rank[$rank_flag] != -2 and $this->Keywordsrank_model->add_rank($v->kw_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines'])) { - $this->load->model('InfoSMS_model'); - $last_rank = isset($last_rank[0]) ? $last_rank[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, (string) ($rank['rank'] - $last_rank)); - if ($engines != 'yandex') - $this->Keywords_model->update_time($v->kw_id); - } - } - var_dump($worldsList[0]->kw_keyworlds, $rank); + if ( $rank[$rank_flag] < 0 ) { + break; + } + if ( isset($last_rank_today[0]) && ! empty($last_rank_today[0])) { + $this->Keywordsrank_model->update_rank($last_rank_today[0]->kwr_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines']); + $this->Keywords_model->update_time($v->kw_id); + } else { + $add = $this->Keywordsrank_model->add_rank($v->kw_id, $rank['rank'], $rank['rank_m'], $rank['source'], $rank['source_m'], $rank['engines']); + // rank 变化 + if ($add && $client_flag === 'PC') { + $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); + } + } + } + } + var_dump("rank $client_flag " . $rank[$rank_flag]); + unset($rank['orignal']); + var_dump($worldsList[0]->kw_keyworlds, $rank, $orignal); } //计算关键词在google搜索引擎的排名 @@ -407,6 +442,7 @@ class Keyworlds extends CI_Controller { $rank['rank_m'] = 0; $rank['source_m'] = $site_url; $rank['engines'] = 'google'; + $rank["orignal"] = ''; if ($page > 3) { $rank['rank'] = 151; $rank['rank_m'] = 151; @@ -436,23 +472,26 @@ class Keyworlds extends CI_Controller { //抓取google搜索结果 $url = "https://www.$google_url/search?q=$search_worlds&start=$start&num=50&hl=$language"; - $match_fun = '/

(.*)<\/h3>/smUi'; + $match_fun = '/

(.*)<\/h3>/smUi'; $rank_flag = 'rank'; $source_flag = 'source'; if ($client_flag == 'm') { - $match_fun = '/curl($url,$client_flag); if ($response) { //分析google搜索结果,计算排名 - if (false !== stripos($response, '

302 Moved

')) { + if (false !== stripos($response, '

302 Moved

') || + false !== stripos($response, 'recaptcha')) { $rank['rank'] = -2; + $rank["orignal"] = $response; } elseif (false !== stripos($response, $site_url)) { preg_match_all($match_fun, $response, $store); foreach ($store[1] as $k => $v) { $ismatch = stripos($v, $site_url); + $ismatch = $ismatch ? $ismatch : stripos($v, addcslashes(addslashes($site_url), "/")); if (false !== $ismatch) { //计算排名 $rank[$rank_flag] = $start + $k + 1; @@ -465,9 +504,11 @@ class Keyworlds extends CI_Controller { } } } else { + $rank["orignal"] = $response; // log_message('error','google search response not found CH'); } } else { + $rank["orignal"] = $response; $rank[$rank_flag] = -1; } return $rank; @@ -502,7 +543,7 @@ class Keyworlds extends CI_Controller { $rank_flag = 'rank'; $source_flag = 'source'; if ($client_flag == 'm') { - $match_fun = '/
$v) { $start_s = stripos($v, $site_url); + $start_s = $start_s ? $start_s : stripos($v, addcslashes(addslashes($site_url), "/")); if (false !== $start_s) { $rank[$rank_flag] = $startrank + $k + 1; $end_s = stripos($v, '" ', $start_s); @@ -671,4 +713,15 @@ class Keyworlds extends CI_Controller { return $reponse; } + public function testrank($kw_is_id=0, $top=1) + { + $data['current_keyworld'] = $this->Keywords_model->get_keyworld_bytreeid($kw_is_id); + $is_id_string = $data['current_keyworld']->kw_id; + $rank_info = $this->Keywordsrank_model->get_rank_list($is_id_string, $top); + foreach ($rank_info as $key => &$value) { + $value['ddd'] = date('Y-m-d H:i:s', $value->kwr_datetime); + } + var_dump($rank_info); + } + } diff --git a/application/language/english/form_validation_lang.php b/application/language/english/form_validation_lang.php index 7a8af386..8dfc28cf 100644 --- a/application/language/english/form_validation_lang.php +++ b/application/language/english/form_validation_lang.php @@ -82,17 +82,17 @@ $lang['send_sms_success'] = '发送短消息成功!'; $lang['author_email_new_task_subject'] = 'New Task,%s'; -$lang['author_email_new_task_body'] = 'You have a new task on the China Highlights Content Management System. Please log in at http://a.cdnch.com/author.php'; -$lang['author_email_new_task_body2'] = 'There is a new task on the China Highlights Content Management System. Click “Accept” before someone else does if you want it! Please log in at a.cdnch.com (if the task is not in the Task Hall, someone else has already taken it).'; +$lang['author_email_new_task_body'] = 'You have a new task on the China Highlights Content Management System. Please log in at http://author.mycht.cn/author.php'; +$lang['author_email_new_task_body2'] = 'There is a new task on the China Highlights Content Management System. Click “Accept” before someone else does if you want it! Please log in at author.mycht.cn (if the task is not in the Task Hall, someone else has already taken it).'; $lang['author_email_review_task_failed_subject'] = 'Revision Required,%s'; -$lang['author_email_review_task_failed_body'] = 'Your submission on the China Highlights Content Management System has been reviewed and requires revision. Please log in at http://a.cdnch.com/author.php'; +$lang['author_email_review_task_failed_body'] = 'Your submission on the China Highlights Content Management System has been reviewed and requires revision. Please log in at http://author.mycht.cn/author.php'; $lang['author_email_review_task_success_subject'] = 'Submission Accepted,%s'; -$lang['author_email_review_task_success_body'] = 'Your submission on the China Highlights Content Management System has been reviewed and accepted. See http://a.cdnch.com/author.php'; +$lang['author_email_review_task_success_body'] = 'Your submission on the China Highlights Content Management System has been reviewed and accepted. See http://author.mycht.cn/author.php'; $lang['author_email_message_subject'] = 'Message,%s'; -$lang['author_email_message_body'] = 'You have a new message on the China Highlights Content Management System. Please log in at http://a.cdnch.com/author.php'; +$lang['author_email_message_body'] = 'You have a new message on the China Highlights Content Management System. Please log in at http://author.mycht.cn/author.php'; //关键词管理 $lang['form_keyworlds_success'] = '关键词编辑成功!'; diff --git a/application/models/infoTags_model.php b/application/models/infoTags_model.php new file mode 100644 index 00000000..6f6e2208 --- /dev/null +++ b/application/models/infoTags_model.php @@ -0,0 +1,122 @@ +HT = $this->load->database('HT', TRUE); + } + + /** + * 增加标签 + */ + function add_tag() + { + if ($this->it_title) + { + //查看是否已存在标签 + $sql = "SELECT TOP 1 * from infoTags WHERE it_title = N?"; + $check = $this->HT->query($sql, array($this->it_title)); + + //添加标签 + if ($check->num_rows() === 0) + { + $sql = "INSERT INTO infoTags (it_title, it_memo) VALUES (N?, N?)"; + $query = $this->HT->query($sql, array($this->it_title, $this->it_memo)); + return $this->HT->insert_id(); + } + else + { + $row = $check->row(); + return $row->it_id; + } + + } + return FALSE; + } + + /** + * 删除标签 + */ + function remove_tag() + { + if ($this->it_title) + { + $sql = "DELETE FROM infoTags WHERE it_title = N?"; + $query = $this->HT->query($sql, array($this->it_title)); + return 'success'; + } + return 'fail'; + } + + /** + * 标签列表 + */ + function list_tag() + { + if ($this->ic_id) + { + //展示信息的标签 + $sql = "SELECT * FROM infoContentToTag INNER JOIN infoTags ON icit_it_id = it_id WHERE icit_ic_id = ?"; + $query = $this->HT->query($sql, array($this->ic_id)); + return $query->result(); + } + else + { + //全部展示 + $sql = "SELECT * FROM infoTags ORDER BY it_title ASC, it_date DESC"; + $query = $this->HT->query($sql); + return $query->result(); + } + return 'fail'; + } + + /** + * 添加信息与标签的关联 + */ + function add_tag_to_content() + { + if ($this->ic_id && $this->it_id) + { + //查看是否已存在关联 + $sql = "SELECT TOP 1 * from infoContentToTag WHERE icit_ic_id = ? AND icit_it_id = ?"; + $check = $this->HT->query($sql, array($this->ic_id, $this->it_id)); + + //添加关联 + if ($check->num_rows() === 0) + { + $sql = "INSERT INTO infoContentToTag (icit_ic_id, icit_it_id) VALUES (?, ?)"; + $query = $this->HT->query($sql, array($this->ic_id, $this->it_id)); + } + else + { + return 'exist'; + } + return 'success'; + } + return 'fail'; + } + + /** + * 解除信息与标签的关联 + */ + function remove_tag_to_content() + { + if ($this->ic_id && $this->it_id) + { + $sql = "DELETE FROM infoContentToTag WHERE icit_ic_id = ? and icit_it_id = ?"; + $query = $this->HT->query($sql, array($this->ic_id, $this->it_id)); + return 'success'; + } + return 'fail'; + } + +} diff --git a/application/models/infokeywords_model.php b/application/models/infokeywords_model.php index a18dc82d..9ea6d73b 100644 --- a/application/models/infokeywords_model.php +++ b/application/models/infokeywords_model.php @@ -64,11 +64,14 @@ class infoKeywords_model extends CI_Model } //获取关键词列表用于抓取排名 - public function get_keyworld_list($top=1,$engines='',$site_code=false) + public function get_keyworld_list_old($top = 1, $engines='',$site_code=false) { $today = strtotime(date('Y-m-d')); + //只查某个站点,原因是个事业部服务器分开,只需要查询本事业部站点即可 $map = " "; - if ($engines=='yandex') { + if(!empty($site_code)){ + $map.=" AND kw_sitecode in ('$site_code') "; + }else if ($engines=='yandex') { $map=" AND kw_sitecode='ru' "; }elseif ($engines=='baidu') { $map.=" AND kw_sitecode='wt' "; @@ -77,9 +80,35 @@ class infoKeywords_model extends CI_Model }elseif ($engines=='eu') { $map.=" AND kw_sitecode in ('gm','vc','vac','ru','it','jp') "; } + $sql = "SELECT TOP 1 kw_id, + kw_keyworlds, + kw_is_id, + kw_sitecode, + kw_datetime, + kw_status + FROM infoKeywords + WHERE kw_status=1 AND kw_datetime<(SELECT DATEDIFF(S,'1970-01-01', GETDATE())) $map + ORDER BY kw_datetime asc"; + + $query = $this->HT->query($sql); + $result = $query->result(); + return $result; + } + public function get_keyworld_list($top=1,$engines='',$site_code=false) + { + $today = strtotime(date('Y-m-d')); + $map = " "; //只查某个站点,原因是个事业部服务器分开,只需要查询本事业部站点即可 if(!empty($site_code)){ $map.=" AND kw_sitecode in ('$site_code') "; + }else if ($engines=='yandex') { + $map=" AND kw_sitecode='ru' "; + }elseif ($engines=='baidu') { + $map.=" AND kw_sitecode='wt' "; + }elseif ($engines=='en') { + $map.=" AND kw_sitecode in ('cht','ct','sht','tbt','yz','gl','mbj','dct','mct','bht','ah') "; + }elseif ($engines=='eu') { + $map.=" AND kw_sitecode in ('gm','vc','vac','ru','it','jp') "; } $sql = "SELECT TOP $top kw_id, kw_keyworlds, @@ -93,10 +122,9 @@ class infoKeywords_model extends CI_Model kwr_id FROM infoKeywords INNER JOIN infoKeywordsrank ON kwr_kw_id=kw_id AND kwr_id = ( SELECT MAX(kwr_id) FROM infoKeywordsrank WHERE kwr_kw_id=kw_id ) - AND (kwr_datetime<'$today' - OR kwr_mobile_rank IS NULL) + AND (kwr_mobile_rank=0 OR kwr_mobile_rank IS NULL) WHERE kw_status=1 $map - ORDER BY newid()"; + ORDER BY kw_datetime ASC "; $query = $this->HT->query($sql); //print_r($this->HT->queries); $result = $query->result(); diff --git a/application/third_party/advertise/controllers/index.php b/application/third_party/advertise/controllers/index.php index fba012ea..581fed60 100644 --- a/application/third_party/advertise/controllers/index.php +++ b/application/third_party/advertise/controllers/index.php @@ -6,7 +6,7 @@ if (!defined('BASEPATH')) class Index extends CI_Controller { - public function __construct() + public function __construct() { parent::__construct(); $this->permission->is_admin(); @@ -55,6 +55,7 @@ class Index extends CI_Controller $data['advertise']=$this->advertise_model->get_advertise_treeid($data['ad_is_id']); $data['webpage_list']=$this->advertise_model->get_advertise_page($data['ad_is_id']); $data['click_rate']=$this->advertise_model->get_click_rate($data['advertise']->ad_id); + $data['advertise']->ad_content = str_replace("url=//","url=https://",$data['advertise']->ad_content); $this->load->view('bootstrap3/header', $data); $this->load->view('advertise'); $this->load->view('bootstrap3/footer'); @@ -167,4 +168,4 @@ class Index extends CI_Controller echo $result; } -} \ No newline at end of file +} diff --git a/application/third_party/train/controllers/search.php b/application/third_party/train/controllers/search.php index 18109911..2248c237 100644 --- a/application/third_party/train/controllers/search.php +++ b/application/third_party/train/controllers/search.php @@ -6,16 +6,21 @@ class search extends CI_Controller{ public function __construct(){ parent::__construct(); - $this->load->model("BIZ_train_model");//加载模型 + //$this->load->model("BIZ_train_model");//加载模型 } //查询聚合余票接口,对返回的数据进行处理 public function index($train_date=null,$fromStation=null,$toStation=null){ + set_time_limit(0); if(!$train_date || !$fromStation || !$toStation){ exit('传参错误!'); }else{ - $url = 'http://op.juhe.cn/trainTickets/ticketsAvailable?key='.JUHE_TRAIN_API_KEY.'&train_date='.$train_date.'&from_station='.$fromStation.'&to_station='.$toStation; + //$url = 'http://op.juhe.cn/trainTickets/ticketsAvailable?key='.JUHE_TRAIN_API_KEY.'&train_date='.$train_date.'&from_station='.$fromStation.'&to_station='.$toStation; + $url = 'http://139.129.246.118:12309/trainTickets/ticketsAvailable?key='.JUHE_TRAIN_API_KEY.'&train_date='.$train_date.'&from_station='.$fromStation.'&to_station='.$toStation; $back_data = $this->get_http($url); + if(empty(json_decode($back_data)->result)){ + log_message('error','juhetrain:'.$url.' '.$back_data); + } //print_r(json_decode($back_data)); $return_data = new stdClass(); $return_data->httpstatus = 200; @@ -92,12 +97,17 @@ class search extends CI_Controller{ $seat_type .= '"9":"'.$swzPrice.'","A9":"¥'.$value->swz_price.'",'; } } + if(isset($value->dw_price)){ + if($value->dw_price > 0){ + $seat_type .= '"F":"¥'.$value->dw_price.'",'; + } + } $pricestr = $seat_type.'"train_no":'.'"'.$value->train_no.'"'; //余票字符串 $return_data->data->result[$i] = '|预定|'.$value->train_no.'|'.$value->train_code.'|'.$value->from_station_name.'|'.$value->to_station_name.'|'.$value->from_station_code.'|'.$value->to_station_code.'|'.$value->start_time.'|'.$value->arrive_time.'|'.$value->run_time.'|'.$value->can_buy_now.'||'.$value->train_start_date.'||||||||'.$this->ticket_exchange($value->gjrw_num).'|'.$this->ticket_exchange($value->qtxb_num).'|'.$this->ticket_exchange($value->rw_num).'|'.$this->ticket_exchange($value->rz_num).'|'.$this->ticket_exchange($value->tdz_num).'|'.$this->ticket_exchange($value->wz_num).'||'.$this->ticket_exchange($value->yw_num).'|'.$this->ticket_exchange($value->yz_num).'|'.$this->ticket_exchange($value->edz_num).'|'.$this->ticket_exchange($value->ydz_num).'|'.$this->ticket_exchange($value->swz_num).'|'.$this->ticket_exchange($value->dw_num).'||'; $data = '{"validateMessagesShowId":"_validatorMessage","status":true,"httpstatus":200,"data":{'.$pricestr.'},"messages":[],"validateMessages":{}}'; $return_data->data->price[$i] = $data; - $this->BIZ_train_model->addOrUpdate($value->train_no,$value->train_code,$value->from_station_code,$value->to_station_code,json_encode($data)); + //$this->BIZ_train_model->addOrUpdate($value->train_no,$value->train_code,$value->from_station_code,$value->to_station_code,json_encode($data)); $i++; } } diff --git a/application/third_party/tripadvisor_spider/controllers/index.php b/application/third_party/tripadvisor_spider/controllers/index.php index 4697c747..bbffd659 100644 --- a/application/third_party/tripadvisor_spider/controllers/index.php +++ b/application/third_party/tripadvisor_spider/controllers/index.php @@ -37,7 +37,7 @@ class Index extends CI_Controller { if($nation_item=='www.tripadvisor.com'){//分页代码,英文站点查询前三页,反过来查询,越早的越在后面 $page_mark = array('-or20-', '-or10-', '-'); //使用代理来请求,国内直接访问会很慢 - $page_url=str_replace('https://www.tripadvisor.com', 'http://47.91.16.199:5052', $page_url); + $page_url=str_replace('https://www.tripadvisor.com', 'http://116.251.210.172:5052', $page_url); }else{ $page_mark = array('-'); } diff --git a/application/third_party/tuniu/controllers/tuniu_train.php b/application/third_party/tuniu/controllers/tuniu_train.php index 1eb329e6..08bcb176 100644 --- a/application/third_party/tuniu/controllers/tuniu_train.php +++ b/application/third_party/tuniu/controllers/tuniu_train.php @@ -36,6 +36,7 @@ class Tuniu_train extends CI_Controller{ //获取余票 public function search($date=null,$fromStation=null,$toStation=null){ + set_time_limit(0); if(!$date || !$fromStation || !$toStation){ exit('传参错误!'); }else{ @@ -49,7 +50,10 @@ class Tuniu_train extends CI_Controller{ "data": { "trainDate": "'.$date.'", "fromStation": "'.$fromStation.'", "toStation": "'.$toStation.'", "trainCode": "" } }'; $back_data = post_tuniu($url,$post_data,$method = 'POST'); - //print_r(json_decode($back_data)); + if(empty(json_decode($back_data)->data)){ + log_message('error','tuniu:'.json_encode($post_data)); + } + //print_r(json_decode($back_data)->data); $return_data = new stdClass(); $return_data->returnCode = json_decode($back_data)->returnCode; //echo $return_data->returnCode; diff --git a/application/views/bootstrap3/information_edit.php b/application/views/bootstrap3/information_edit.php index 40edd1fb..3fe01bd8 100644 --- a/application/views/bootstrap3/information_edit.php +++ b/application/views/bootstrap3/information_edit.php @@ -532,7 +532,14 @@
- +
@@ -1163,7 +1170,7 @@ ($author_item->a_id == $information->ic_author) ? $select_str = 'selected' : $select_str = ''; ?> - + @@ -1253,3 +1260,100 @@
+ + \ No newline at end of file diff --git a/application/views/keyworlds/index.php b/application/views/keyworlds/index.php index 0fb8187d..8b943bf2 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; ?> @@ -346,22 +346,6 @@ }, series: }); - - - $(".highcharts-data-labels>g").each(function(){ - var tspan=$(this).find('tspan'); - var olenum=tspan.text(); - var nuewnum=0-(olenum); - tspan.text(nuewnum); - }); - $(".highcharts-axis-labels>text>tspan").each(function(){ - var olenum=$(this).text(); - var nuewnum=olenum<0?0-(olenum):olenum; - if (!$(this).parent("text").attr("transform")) { - $(this).text(nuewnum); - } - }); - }); diff --git a/lmrxedit/template/0.php b/lmrxedit/template/0.php index 6bd5ead0..2ef28abb 100644 --- a/lmrxedit/template/0.php +++ b/lmrxedit/template/0.php @@ -7,14 +7,14 @@ - - + + - + @@ -28,7 +28,7 @@