作者 liyuhang

gx

... ... @@ -59,19 +59,19 @@ class NewsLogic extends BaseLogic
$this->param['created_at'] = date('Y-m-d H:i:s',time());
$this->param['updated_at'] = date('Y-m-d H:i:s',time());
$this->param['category_id'] = ','.$this->param['category_id'].',';
DB::beginTransaction();
try {
// DB::beginTransaction();
// try {
if(isset($this->param['image'])){
$data = $this->upload();
$this->param['image'] = $data;
}
$rs = $this->model->insertGetId($this->param);
RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $rs, $this->user['project_id']);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('添加失败',Code::USER_ERROR);
}
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('添加失败',Code::USER_ERROR);
// }
//TODO::写入日志
$this->success();
}
... ...