删除商品代码:
public function del(){
$id = input('param.id');
$db = db('shop');
$db ->where('id',$id)->delete();
if($db){
return $this->success('删除成功','Index');
}else{
return $this->error('删除失败','Index');
}
}
添加产品代码:
public function add(){
$title = input('param.title');
$content = input('param.content');
if($title <> '' and $content <> ''){
$date = [
['title' => $title , 'content' => $content,]
];
$db = db('shop') -> insertAll($date);
if($db){
return $this->success('商品发布成功','Index');
}else{
return $this->error('商品发布失败','Index');
}
}else{
}
return $this->fetch();
}