上线信息推荐管理
parent
53f63967fe
commit
320261d41e
@ -0,0 +1,86 @@
|
|||||||
|
<?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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class infoRecommends_model extends CI_Model
|
||||||
|
{
|
||||||
|
var $topnum = false; //返回记录数
|
||||||
|
var $orderby = false;
|
||||||
|
var $where = false; //查询条件
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class infoTips_model extends CI_Model
|
||||||
|
{
|
||||||
|
var $topnum = false; //返回记录数
|
||||||
|
var $orderby = false;
|
||||||
|
var $where = false; //查询条件
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
<script type="text/javascript" src="/wysiwyg/ckeditor.js"></script>
|
||||||
|
<script language="javascript">
|
||||||
|
var editor;
|
||||||
|
window.onload = function () {
|
||||||
|
editor = CKEDITOR.replace("it_content", {
|
||||||
|
width: '100%',
|
||||||
|
height: '560px',
|
||||||
|
readOnly: false,
|
||||||
|
filebrowserBrowseUrl: '/wysiwyg/ckfinder/ckfinder.php?sitecode=ch',
|
||||||
|
filebrowserUploadUrl: '/wysiwyg/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=image',
|
||||||
|
contentsCss: 'https://proxy-data.chinahighlights.com/css/mobile-first.css'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
|
||||||
|
$("#it_expires").datepicker({
|
||||||
|
showButtonPanel: true
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-16">
|
||||||
|
|
||||||
|
<form action="<?php echo site_url('thirdparty/recommend/tips/save') ?>"
|
||||||
|
method="post" id="tips_info_form" name="tips_info_form">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-16">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="it_title" ">广告标题</label>
|
||||||
|
<input type="text" class="form-control" id="it_title" name="it_title"
|
||||||
|
value="<?php echo $infoTip->it_title; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="it_expires">过期时间</label>
|
||||||
|
<input type="text" class="form-control flatpickrEnable" id="it_expires" name="it_expires"
|
||||||
|
value="<?php echo date('m/d/Y', $infoTip->it_expires); ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-20">
|
||||||
|
<textarea class="form-control" rows="6" id="it_content" name="it_content"
|
||||||
|
placeholder="广告内容"><?php echo $infoTip->it_content; ?></textarea>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-20">
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<a href="<?php echo site_url('thirdparty/recommend/tips/delete/' . $infoTip->it_id) ?>"
|
||||||
|
class="btn btn-danger pull-left">删除</a>
|
||||||
|
<button type="button" class="btn btn-primary pull-right"
|
||||||
|
onclick="editor.updateElement();submitForm('tips_info_form');">保存
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="it_id" id="it_id" value="<?php echo $infoTip->it_id; ?>"/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br/>
|
@ -0,0 +1,66 @@
|
|||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-2">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<h4>广告管理</h4>
|
||||||
|
<table class="table table-striped">
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="col-md-4">#</th>
|
||||||
|
<th class="col-md-16">标题</th>
|
||||||
|
<th class="col-md-4">过期时间</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($tipsList as $key=>$item){ ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo ++$key; ?></td>
|
||||||
|
<td>
|
||||||
|
<a href="<?php echo site_url('thirdparty/recommend/tips/edit/'.$item->it_id); ?>"><?php echo $item->it_title; ?></a>
|
||||||
|
</td>
|
||||||
|
<td><?php echo date('m/d/Y', $item->it_expires); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td><a href="<?php echo site_url('thirdparty/recommend/tips/add'); ?>">添加广告</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-15">
|
||||||
|
<h4>广告和信息推荐绑定设置</h4>
|
||||||
|
<?php foreach ($groupList as $item) {
|
||||||
|
if ($item->is_level == 0) { ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-24">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading"><a
|
||||||
|
href="<?php echo site_url('thirdparty/recommend/index/bind/' . $item->is_id) ?>"> <?php echo $item->ic_title; ?></a>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<ul class="list-inline">
|
||||||
|
<?php if ($item->is_level == 0) {
|
||||||
|
foreach ($groupList as $item_child) {
|
||||||
|
if ($item_child->is_parent_id == $item->is_id) {
|
||||||
|
echo ' <li><a href="' . site_url('thirdparty/recommend/index/bind/' . $item_child->is_id) . '">' . $item_child->ic_title . '</a></li> ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php }
|
||||||
|
} ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue