1、修复bug
2、创建模型字段问题
This commit is contained in:
@@ -176,7 +176,7 @@ class Group extends Admin {
|
||||
|
||||
//模块
|
||||
$model = db('model')->field('id,title,name')
|
||||
->where(array('status' => array('gt', 0), 'extend' => array('gt', 0)))
|
||||
->where(array('status' => array('gt', 0)))
|
||||
->select();
|
||||
//扩展权限
|
||||
$extend_auth = db('AuthExtend')->where(array('group_id' => $id, 'type' => 2))->column('extend_id');
|
||||
|
||||
@@ -52,10 +52,10 @@ class Model extends Admin {
|
||||
//记录行为
|
||||
action_log('add_model', 'model', $result, session('auth_user.uid'));
|
||||
$this->success('创建成功!', url('admin/model/index'));
|
||||
}else{
|
||||
} else {
|
||||
return $this->error($this->model->getError() ? $this->model->getError() : '模型标识为保留名称!');
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$this->setMeta('新增模型');
|
||||
return $this->fetch();
|
||||
}
|
||||
@@ -67,15 +67,15 @@ class Model extends Admin {
|
||||
*/
|
||||
public function edit(\think\Request $request) {
|
||||
if (IS_POST) {
|
||||
$result = $this->model->validate('Model.edit')->save($request->post(), array('id'=>$request->post('id')));
|
||||
$result = $this->model->validate('Model.edit')->save($request->post(), array('id' => $request->post('id')));
|
||||
if (false !== $result) {
|
||||
//记录行为
|
||||
action_log('update_model', 'model', $request->post('id'), session('auth_user.uid'));
|
||||
$this->success('更新成功!', url('admin/model/index'));
|
||||
}else{
|
||||
} else {
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$info = $this->model->where('id', $request->param('id'))->find();
|
||||
|
||||
$field_group = parse_config_attr($info['attribute_group']);
|
||||
@@ -87,14 +87,15 @@ class Model extends Admin {
|
||||
$list[$field['group_id']][] = $field;
|
||||
}
|
||||
foreach ($field_group as $key => $value) {
|
||||
$fields[$value] = isset($list[$key]) ? $list[$key] : array();
|
||||
$fields[$key] = isset($list[$key]) ? $list[$key] : array();
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$fields = array();
|
||||
}
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'fields' => $fields
|
||||
'info' => $info,
|
||||
'field_group' => $field_group,
|
||||
'fields' => $fields,
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta('编辑模型');
|
||||
@@ -148,7 +149,7 @@ class Model extends Admin {
|
||||
$result = $this->model->where($map)->update($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('状态设置成功!');
|
||||
}else{
|
||||
} else {
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ return array(
|
||||
'uid' => array('name' => 'uid', 'title' => '用户UID', 'type' => 'num', 'length' => 11, 'extra' => '', 'remark' => '用户UID', 'is_show' => 0, 'is_must' => 1, 'value'=>'0'),
|
||||
'cover_id' => array('name' => 'cover_id', 'title' => '内容封面', 'type' => 'image', 'length' => 10, 'extra' => '', 'remark' => '内容封面', 'is_show' => 1, 'is_must' => 0, 'value'=>''),
|
||||
'description' => array('name' => 'description', 'title' => '内容描述', 'type' => 'textarea', 'length' => '', 'extra' => '', 'remark' => '内容描述', 'is_show' => 1, 'is_must' => 0, 'value'=>''),
|
||||
'content' => array('name' => 'content', 'title' => '内容', 'type' => 'editor', 'length' => '', 'extra' => '', 'remark' => '内容', 'is_show' => 1, 'is_must' => 0, 'value'=>''),
|
||||
'status' => array('name' => 'status', 'title' => '数据状态', 'type' => 'select', 'length' => 2, 'extra' => "-1:删除\r\n0:禁用\r\n1:正常\r\n2:待审核\r\n3:草稿", 'remark' => '数据状态', 'is_show' => 1, 'is_must' => 1, 'value'=>'1'),
|
||||
'is_top' => array('name' => 'is_top', 'title' => '是否置顶', 'type' => 'bool', 'length' => 2, 'extra' => '', 'remark' => '是否置顶', 'is_show' => 0, 'is_must' => 1, 'value'=>'0'),
|
||||
'view' => array('name' => 'view', 'title' => '浏览数量', 'type' => 'num', 'length' => 11, 'extra' => '', 'remark' => '浏览数量', 'is_show' => 0, 'is_must' => 1, 'value'=>'0'),
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<div class="col-lg-10 boards" id="attribute_group_sort">
|
||||
{volist name="fields" id="field"}
|
||||
<div class="board panel panel-info">
|
||||
<div class="panel-heading">{$key}</div>
|
||||
<div class="panel-heading">{$field_group[$key]}</div>
|
||||
<div class="panel-body">
|
||||
<div class="board-list" data-group="{$key}">
|
||||
{foreach name="field" item="item" key="k"}
|
||||
|
||||
Reference in New Issue
Block a user