diff --git a/application/controllers/information.php b/application/controllers/information.php index 1f472334..1f62eed1 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -501,6 +501,9 @@ class Information extends CI_Controller if ($this->config->item('site_code') == 'ch') { $this->make_www_cache('pc', $information); $this->make_www_cache('mobile', $information); + }else if ($this->config->item('site_code') == 'ah') { + $this->make_www_cache_ah('pc', $information); + $this->make_www_cache_ah('mobile', $information); } else if ($this->config->item('site_code') == 'chinatravel') { $this->make_www_cache_ct('pc', $information); $this->make_www_cache_ct('mobile', $information); @@ -712,6 +715,7 @@ class Information extends CI_Controller $data['meta_addon_picture'] = get_meta($information->ic_id, 'meta_addon_picture'); } $data['meta_addon_picture_url'] = get_meta($information->ic_id, 'meta_addon_picture_url'); + $data['author'] = $this->Operator_model->get_author_nikename($information->ic_author); //获取作者信息 $template_H1 = $this->load->view($template_path . '-h1', $data, TRUE); $template = str_replace('', $template_H1, $template); diff --git a/application/third_party/recommend/controllers/index.php b/application/third_party/recommend/controllers/index.php new file mode 100644 index 00000000..28cfd89f --- /dev/null +++ b/application/third_party/recommend/controllers/index.php @@ -0,0 +1,106 @@ +permission->is_admin(); + $this->load->model('InfoStructures_model'); + $this->load->model('Information_model'); + $this->load->model('InfoContents_model'); + $this->load->model('infoRecommends_model'); + $this->load->model('infoTips_model'); + } + + public function index() + { + $data = array(); + $data['groupList'] = $this->Information_model->group_list(); + $data['tipsList'] = $this->infoTips_model->get_list(); + $this->load->view('bootstrap3/header', $data); + $this->load->view('welcome'); + $this->load->view('bootstrap3/footer'); + } + + //节点绑定信息推荐或者广告 + public function bind($is_id) + { + $data = array(); + $data['information'] = $this->Information_model->Detail($is_id); + if ($data['information'] == FALSE) { + show_404(); + return; + } + //如果本身不是分组节点则查询分组信息 + if ($data['information']->is_level > 0) { + $data['group_detail'] = $this->Information_model->get_detail_by_path($data['information']->is_path, 0); + } + + $this->load->view('bootstrap3/header', $data); + $this->load->view('bind'); + $this->load->view('bootstrap3/footer'); + } + + public function bind_info() + { + $data = array(); + $ir_is_id = $this->input->post('ir_is_id'); + $ir_name = $this->input->post('ir_name'); + $data['infoRecommend'] = $this->infoRecommends_model->detail($ir_is_id, $ir_name); + //广告列表 + $data['tipsList'] = $this->infoTips_model->get_list(); + if (empty($data['infoRecommend'])) { + $data['infoRecommend'] = new StdClass; + $data['infoRecommend']->ir_is_id = $ir_is_id; + $data['infoRecommend']->ir_name = $ir_name; + $data['infoRecommend']->ir_keyword = ''; + $data['infoRecommend']->ir_pointer_is_id = null; + $data['infoRecommend']->ir_pointer_it_id = null; + $data['infoRecommend']->ir_urls = ''; + $data['infoRecommend']->ir_rule = 'no'; + $data['infoRecommend']->ir_datetime = time(); + $data['infoRecommend']->ir_sitecode = $this->config->item('site_code'); + $data['infoRecommend']->ir_id = $this->infoRecommends_model->add('infoRecommends', $data['infoRecommend']); + } + echo json_encode($this->load->view('bind_info', $data, true)); + } + + //根据is_id查询对应的信息,用来检查绑定的is是否正确 + public function check_is_id_info(){ + $ir_pointer_is_id=$this->input->post('ir_pointer_is_id'); + if(!empty($ir_pointer_is_id)) { + $information = $this->Information_model->Detail($ir_pointer_is_id); + } + if(!empty($information)){ + echo json_encode($information->ic_title); + }else{ + echo json_encode('找不到信息'); + } + } + + public function bind_info_save() + { + $infoRecommend = new StdClass; + $ir_id = $this->input->post('ir_id'); + //先查一遍这个数据是否存在,不存在则退出,防止被攻击 + if (empty($this->infoRecommends_model->detail_by_ir_id($ir_id))) { + $data[] = array('name' => 'no', 'value' => '查询不到数据,请重试'); + } else { + $infoRecommend->ir_rule = $this->input->post('ir_rule'); + $infoRecommend->ir_keyword = $this->input->post('ir_keyword'); + $infoRecommend->ir_pointer_is_id = $this->input->post('ir_pointer_is_id'); + $infoRecommend->ir_pointer_it_id = $this->input->post('ir_pointer_it_id'); + $infoRecommend->ir_urls = $this->input->post('ir_urls'); + $infoRecommend->ir_datetime =time(); + $infoRecommend->ir_id = $this->infoRecommends_model->update('infoRecommends', $infoRecommend, 'ir_id=' . $ir_id); + $data[] = array('name' => 'ok', 'value' => '保存成功!'); + } + echo json_encode($data); + } + +} diff --git a/application/third_party/recommend/controllers/tips.php b/application/third_party/recommend/controllers/tips.php new file mode 100644 index 00000000..9fb699fd --- /dev/null +++ b/application/third_party/recommend/controllers/tips.php @@ -0,0 +1,86 @@ +permission->is_admin(); + $this->load->model('InfoStructures_model'); + $this->load->model('Information_model'); + $this->load->model('InfoContents_model'); + $this->load->model('infoTips_model'); + } + + public function index() + { + echo 'Tips index'; + } + + public function add() + { + $infoTip = new StdClass; + $infoTip->it_title = '新广告'; + $infoTip->it_expires = time(); + $infoTip->it_content = ''; + $infoTip->it_datetime = time(); + $infoTip->it_sitecode = $this->config->item('site_code'); + $infoTip->it_id = $this->infoTips_model->add('infoTips', $infoTip); + redirect(site_url('thirdparty/recommend/tips/edit/' . $infoTip->it_id)); + + } + + + public function delete($it_id) + { + $data = array(); + $data['infoTip'] = $this->infoTips_model->detail($it_id); + if ($data['infoTip'] == FALSE) { + show_404(); + return; + } + $this->infoTips_model->delete('infoTips', 'it_id=' . $it_id); + + redirect(site_url('thirdparty/recommend/')); + + } + + public function edit($it_id) + { + $data = array(); + $data['infoTip'] = $this->infoTips_model->detail($it_id); + if ($data['infoTip'] == FALSE) { + show_404(); + return; + } + + $this->load->view('bootstrap3/header', $data); + $this->load->view('tips_info'); + $this->load->view('bootstrap3/footer'); + } + + + public function save() + { + $infoRecommend = new StdClass; + $it_id = $this->input->post('it_id'); + //先查一遍这个数据是否存在,不存在则退出,防止被攻击 + if (empty($this->infoTips_model->detail($it_id))) { + $data[] = array('name' => 'no', 'value' => '查询不到数据,请重试'); + } else { + $infoTip = new StdClass; + $infoTip->it_title = $this->input->post('it_title'); + $infoTip->it_expires = strtotime($this->input->post('it_expires')); + $infoTip->it_content = $this->input->post('it_content'); + $infoTip->it_datetime = time(); + $infoTip->it_id = $this->infoTips_model->update('infoTips', $infoTip, 'it_id=' . $it_id); + $data[] = array('name' => 'ok', 'value' => '保存成功!'); + } + echo json_encode($data); + } + +} diff --git a/application/third_party/recommend/models/infoRecommends_model.php b/application/third_party/recommend/models/infoRecommends_model.php new file mode 100644 index 00000000..b32dc4c4 --- /dev/null +++ b/application/third_party/recommend/models/infoRecommends_model.php @@ -0,0 +1,90 @@ +HT = $this->load->database('HT', TRUE); + } + + public function init() { + $this->topnum = false; + $this->where = false; + $this->orderby = ' order by ir_datetime desc '; + } + + public function detail($ir_is_id,$ir_name){ + $this->init(); + $this->topnum = 1; + $this->where = ' AND ir.ir_is_id=' . $this->HT->escape($ir_is_id); + $this->where .= ' AND ir.ir_name=' . $this->HT->escape($ir_name); + return $this->get_list(); + } + + public function detail_by_ir_id($ir_id){ + $this->init(); + $this->topnum = 1; + $this->where = ' AND ir.ir_id=' . $this->HT->escape($ir_id); + return $this->get_list(); + } + + public function get_list() { + $this->topnum ? $sql = "SELECT TOP " . $this->topnum : $sql = "SELECT "; + $sql .= " + ir.ir_id + ,ir.ir_is_id + ,ir.ir_keyword + ,ir.ir_name + ,ir.ir_pointer_is_id + ,ir.ir_pointer_it_id + ,ir.ir_rule + ,ir.ir_urls + ,ir.ir_datetime + ,ir.ir_sitecode + from infoRecommends ir + where 1=1 + AND ir.ir_sitecode=? + "; + $this->where ? $sql.=$this->where : false; + $this->orderby ? $sql.=$this->orderby : false; + $query = $this->HT->query($sql,array($this->config->item('site_code'))); + //print_r($this->INFO->queries); + if ($this->topnum === 1) { + if ($query->num_rows() > 0) { + $row = $query->row(); + return $row; + } else { + return FALSE; + } + } else { + return $query->result(); + } + } + + + public function add($table, $data) + { + if ($this->HT->insert($table, $data)) { + return $this->HT->last_id($table); + } else { + return false; + } + } + + public function update($table, $data, $where) + { + return $this->HT->update($table, $data, $where); + } + + public function delete($table, $where) + { + return $this->HT->delete($table, $where); + } + + +} \ No newline at end of file diff --git a/application/third_party/recommend/models/infoTips_model.php b/application/third_party/recommend/models/infoTips_model.php new file mode 100644 index 00000000..67b7e637 --- /dev/null +++ b/application/third_party/recommend/models/infoTips_model.php @@ -0,0 +1,79 @@ +HT = $this->load->database('HT', TRUE); + } + + public function init() { + $this->topnum = false; + $this->where = false; + $this->orderby = ' order by it_expires ASC '; + } + + public function detail($it_id){ + $this->init(); + $this->topnum = 1; + $this->where = ' AND it.it_id=' . $this->HT->escape($it_id); + return $this->get_list(); + } + + + public function get_list() { + $this->topnum ? $sql = "SELECT TOP " . $this->topnum : $sql = "SELECT "; + $sql .= " + it.it_id + ,it.it_title + ,it.it_expires + ,it.it_content + ,it.it_sitecode + ,it.it_datetime + from infoTips it + where 1=1 + AND it.it_sitecode=? + "; + $this->where ? $sql.=$this->where : false; + $this->orderby ? $sql.=$this->orderby : false; + $query = $this->HT->query($sql,array($this->config->item('site_code'))); + //print_r($this->INFO->queries); + if ($this->topnum === 1) { + if ($query->num_rows() > 0) { + $row = $query->row(); + return $row; + } else { + return FALSE; + } + } else { + return $query->result(); + } + } + + + public function add($table, $data) + { + if ($this->HT->insert($table, $data)) { + return $this->HT->last_id($table); + } else { + return false; + } + } + + public function update($table, $data, $where) + { + return $this->HT->update($table, $data, $where); + } + + public function delete($table, $where) + { + return $this->HT->delete($table, $where); + } + + +} \ No newline at end of file diff --git a/application/third_party/recommend/views/bind.php b/application/third_party/recommend/views/bind.php new file mode 100644 index 00000000..c8e4f134 --- /dev/null +++ b/application/third_party/recommend/views/bind.php @@ -0,0 +1,199 @@ +
+
+
+ +
+
+

