更新
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller;
|
||||
use app\common\controller\Admin;
|
||||
namespace app\controller\admin;
|
||||
use app\controller\Admin;
|
||||
|
||||
/**
|
||||
* @title 字段管理
|
||||
@@ -30,19 +30,19 @@ class Attribute extends Admin {
|
||||
$this->attr[$key] = $value[0];
|
||||
}
|
||||
$this->validate_rule = array(
|
||||
0 => '请选择',
|
||||
'regex' => '正则验证',
|
||||
'function' => '函数验证',
|
||||
'unique' => '唯一验证',
|
||||
'length' => '长度验证',
|
||||
'in' => '验证在范围内',
|
||||
'notin' => '验证不在范围内',
|
||||
'between' => '区间验证',
|
||||
0 => '请选择',
|
||||
'regex' => '正则验证',
|
||||
'function' => '函数验证',
|
||||
'unique' => '唯一验证',
|
||||
'length' => '长度验证',
|
||||
'in' => '验证在范围内',
|
||||
'notin' => '验证不在范围内',
|
||||
'between' => '区间验证',
|
||||
'notbetween' => '不在区间验证',
|
||||
);
|
||||
$this->auto_type = array(0 => '请选择', 'function' => '函数', 'field' => '字段', 'string' => '字符串');
|
||||
$this->the_time = array(0 => '请选择', '3' => '始 终', '1' => '新 增', '2' => '编 辑');
|
||||
$this->field = $this->getField();
|
||||
$this->the_time = array(0 => '请选择', '3' => '始 终', '1' => '新 增', '2' => '编 辑');
|
||||
$this->field = $this->getField();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,13 +54,13 @@ class Attribute extends Admin {
|
||||
return $this->error('非法操作!');
|
||||
}
|
||||
$list = model('Attribute')->where('model_id', $model_id)->order('id desc')->paginate(25, false, array(
|
||||
'query' => $this->request->param()
|
||||
));
|
||||
'query' => $this->request->param(),
|
||||
));
|
||||
|
||||
$data = array(
|
||||
'list' => $list,
|
||||
'list' => $list,
|
||||
'model_id' => $model_id,
|
||||
'page' => $list->render(),
|
||||
'page' => $list->render(),
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta('字段管理');
|
||||
@@ -81,7 +81,7 @@ class Attribute extends Admin {
|
||||
}
|
||||
} else {
|
||||
$data = array(
|
||||
'info' => array('model_id' => $model_id),
|
||||
'info' => array('model_id' => $model_id),
|
||||
'fieldGroup' => $this->field,
|
||||
);
|
||||
$this->assign($data);
|
||||
@@ -96,7 +96,7 @@ class Attribute extends Admin {
|
||||
*/
|
||||
public function edit($id = '', $model_id = '') {
|
||||
if ($this->request->isPost()) {
|
||||
$result = $this->model->validate('attribute.edit')->save($this->request->param(), array('id'=>$id));
|
||||
$result = $this->model->validate('attribute.edit')->save($this->request->param(), array('id' => $id));
|
||||
if ($result) {
|
||||
return $this->success("修改成功!", url('Attribute/index', array('model_id' => $model_id)));
|
||||
} else {
|
||||
@@ -105,7 +105,7 @@ class Attribute extends Admin {
|
||||
} else {
|
||||
$info = db('Attribute')->find($id);
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'info' => $info,
|
||||
'fieldGroup' => $this->field,
|
||||
);
|
||||
$this->assign($data);
|
||||
@@ -134,7 +134,7 @@ class Attribute extends Admin {
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//字段编辑所需字段
|
||||
protected function getField() {
|
||||
return array(
|
||||
|
||||
Reference in New Issue
Block a user