更新代码,完善功能
This commit is contained in:
@@ -8,7 +8,10 @@
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
use app\model\Channel as ChannelM;
|
||||
use sent\tree\Tree;
|
||||
|
||||
/**
|
||||
* @title 频道管理
|
||||
@@ -16,35 +19,27 @@ use app\controller\Admin;
|
||||
*/
|
||||
class Channel extends Admin {
|
||||
|
||||
public function _initialize() {
|
||||
parent::_initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 频道列表
|
||||
*/
|
||||
public function index($type = 0) {
|
||||
public function index(ChannelM $channel, $type = 0) {
|
||||
/* 获取频道列表 */
|
||||
//$map = array('status' => array('gt', -1), 'pid'=>$pid);
|
||||
$map = array('status' => array('gt', -1));
|
||||
if ($type) {
|
||||
$map['type'] = $type;
|
||||
}
|
||||
$list = db('Channel')->where($map)->order('sort asc,id asc')->column('*', 'id');
|
||||
$list = $channel->where($map)->order('sort asc,id asc')->column('*', 'id');
|
||||
|
||||
if (!empty($list)) {
|
||||
$tree = new \com\Tree();
|
||||
$tree = new Tree();
|
||||
$list = $tree->toFormatTree($list);
|
||||
}
|
||||
|
||||
config('_sys_get_channel_tree_', true);
|
||||
|
||||
$data = array(
|
||||
$this->data = array(
|
||||
'tree' => $list,
|
||||
'type' => $type,
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta('导航管理');
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user