ic_title . ' ]' : '[ ' . $group_detail->ic_title . ' ] ' . $information->ic_title; ?>

+
+
+
+
文章内容
+
+ +
+
+
+
+
+
右侧广告
+
+
+
+
+
+ +
+
+
+
Article A
+
+ +
+
+
+
+
+
Article B
+
+ +
+
+
+
+
+
Article C
+
+ +
+
+
+
+
+
Article D
+
+ +
+
+
+
+ + + + +
+
+
+
Tour A
+
+ +
+
+
+
+
+
Tour B
+
+ +
+
+
+
+
+
Tour C
+
+ +
+
+
+
+
+
Tour D +
+
+ +
+
+
+ +
+ +
+ +
+ + +
+
+
+ + + + + + \ No newline at end of file diff --git a/application/third_party/recommend/views/bind_info.php b/application/third_party/recommend/views/bind_info.php new file mode 100644 index 00000000..49798700 --- /dev/null +++ b/application/third_party/recommend/views/bind_info.php @@ -0,0 +1,88 @@ + + + \ No newline at end of file diff --git a/application/third_party/recommend/views/tips_info.php b/application/third_party/recommend/views/tips_info.php new file mode 100644 index 00000000..3f6419f5 --- /dev/null +++ b/application/third_party/recommend/views/tips_info.php @@ -0,0 +1,81 @@ + + + + +
+
+
+ +
+
+ +
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+ + +
+ +
+ +
+ 删除 + + +
+ +
+ +
+ + +
+ +
+ + +
+
+
+
diff --git a/application/third_party/recommend/views/welcome.php b/application/third_party/recommend/views/welcome.php new file mode 100644 index 00000000..386773c8 --- /dev/null +++ b/application/third_party/recommend/views/welcome.php @@ -0,0 +1,66 @@ +
+
+
+ +
+
+

