作者 lyh

gx

... ... @@ -91,7 +91,7 @@ class BlogCategoryLogic extends BaseLogic
*/
public function getLastId($id){
$info = $this->model->read(['pid'=>$id],['id']);
if($info == false){
if($info !== false){
return $this->getLastId($id);
}else{
return $id;
... ...
... ... @@ -101,7 +101,7 @@ class NewsCategoryLogic extends BaseLogic
*/
public function getLastId($id){
$info = $this->model->read(['pid'=>$id],['id']);
if($info == false){
if($info !== false){
return $this->getLastId($id);
}else{
return $id;
... ...
... ... @@ -61,8 +61,8 @@ class NewsLogic extends BaseLogic
public function newsSave()
{
//拼接参数
// DB::beginTransaction();
// try {
DB::beginTransaction();
try {
$this->param = $this->paramProcessing($this->param);
if (isset($this->param['id']) && !empty($this->param['id'])) {
//是否更新路由
... ... @@ -74,11 +74,11 @@ class NewsLogic extends BaseLogic
//更新路由
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
$this->edit(['url' => $route], ['id' => $id]);
// DB::commit();
// } catch (\Exception $e) {
// DB::rollBack();
// $this->fail('系统错误,请联系管理员');
// }
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
//通知更新
$this->updateNotify(['project_id' => $this->user['project_id'], 'type' => RouteMap::SOURCE_NEWS, 'route' => $route]);
return $this->success();
... ...
... ... @@ -349,12 +349,10 @@ class ProductLogic extends BaseLogic
'status'=>$this->param['status']
];
$this->model->edit($param,['id'=>['in',$this->param['id']]]);
//分类关联
foreach ($this->param['id'] as $id){
CategoryRelated::saveRelated($id, $this->param['category_id']);
}
DB::connection('custom_mysql')->commit();
//对应添加关联表
}catch (\Exception $e){
... ...