diff --git a/application/controllers/information.php b/application/controllers/information.php index 12748951..efaa4f9e 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -198,9 +198,9 @@ class Information extends CI_Controller if ($Structure->is_sitecode == 'ct') { $data['infoTypeList'] = $this->config->item('InfoType_ct'); - } elseif($Structure->is_sitecode == 'ah'){ - $data['infoTypeList'] = $this->config->item('InfoType_ah'); - }else { + } elseif ($Structure->is_sitecode == 'ah') { + $data['infoTypeList'] = $this->config->item('InfoType_ah'); + } else { switch ($data['rootInformation']->ic_ht_area_type) { case 'c': //城市 $data['infoTypeList'] = $this->config->item('InfoType_city'); diff --git a/application/third_party/advertise/controllers/index.php b/application/third_party/advertise/controllers/index.php index 581fed60..494b5479 100644 --- a/application/third_party/advertise/controllers/index.php +++ b/application/third_party/advertise/controllers/index.php @@ -12,50 +12,52 @@ class Index extends CI_Controller $this->permission->is_admin(); $this->load->model('InfoStructures_model'); $this->load->model('advertise_model'); + header('Access-Control-Allow-Origin: *'); } //广告列表 - public function index($expire='news') + public function index($expire = 'news') { - $data=array(); - $data['structure_list']=$this->advertise_model->get_structure_list(); + $data = array(); + $data['structure_list'] = $this->advertise_model->get_structure_list(); if (empty($data['structure_list'])) { - $this->add(0,false); + $this->add(0, false); redirect(site_url("thirdparty/advertise")); } $data['ad_is_id'] = $data['structure_list'][0]->id; - $ad_sitecode=$this->config->item('site_code'); - $ad_expire=$ad_expire_end=false; - if ($expire!='news') { - $ad_expire=time(); - $ad_expire_end=$expire=='expired'?false:(time()+5*24*60*60); + $ad_sitecode = $this->config->item('site_code'); + $ad_expire = $ad_expire_end = false; + if ($expire != 'news') { + $ad_expire = time(); + $ad_expire_end = $expire == 'expired' ? false : (time() + 5 * 24 * 60 * 60); } - $data['sub_nav']=$expire; - $data['list']=$this->advertise_model->get_ad_list($ad_sitecode,$ad_expire,$ad_expire_end); + $data['sub_nav'] = $expire; + $data['list'] = $this->advertise_model->get_ad_list($ad_sitecode, $ad_expire, $ad_expire_end); $this->load->view('bootstrap3/header', $data); $this->load->view('ad_list'); $this->load->view('bootstrap3/footer'); } //广告管理编辑页面 - public function detail($ad_is_id=''){ - $data=array(); - $data['sub_nav']=''; - $data['structure_list']=$this->advertise_model->get_structure_list(); + public function detail($ad_is_id = '') + { + $data = array(); + $data['sub_nav'] = ''; + $data['structure_list'] = $this->advertise_model->get_structure_list(); if (empty($data['structure_list'])) { - $this->add(0,false); + $this->add(0, false); redirect(site_url("thirdparty/advertise")); } if (empty($ad_is_id)) { $ad_is_id = $data['structure_list'][0]->id; } - $data['ad_is_id']=$ad_is_id; - $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); + $data['ad_is_id'] = $ad_is_id; + $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'); @@ -63,17 +65,17 @@ class Index extends CI_Controller public function ad_edit() { - $ad_title=$this->input->post('ad_title'); - $ad_content=$this->input->post('ad_content'); - $ad_type=''; - $ad_expire=strtotime($this->input->post('ad_expire')); - $ad_place=$this->input->post('ad_place'); - $ad_status=$this->input->post('ad_status'); - $ad_id=$this->input->post('ad_id'); - $result=$this->advertise_model->update($ad_title,$ad_content,$ad_type,$ad_expire,$ad_place,$ad_status,$ad_id); + $ad_title = $this->input->post('ad_title'); + $ad_content = $this->input->post('ad_content'); + $ad_type = ''; + $ad_expire = strtotime($this->input->post('ad_expire')); + $ad_place = $this->input->post('ad_place'); + $ad_status = $this->input->post('ad_status'); + $ad_id = $this->input->post('ad_id'); + $result = $this->advertise_model->update($ad_title, $ad_content, $ad_type, $ad_expire, $ad_place, $ad_status, $ad_id); if ($result) { $data[] = array('name' => 'ok', 'value' => $this->lang->line('form_info_success')); - }else{ + } else { $data[] = array('name' => 'no', 'value' => '保存失败,请联系管理员'); } echo json_encode($data); @@ -81,22 +83,22 @@ class Index extends CI_Controller public function page_edit() { - $adp_ic_url=$this->input->post('adp_ic_url'); - if (trim($adp_ic_url)=='') { + $adp_ic_url = $this->input->post('adp_ic_url'); + if (trim($adp_ic_url) == '') { $data[] = array('name' => 'no', 'value' => '关联的页面链接不能为空,吼吼!'); echo json_encode($data); return; } - $adp_ic_url=str_replace($this->config->item('site_url'),'',$adp_ic_url); + $adp_ic_url = str_replace($this->config->item('site_url'), '', $adp_ic_url); - $adp_forself=$this->input->post('adp_forself'); - $adp_status=1; - $adp_id=$this->input->post('adp_id'); - $adp_ad_id=$this->input->post('adp_ad_id'); + $adp_forself = $this->input->post('adp_forself'); + $adp_status = 1; + $adp_id = $this->input->post('adp_id'); + $adp_ad_id = $this->input->post('adp_ad_id'); if (empty($adp_id)) { - $result=$this->advertise_model->add_page($adp_ad_id,$adp_ic_url,$adp_forself,$this->config->item('site_code')); - }else{ - $result=$this->advertise_model->update_page($adp_ic_url,$adp_forself,$adp_status,$adp_id,$adp_ad_id); + $result = $this->advertise_model->add_page($adp_ad_id, $adp_ic_url, $adp_forself, $this->config->item('site_code')); + } else { + $result = $this->advertise_model->update_page($adp_ic_url, $adp_forself, $adp_status, $adp_id, $adp_ad_id); } if (!$result) { @@ -107,12 +109,12 @@ class Index extends CI_Controller //添加新广告节点 - public function add($is_parent_id,$is_ajax=true) + public function add($is_parent_id, $is_ajax = true) { $insert_id = $this->InfoStructures_model->Add($is_parent_id); - if ($insert_id && $ad_id=$this->advertise_model->add_advertise($insert_id,'New tree',$this->config->item('site_code'),time())){ + if ($insert_id && $ad_id = $this->advertise_model->add_advertise($insert_id, 'New tree', $this->config->item('site_code'), time())) { $data[] = array('name' => 'ok', 'value' => $insert_id); - }else{ + } else { $data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error')); } if ($is_ajax) { @@ -129,10 +131,8 @@ class Index extends CI_Controller $parent_id = $this->input->post('pid'); $idsStr = $this->input->post('ids'); $idsArray = explode(',', $idsStr); - foreach ($idsArray as $key => $value) - { - if ($value) - { + foreach ($idsArray as $key => $value) { + if ($value) { //设置排序 $this->InfoStructures_model->set_sort($value, $key); //设置path @@ -147,13 +147,13 @@ class Index extends CI_Controller //删除广告 public function delete() { - $isdelete=$this->advertise_model->delete($this->input->post('ad_id')); + $isdelete = $this->advertise_model->delete($this->input->post('ad_id')); if ($isdelete) { $this->advertise_model->delete_page($this->input->post('ad_id')); $this->InfoStructures_model->Delete($this->input->post('ad_is_id')); $data[] = array('name' => 'ok', 'value' => site_url('thirdparty/advertise')); echo json_encode($data); - }else{ + } else { $data[] = array('name' => 'no', 'value' => $this->lang->line('form_keyworlds_error')); echo json_encode($data); } @@ -161,11 +161,10 @@ class Index extends CI_Controller public function delete_page($adp_id) { - $result=0; + $result = 0; if ($this->advertise_model->delete_page_by_adpid($adp_id)) { - $result=1; + $result = 1; } echo $result; } - }