更新
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller;
|
||||
use app\common\controller\Admin;
|
||||
namespace app\controller\admin;
|
||||
use app\controller\Admin;
|
||||
|
||||
/**
|
||||
* @title 频道管理
|
||||
@@ -26,9 +26,9 @@ class Channel extends Admin {
|
||||
public function index($type = 0) {
|
||||
/* 获取频道列表 */
|
||||
//$map = array('status' => array('gt', -1), 'pid'=>$pid);
|
||||
$map = array('status' => array('gt', -1));
|
||||
$map = array('status' => array('gt', -1));
|
||||
if ($type) {
|
||||
$map['type'] = $type;
|
||||
$map['type'] = $type;
|
||||
}
|
||||
$list = db('Channel')->where($map)->order('sort asc,id asc')->column('*', 'id');
|
||||
|
||||
@@ -41,7 +41,7 @@ class Channel extends Admin {
|
||||
|
||||
$data = array(
|
||||
'tree' => $list,
|
||||
'type' => $type
|
||||
'type' => $type,
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta('导航管理');
|
||||
@@ -64,7 +64,7 @@ class Channel extends Admin {
|
||||
public function add() {
|
||||
if ($this->request->isPost()) {
|
||||
$Channel = model('Channel');
|
||||
$data = $this->request->post();
|
||||
$data = $this->request->post();
|
||||
if ($data) {
|
||||
$id = $Channel->save($data);
|
||||
if ($id) {
|
||||
@@ -100,7 +100,7 @@ class Channel extends Admin {
|
||||
public function edit($id = 0) {
|
||||
if ($this->request->isPost()) {
|
||||
$Channel = model('Channel');
|
||||
$data = $this->request->post();
|
||||
$data = $this->request->post();
|
||||
if ($data) {
|
||||
if (false !== $Channel->save($data, array('id' => $data['id']))) {
|
||||
//记录行为
|
||||
@@ -149,9 +149,9 @@ class Channel extends Admin {
|
||||
|
||||
$map = array('id' => array('in', $id));
|
||||
if (db('Channel')->where($map)->delete()) {
|
||||
//删除category中的ismenu字段记录
|
||||
$map = array('ismenu' => array('in', $id));
|
||||
db('Category')->where($map)->setField('ismenu',0);
|
||||
//删除category中的ismenu字段记录
|
||||
$map = array('ismenu' => array('in', $id));
|
||||
db('Category')->where($map)->setField('ismenu', 0);
|
||||
//记录行为
|
||||
action_log('update_channel', 'channel', $id, session('user_auth.uid'));
|
||||
return $this->success('删除成功');
|
||||
@@ -201,14 +201,14 @@ class Channel extends Admin {
|
||||
* @title 设置状态
|
||||
*/
|
||||
public function setStatus() {
|
||||
$id = array_unique((array) input('ids', 0));
|
||||
$id = array_unique((array) input('ids', 0));
|
||||
$status = input('status', '0', 'trim');
|
||||
|
||||
if (empty($id)) {
|
||||
return $this->error('请选择要操作的数据!');
|
||||
}
|
||||
|
||||
$map = array('id' => array('in', $id));
|
||||
$map = array('id' => array('in', $id));
|
||||
$result = db('Channel')->where($map)->update(array('status' => $status));
|
||||
if ($result) {
|
||||
return $this->success("操作成功!");
|
||||
|
||||
Reference in New Issue
Block a user