1、修复bug
2、后台栏目分模型划分 3、前台增加微信开发用户登录功能
This commit is contained in:
@@ -17,16 +17,23 @@ class Category extends Admin {
|
||||
$this->getContentMenu();
|
||||
}
|
||||
|
||||
public function index() {
|
||||
public function index($model_id = '') {
|
||||
$map = array('status' => array('gt', -1));
|
||||
if ($model_id) {
|
||||
$map['model_id'] = $model_id;
|
||||
}
|
||||
$list = db('Category')->where($map)->order('sort asc,id asc')->column('*', 'id');
|
||||
|
||||
if (!empty($list)) {
|
||||
$tree = new \com\Tree();
|
||||
$list = $tree->toFormatTree($list);
|
||||
}
|
||||
$subsql = db('Attribute')->where('name', 'category_id')->fetchSql(true)->column('model_id');
|
||||
$model_list = model('Model')->where('id IN ('. $subsql.')')->select();
|
||||
|
||||
$this->assign('tree', $list);
|
||||
$this->assign('model_list', $model_list);
|
||||
$this->assign('model_id', $model_id);
|
||||
$this->setMeta('栏目列表');
|
||||
return $this->fetch();
|
||||
}
|
||||
@@ -61,10 +68,14 @@ class Category extends Admin {
|
||||
return $this->error('指定的上级分类不存在或被禁用!');
|
||||
}
|
||||
}
|
||||
$subsql = db('Attribute')->where('name', 'category_id')->fetchSql(true)->column('model_id');
|
||||
$model_list = model('Model')->where('id IN ('. $subsql.')')->select();
|
||||
|
||||
/* 获取分类信息 */
|
||||
$info = $id ? db('Category')->find($id) : '';
|
||||
|
||||
$this->assign('info', $info);
|
||||
$this->assign('model_list', $model_list);
|
||||
$this->assign('category', $cate);
|
||||
$this->setMeta('编辑分类');
|
||||
return $this->fetch();
|
||||
@@ -93,8 +104,12 @@ class Category extends Admin {
|
||||
return $this->error('指定的上级分类不存在或被禁用!');
|
||||
}
|
||||
}
|
||||
$subsql = db('Attribute')->where('name', 'category_id')->fetchSql(true)->column('model_id');
|
||||
$model_list = model('Model')->where('id IN ('. $subsql.')')->select();
|
||||
|
||||
/* 获取分类信息 */
|
||||
$this->assign('info', null);
|
||||
$this->assign('model_list', $model_list);
|
||||
$this->assign('category', $cate);
|
||||
$this->setMeta('新增分类');
|
||||
return $this->fetch('edit');
|
||||
|
||||
@@ -45,6 +45,17 @@
|
||||
<textarea name="groups" class="form-control">{$info.groups|default=''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">绑定模型</label>
|
||||
<div class="col-lg-8">
|
||||
<select name="model_id" class="form-control" style="width: auto;">
|
||||
<option value="">--请选择--</option>
|
||||
{volist name="model_list" id="item"}
|
||||
<option value="{$item['id']}" {if isset($info['model_id']) && $info['model_id'] == $item['id']}selected{/if}>{$item['title']}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">发布内容</label>
|
||||
<div class="col-lg-8">
|
||||
|
||||
@@ -15,54 +15,68 @@
|
||||
<div class="main-box-body clearfix">
|
||||
<!-- 表格列表 -->
|
||||
<div class="table-responsive clearfix">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
|
||||
<th width="60">ID</th>
|
||||
<th>名称</th>
|
||||
<th width="120">排序</th>
|
||||
<th width="120">发布</th>
|
||||
<th width="120">状态</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="tree" id="list"}
|
||||
<tr>
|
||||
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$list.id}"></td>
|
||||
<td>{$list['id']}</td>
|
||||
<td>
|
||||
{$list['level_show']}
|
||||
<a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="title" data-type="text" data-pk="{$list['id']}" data-url="{:url('editable')}">{$list['title']}</a>
|
||||
<a class="add-sub-cate" title="添加子分类" href="{:url('add?pid='.$list['id'])}">
|
||||
<i class="fa fa-plus-square"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td><a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="sort" data-type="text" data-pk="{$list['id']}" data-url="{:url('editable')}">{$list['sort']}</a></td>
|
||||
<td>{$list['allow_publish']?'是':'否'}</td>
|
||||
<td>
|
||||
{if $list['status']}
|
||||
<span class="label label-primary">启用</span>
|
||||
{else/}
|
||||
<span class="label label-danger">禁用</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<a title="编辑" href="{:url('edit?id='.$list['id'].'&pid='.$list['pid'])}">编辑</a>
|
||||
{if $list['status']}
|
||||
<a href="{:url('status?id='.$list['id'].'&status=0')}" class="ajax-get">禁用</a>
|
||||
{else/}
|
||||
<a href="{:url('status?id='.$list['id'].'&status=1')}" class="ajax-get">启用</a>
|
||||
{/if}
|
||||
<a title="删除" href="{:url('remove?id='.$list['id'])}" class="confirm ajax-get">删除</a>
|
||||
<a title="移动" href="{:url('operate?type=move&from='.$list['id'])}">移动</a>
|
||||
<a title="合并" href="{:url('operate?type=merge&from='.$list['id'])}">合并</a>
|
||||
</td>
|
||||
</tr>
|
||||
<div class="tabs-wrapper">
|
||||
<ul class="nav nav-tabs">
|
||||
<li {if $model_id == ''}class="active"{/if}><a href="{:url('admin/category/index')}">全部</a></li>
|
||||
{volist name="model_list" id="item"}
|
||||
<li {if $item['id'] == $model_id}class="active"{/if}>
|
||||
<a href="{:url('admin/category/index',array('model_id'=>$item['id']))}">{$item['title']}</a>
|
||||
</li>
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade in active" id="tab-home">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
|
||||
<th width="60">ID</th>
|
||||
<th>名称</th>
|
||||
<th width="120">排序</th>
|
||||
<th width="120">发布</th>
|
||||
<th width="120">状态</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="tree" id="list"}
|
||||
<tr>
|
||||
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$list.id}"></td>
|
||||
<td>{$list['id']}</td>
|
||||
<td>
|
||||
{$list['level_show']}
|
||||
<a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="title" data-type="text" data-pk="{$list['id']}" data-url="{:url('editable')}">{$list['title']}</a>
|
||||
<a class="add-sub-cate" title="添加子分类" href="{:url('add?pid='.$list['id'])}">
|
||||
<i class="fa fa-plus-square"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td><a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="sort" data-type="text" data-pk="{$list['id']}" data-url="{:url('editable')}">{$list['sort']}</a></td>
|
||||
<td>{$list['allow_publish']?'是':'否'}</td>
|
||||
<td>
|
||||
{if $list['status']}
|
||||
<span class="label label-primary">启用</span>
|
||||
{else/}
|
||||
<span class="label label-danger">禁用</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<a title="编辑" href="{:url('edit?id='.$list['id'].'&pid='.$list['pid'])}">编辑</a>
|
||||
{if $list['status']}
|
||||
<a href="{:url('status?id='.$list['id'].'&status=0')}" class="ajax-get">禁用</a>
|
||||
{else/}
|
||||
<a href="{:url('status?id='.$list['id'].'&status=1')}" class="ajax-get">启用</a>
|
||||
{/if}
|
||||
<a title="删除" href="{:url('remove?id='.$list['id'])}" class="confirm ajax-get">删除</a>
|
||||
<a title="移动" href="{:url('operate?type=move&from='.$list['id'])}">移动</a>
|
||||
<a title="合并" href="{:url('operate?type=merge&from='.$list['id'])}">合并</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /表格列表 -->
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user