You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
information-system/application/controllers/welcome.php

129 lines
5.4 KiB
PHP

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Welcome extends CI_Controller {
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('InfoStructures_model');
$this->load->model('Information_model');
$this->load->model('Coupon_model');
}
public function index() {
$data['countryList'] = $this->Area_model->get_country_list();
$data['provinceList'] = $this->Area_model->get_province_list();
$data['city_list'] = $this->Area_model->get_municipalities_list();
$data['lastEditList'] = $this->Information_model->get_last_edit_list();
$data['last_city_list'] = $this->Area_model->get_last_edit_city();
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/welcome');
$this->load->view('bootstrap/footer');
}
public function search($isrecommend = false) {
//先搜索url如果找到唯一就跳走多于一条的则列出来一条没有的就去搜索信息
$data['keywords'] = $this->input->post('keywords');
$data['all_text_search'] = $this->input->post('all_text_search'); //全文搜索
$search_url = str_replace($this->config->item('site_url'), "", $data['keywords']);
$data['search_list'] = $this->Information_model->search_url($search_url);
if (count($data['search_list']) === 0) {
if (!empty($data['all_text_search']) && $data['all_text_search'] == 'true') {
$data['search_list'] = $this->Information_model->search_all_text($data['keywords']);
} else {
$data['search_list'] = $this->Information_model->search($data['keywords']);
}
}
if ($isrecommend) {
$data['ic_id_list'] = $this->input->post('ic_id_list') == '' ? '0' : $this->input->post('ic_id_list');
$this->load->view('bootstrap3/recommendlist', $data);
return TRUE;
} else if (count($data['search_list']) === 1) {
redirect(site_url('information/edit/' . $data['search_list'][0]->is_id));
}
$data['countryList'] = $this->Area_model->get_country_list();
$data['provinceList'] = $this->Area_model->get_province_list();
$data['city_list'] = $this->Area_model->get_municipalities_list();
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/welcome');
$this->load->view('bootstrap/footer');
}
//获取所有信息+产品url
public function create_all_urls() {
set_time_limit(0);
$this->output->enable_profiler(false);
$this->Information_model->topNum = false;
$data['all_information'] = $this->Information_model->GetList('ic_status,ic_url,ic_sitecode');
//系列站产品连接
$site_code = strtoupper($this->config->item('site_code'));
if (!empty($site_code)) {
$this->load->helper('file');
$path = APPPATH . '/views/product_urls/updateCache' . $site_code . '.txt';
if (file_exists($path)) {
$data['product_urls'] = read_file($path);
$domain = $this->config->item('site_url');
$data['product_urls'] = str_replace("\n", '<br/>', $data['product_urls']);
$data['product_urls'] = str_replace($domain, $domain . '/index.php/welcome/update_cache/?static_html_url=', $data['product_urls']);
}
}
$this->load->view('none_urls', $data);
}
//获取某个信息节点和子节点url
public function create_infomation_urls($is_parent_id) {
$this->output->enable_profiler(FALSE);
$structure = $this->InfoStructures_model->Detail($is_parent_id);
if (empty($structure)) {
show_404();
return false;
}
$data['all_information'] = $this->Information_model->get_list_by_path($structure->is_path);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/cache_url', $data);
$this->load->view('bootstrap/footer');
}
//生肖促销订单查询
public function coupon() {
$data['countryList'] = $this->Area_model->get_country_list();
$data['provinceList'] = $this->Area_model->get_province_list();
$data['city_list'] = $this->Area_model->get_municipalities_list();
$data['coupon'] = $this->Coupon_model->getlist();
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/welcome');
$this->load->view('bootstrap/footer');
}
public function set_path($is_id, $parent_path = '') {
$parent_path = str_replace('-', ',', $parent_path);
$parent_path = trim($parent_path, ',');
if ($parent_path != '')
$parent_path.=',';
$this->load->model('Import_model');
$this->Import_model->set_path($is_id, $parent_path);
echo 'ok';
}
public function search_by_icid() {
$ic_id_list = $this->input->post('ic_id_list');
$ic_id_list = rtrim(trim($ic_id_list), ',') . ',';
$this->load->model('InfoContents_model');
$data['search_list'] = $this->InfoContents_model->get_ic_contents_by_list($ic_id_list);
$data['search_type'] = 'recommended';
$this->load->view('bootstrap3/recommendlist', $data);
}
}