功能更新,bug修复
This commit is contained in:
@@ -46,8 +46,7 @@ class Attribute extends Admin {
|
||||
* index方法
|
||||
* @author colin <colin@tensent.cn>
|
||||
*/
|
||||
public function index($model = null){
|
||||
$model_id = input('get.model_id','','trim,intval');
|
||||
public function index($model_id = null){
|
||||
$map['model_id'] = $model_id;
|
||||
if (!$model_id) {
|
||||
return $this->error("非法操作!");
|
||||
|
||||
@@ -47,7 +47,7 @@ class Content extends Admin{
|
||||
}
|
||||
$grid_list = get_grid_list($this->modelInfo['list_grid']);
|
||||
$order = "id desc";
|
||||
$map = array();
|
||||
$map = $this->buildMap();
|
||||
$field = array_filter($grid_list['fields']);
|
||||
if ($this->modelInfo['extend'] == 1) {
|
||||
$map['model_id'] = $this->modelInfo['id'];
|
||||
@@ -91,9 +91,14 @@ class Content extends Admin{
|
||||
'info' => $info,
|
||||
'fieldGroup' => $this->getField($this->modelInfo)
|
||||
);
|
||||
if($this->modelInfo['template_add']){
|
||||
$template = 'content/' . $this->modelInfo['template_add'];
|
||||
}else{
|
||||
$template = 'public/edit';
|
||||
}
|
||||
$this->assign($data);
|
||||
$this->setMeta("添加".$this->modelInfo['title']);
|
||||
return $this->fetch('public/edit');
|
||||
return $this->fetch($template);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,9 +128,14 @@ class Content extends Admin{
|
||||
'info' => $info,
|
||||
'fieldGroup' => $this->getField($this->modelInfo)
|
||||
);
|
||||
if($this->modelInfo['template_edit']){
|
||||
$template = 'content/' . $this->modelInfo['template_edit'];
|
||||
}else{
|
||||
$template = 'public/edit';
|
||||
}
|
||||
$this->assign($data);
|
||||
$this->setMeta("编辑".$this->modelInfo['title']);
|
||||
return $this->fetch('public/edit');
|
||||
return $this->fetch($template);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,20 +165,34 @@ class Content extends Admin{
|
||||
* 设置状态
|
||||
* @author molong <ycgpp@126.com>
|
||||
*/
|
||||
public function status(){
|
||||
public function status($id, $status){
|
||||
$model = $this->model;
|
||||
$id = input('get.id','','trim,intval');
|
||||
$status = input('get.status','','trim,intval');
|
||||
|
||||
$map['id'] = $id;
|
||||
$result = $model::where($map)->setField('status',$status);
|
||||
if ($result) {
|
||||
if (false !== $result) {
|
||||
return $this->success("操作成功!");
|
||||
}else{
|
||||
return $this->error("操作失败!!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置置顶
|
||||
* @author molong <ycgpp@126.com>
|
||||
*/
|
||||
public function settop($id, $is_top){
|
||||
$model = $this->model;
|
||||
|
||||
$map['id'] = $id;
|
||||
$result = $model::where($map)->setField('is_top',$is_top);
|
||||
if (false !== $result) {
|
||||
return $this->success("操作成功!", '');
|
||||
}else{
|
||||
return $this->error("操作失败!!", '');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字段信息
|
||||
* @return array 字段数组
|
||||
@@ -219,6 +243,30 @@ class Content extends Admin{
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建搜索
|
||||
* @return [array] [查询条件]
|
||||
*/
|
||||
protected function buildMap(){
|
||||
$map = array();
|
||||
$keyword = input('get.keyword', '', 'trim');
|
||||
$category = input('get.category', '', 'trim');
|
||||
|
||||
if ($keyword) {
|
||||
$map['title'] = array("LIKE", "%$keyword%");
|
||||
}
|
||||
if ($category){
|
||||
$map['category_id'] = $category;
|
||||
}
|
||||
|
||||
if ($this->modelInfo['extend'] == 1) {
|
||||
$cate_list = parse_field_bind('category', $category, $this->modelInfo['id']);
|
||||
$this->assign('cate_list', $cate_list);
|
||||
}
|
||||
$this->assign($this->request->get());
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测需要动态判断的文档类目有关的权限
|
||||
*
|
||||
|
||||
@@ -11,6 +11,26 @@
|
||||
</div>
|
||||
</header>
|
||||
<div class="main-box-body clearfix">
|
||||
<div class="row">
|
||||
<form method="get">
|
||||
<div class="col-sm-12 col-md-4 col-lg-3">
|
||||
<input type="text" class="form-control" name="keyword" value="{$keyword|default=''}" placeholder="请输入关键字">
|
||||
</div>
|
||||
{if isset($cate_list)}
|
||||
<div class="col-sm-12 col-md-4 col-lg-3">
|
||||
<select name="category" id="category" class="form-control">
|
||||
<option value="">请选择栏目</option>
|
||||
{volist name="cate_list" id="item"}
|
||||
<option value="{$item['id']}" {if isset($category) && $item['id'] == $category}selected{/if}>{$item['title_show']}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="col-sm-12 col-md-4">
|
||||
<button class="btn btn-primary" type="submit">搜索</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="table-responsive clearfix">
|
||||
|
||||
<div class="table-responsive clearfix">
|
||||
@@ -46,9 +66,9 @@
|
||||
<td>
|
||||
{if isset($item['is_top'])}
|
||||
{if $item['is_top']}
|
||||
<a href="{:url('admin/content/is_top',array('id'=>$item['id'],'model_id'=>$model_id,'is_top'=>'0'))}" class="ajax-get">取消置顶</a>
|
||||
<a href="{:url('admin/content/settop',array('id'=>$item['id'],'model_id'=>$model_id,'is_top'=>'0'))}" class="ajax-get">取消置顶</a>
|
||||
{else/}
|
||||
<a href="{:url('admin/content/is_top',array('id'=>$item['id'],'model_id'=>$model_id,'is_top'=>'1'))}" class="ajax-get">置顶</a>
|
||||
<a href="{:url('admin/content/settop',array('id'=>$item['id'],'model_id'=>$model_id,'is_top'=>'1'))}" class="ajax-get">置顶</a>
|
||||
{/if}
|
||||
{/if}
|
||||
{if isset($item['status'])}
|
||||
|
||||
Reference in New Issue
Block a user