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.
87 lines
2.5 KiB
PHP
87 lines
2.5 KiB
PHP
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
|
|
class Tips extends CI_Controller
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->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);
|
|
}
|
|
|
|
}
|