更新channel模块
This commit is contained in:
@@ -50,19 +50,20 @@ class Category extends Admin {
|
||||
'module_id' => isset($param['module_id']) ? $param['module_id'] : 0,
|
||||
'model_list' => []
|
||||
];
|
||||
// $this->assign('tree', $list);
|
||||
// $this->assign('model_list', $model_list);
|
||||
// $this->assign('model_id', $model_id);
|
||||
// $this->setMeta('栏目列表');
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 编辑字段
|
||||
*/
|
||||
public function editable($name = null, $value = null, $pk = null) {
|
||||
if ($name && ($value != null || $value != '') && $pk) {
|
||||
db('Category')->where(array('id' => $pk))->setField($name, $value);
|
||||
public function editable() {
|
||||
$name = $this->request->param('name', '');
|
||||
$value = $this->request->param('value', '');
|
||||
$pk = $this->request->param('pk', '');
|
||||
|
||||
if ($name && $value && $pk) {
|
||||
$save[$name] = $value;
|
||||
CategoryM::update($save, ['id' => $pk]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,24 +84,26 @@ class Category extends Admin {
|
||||
return $this->error(empty($error) ? '未知错误!' : $error);
|
||||
}
|
||||
} else {
|
||||
$cate = '';
|
||||
if ($pid) {
|
||||
/* 获取上级分类信息 */
|
||||
$cate = db('Category')->find($pid);
|
||||
if (!($cate && 1 == $cate['status'])) {
|
||||
return $this->error('指定的上级分类不存在或被禁用!');
|
||||
}
|
||||
}
|
||||
$subsql = db('Attribute')->where('name', 'category_id')->fetchSql(true)->column('model_id');
|
||||
$model_list = model('Model')->where('id IN ('. $subsql.')')->select();
|
||||
$cate = [];
|
||||
// if ($pid) {
|
||||
// /* 获取上级分类信息 */
|
||||
// $cate = db('Category')->find($pid);
|
||||
// if (!($cate && 1 == $cate['status'])) {
|
||||
// return $this->error('指定的上级分类不存在或被禁用!');
|
||||
// }
|
||||
// }
|
||||
// $subsql = db('Attribute')->where('name', 'category_id')->fetchSql(true)->column('model_id');
|
||||
// $model_list = model('Model')->where('id IN ('. $subsql.')')->select();
|
||||
$model_list = [];
|
||||
|
||||
/* 获取分类信息 */
|
||||
$info = $id ? db('Category')->find($id) : '';
|
||||
$info = $id ? CategoryM::find($id) : [];
|
||||
|
||||
$this->assign('info', $info);
|
||||
$this->assign('model_list', $model_list);
|
||||
$this->assign('category', $cate);
|
||||
$this->setMeta('编辑分类');
|
||||
$this->data = [
|
||||
'info' => $info,
|
||||
'model_list' => $model_list,
|
||||
'category' => $cate
|
||||
];
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user