diff --git a/application/config/config.php b/application/config/config.php index 339d9712..2e23c280 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -615,6 +615,7 @@ $config['area_type'] = array( '大使馆' => 'y', '公民游' => 'z', '交换链接' => 'k', + '首页' => 'h', 'FAQ' => 'q' ); diff --git a/application/controllers/home.php b/application/controllers/home.php new file mode 100644 index 00000000..c351dfc8 --- /dev/null +++ b/application/controllers/home.php @@ -0,0 +1,42 @@ +permission->is_admin(); + //$this->output->enable_profiler(TRUE); + $this->load->model('Area_model'); + $this->load->model('Information_model'); + $this->load->model('InfoContents_model'); + $this->load->model('InfoStructures_model'); + } + + //站点首页 + public function index() + { + $home_id=1; + //查询结构根节点,当为空则建立 + $rootStructure = $this->Information_model->GetRoot('h', $home_id); + if ($rootStructure == FALSE) + { + $this->InfoContents_model->Add('', 'HomePage', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $home_id, 'h', 0, + '',''); + $this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id); + $is_id = $this->InfoStructures_model->insert_id; + } + else + { + $is_id = $rootStructure->is_id; + } + redirect(site_url('information/edit/' . $is_id)); + } + + +} + diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php index 873127d8..990f7f65 100644 --- a/application/controllers/info_amp.php +++ b/application/controllers/info_amp.php @@ -242,12 +242,24 @@ class Info_amp extends CI_Controller if (!empty($rs)) { $newrs = array(); foreach ($rs as $info) { - if (!empty($info->ic_content) && !empty($info->ic_url)) { + $show_photo_meta = $this->InfoMetas_model->get($info->ic_id, 'meta_use_list_picture'); + if ($show_photo_meta == 'no') { + $use_photo = ''; + } else { + $use_photo = $this->config->item('site_image_url').$info->ic_photo; + } + if ($info->ic_type === 'c_attraction' || $info->ic_template === 'city_info_attractions_list' || $info->ic_template === 'r_tpl_empty_navi1p') { + $list_info = true; + } else { + $list_info = false; + } + if ($list_info || !empty($info->ic_content) && !empty($info->ic_url) && stripos($info->ic_url, '/test/')===false) { array_push($newrs, array( + 'is_path' => $info->is_path, 'ic_url' => $info->ic_url, 'ic_id' => $info->ic_id, 'title' => $info->ic_title, - 'photo' => $this->config->item('site_image_url').$info->ic_photo, + 'photo' => $use_photo, 'im_id' => $info->im_id )); } @@ -267,11 +279,17 @@ class Info_amp extends CI_Controller if ($icid) { $ic = $this->InfoContents_model->get_ic_contents2($icid); if ($ic) { + $show_photo_meta = $this->InfoMetas_model->get($icid, 'meta_use_list_picture'); + if ($show_photo_meta == 'no') { + $use_photo = ''; + } else { + $use_photo = $this->config->item('site_image_url').$ic->ic_photo; + } echo json_encode(array( "succ" => true, - "info" => $ic->ic_content, + "info" => $ic->ic_content ? $ic->ic_content : "
".$ic->ic_seo_description."
", "title" => $ic->ic_title, - "photo" => $this->config->item('site_image_url').$ic->ic_photo, + "photo" => $use_photo, "url" => $ic->ic_url, "site" => $this->config->item('site_url') )); diff --git a/application/models/infoContents_model.php b/application/models/infoContents_model.php index 25667ef8..5f99c142 100644 --- a/application/models/infoContents_model.php +++ b/application/models/infoContents_model.php @@ -126,7 +126,7 @@ class InfoContents_model extends CI_Model public function get_ic_contents2($ic_id) { - $sql="SELECT top 1 ic_id, ic_content, ic_title, ic_url, ic_photo, ic_sitecode from infoContents where ic_id=?"; + $sql="SELECT top 1 ic_id, ic_content, ic_title, ic_url, ic_photo, ic_sitecode, ic_seo_description from infoContents where ic_id=?"; $query=$this->HT->query($sql,array($ic_id)); if ($query->result()) { diff --git a/application/models/infoMetas_model.php b/application/models/infoMetas_model.php index b8bf51e2..d95b1def 100644 --- a/application/models/infoMetas_model.php +++ b/application/models/infoMetas_model.php @@ -58,6 +58,7 @@ class InfoMetas_model extends CI_Model { //按节点列表信息(含meta数据) function list_info_by_path_with_meta($is_path, $site_code) { $sql = "SELECT is1.is_id, \n" + . " is1.is_path, \n" . " ic.ic_id, \n" . " ic.ic_url, \n" . " ic.ic_status, \n" @@ -66,12 +67,14 @@ class InfoMetas_model extends CI_Model { . " ic.ic_content, \n" . " ic.ic_photo, \n" . " ic.ic_title, \n" + . " ic.ic_type, \n" . " im.im_id \n" . " FROM infoStructures is1 \n" . " INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id \n" . " AND ic.ic_sitecode = is1.is_sitecode \n" . " LEFT JOIN infoMetas im ON im.im_ic_id = ic.ic_id AND im.im_key=?" - . " WHERE is1.is_path LIKE '$is_path%' AND is_sitecode = ? AND ic_status = 1"; + . " WHERE is1.is_path LIKE '$is_path%' AND is_sitecode = ? AND ic_status = 1" + . " ORDER BY is1.is_level, is1.is_sort, is1.is_path"; $query = $this->HT->query($sql, array('AMP_JSON', $site_code)); //print_r($this->HT->queries); return $query->result(); diff --git a/application/views/amp_editor.php b/application/views/amp_editor.php index 86773135..b6d6e06e 100644 --- a/application/views/amp_editor.php +++ b/application/views/amp_editor.php @@ -12,7 +12,6 @@ } -