更新
This commit is contained in:
@@ -48,7 +48,7 @@ class Channel extends Admin {
|
||||
*/
|
||||
public function editable($name = null, $value = null, $pk = null) {
|
||||
if ($name && ($value != null || $value != '') && $pk) {
|
||||
model('Channel')->where(array('id' => $pk))->setField($name, $value);
|
||||
ChannelM::where(array('id' => $pk))->update([$name => $value]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +58,9 @@ class Channel extends Admin {
|
||||
*/
|
||||
public function add() {
|
||||
if ($this->request->isPost()) {
|
||||
$Channel = model('Channel');
|
||||
$data = $this->request->post();
|
||||
if ($data) {
|
||||
$id = $Channel->save($data);
|
||||
$id = ChannelM::save($data);
|
||||
if ($id) {
|
||||
return $this->success('新增成功', url('index'));
|
||||
//记录行为
|
||||
@@ -70,21 +69,23 @@ class Channel extends Admin {
|
||||
return $this->error('新增失败');
|
||||
}
|
||||
} else {
|
||||
$this->error($Channel->getError());
|
||||
$this->error('新增失败');
|
||||
}
|
||||
} else {
|
||||
$pid = input('pid', 0);
|
||||
//获取父导航
|
||||
if (!empty($pid)) {
|
||||
$parent = db('Channel')->where(array('id' => $pid))->field('title')->find();
|
||||
$parent = ChannelM::where(array('id' => $pid))->field('title')->find();
|
||||
$this->assign('parent', $parent);
|
||||
}
|
||||
|
||||
$pnav = db('Channel')->where(array('pid' => '0'))->select();
|
||||
$this->assign('pnav', $pnav);
|
||||
$this->assign('pid', $pid);
|
||||
$this->assign('info', null);
|
||||
$this->setMeta('新增导航');
|
||||
$pnav = ChannelM::where(array('pid' => '0'))->select();
|
||||
|
||||
$this->data = [
|
||||
'pnav' => $pnav,
|
||||
'pid' => $pid,
|
||||
'info' => ['pid' => $pid]
|
||||
];
|
||||
return $this->fetch('edit');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user