广告管理

+ + + + + + + + + + + $item){ ?> + + + + + + + + + + + + + + + +
#标题过期时间
+ it_title; ?> + it_expires); ?>
添加广告
+
+
+

广告和信息推荐绑定设置

+ is_level == 0) { ?> +
+
+
+ +
+
    + is_level == 0) { + foreach ($groupList as $item_child) { + if ($item_child->is_parent_id == $item->is_id) { + echo '
  • ' . $item_child->ic_title . '
  • '; + } + } + } ?> +
+
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/application/views/bootstrap/header.php b/application/views/bootstrap/header.php index 5b3b39d9..ced213dd 100644 --- a/application/views/bootstrap/header.php +++ b/application/views/bootstrap/header.php @@ -96,6 +96,7 @@
  • 系统设置
  • 权限设置
  • 生成sitemap
  • +
  • 信息推荐
  • diff --git a/application/views/bootstrap3/header.php b/application/views/bootstrap3/header.php index cb47b90f..8400eb6e 100644 --- a/application/views/bootstrap3/header.php +++ b/application/views/bootstrap3/header.php @@ -121,6 +121,7 @@
  • 系统设置
  • 权限设置
  • 生成sitemap
  • +
  • 信息推荐
  • diff --git a/application/views/mobile_first/ah-h1.php b/application/views/mobile_first/ah-h1.php index 1c48d534..03cde613 100644 --- a/application/views/mobile_first/ah-h1.php +++ b/application/views/mobile_first/ah-h1.php @@ -7,6 +7,7 @@

    ic_title)?$information->ic_title:'H1 title asiahighlights mobile first template'; ?>

    +
    By OPI_FirstName:'author nickname'; ?>Updated
    diff --git a/application/views/mobile_first/ah-pc.php b/application/views/mobile_first/ah-pc.php index 72133aec..122344b5 100644 --- a/application/views/mobile_first/ah-pc.php +++ b/application/views/mobile_first/ah-pc.php @@ -295,9 +295,7 @@
    Featured on
    - Medias - + Medias
    diff --git a/application/views/mobile_first/ah.php b/application/views/mobile_first/ah.php index 4454fd7a..e87d0761 100644 --- a/application/views/mobile_first/ah.php +++ b/application/views/mobile_first/ah.php @@ -310,7 +310,8 @@
    Featured on - info template feature on + Social medias +