|
...
|
...
|
@@ -30,24 +30,24 @@ class BlogLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function blogSave(){
|
|
|
|
//拼接参数
|
|
|
|
// DB::beginTransaction();
|
|
|
|
// try {
|
|
|
|
DB::beginTransaction();
|
|
|
|
try {
|
|
|
|
$this->param = $this->paramProcessing($this->param);
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']);
|
|
|
|
$route = $this->param['url'];
|
|
|
|
$this->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
|
|
// $this->param['sort'] = $this->setNewsSort();
|
|
|
|
$this->param['sort'] = $this->setNewsSort();
|
|
|
|
$id = $this->model->addReturnId($this->param);
|
|
|
|
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
|
|
|
|
$this->edit(['url'=>$route],['id'=>$id]);
|
|
|
|
}
|
|
|
|
// DB::commit();
|
|
|
|
// }catch (\Exception $e){
|
|
|
|
// DB::rollBack();
|
|
|
|
// $this->fail('error');
|
|
|
|
// }
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
$this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route);
|
|
|
|
$this->curlDelRoute(['new_route'=>$route]);
|
|
|
|
return $this->success();
|
|
...
|
...
|
@@ -62,7 +62,7 @@ class BlogLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function setNewsSort(){
|
|
|
|
$info = $this->model->select(['id','sort'])->orderBy('sort','desc')->first();
|
|
|
|
if($info === false){
|
|
|
|
if(empty($info)){
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return $info['sort']++;
|
...
|
...
|
|