更新代码,完善功能

This commit is contained in:
2020-02-18 14:50:57 +08:00
parent 31fd944b9c
commit 8bc0f7534b
36 changed files with 283 additions and 280 deletions

View File

@@ -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();
}