作者 liyuhang

gx

... ... @@ -135,12 +135,13 @@ class BaseLogic extends Logic
foreach ($data as $v){
$this->set_num($model,$v,$type,$num);
}
}
}else{
if($type == 'del'){
$model::where('id',$data)->decrement('num',$num);
}else{
$model::where('id',$data)->increment('num',$num);
}
}
return true;
}
}
... ...
... ... @@ -196,12 +196,10 @@ class BlogLogic extends BaseLogic
$str = $this->get_category_id($ids);
DB::beginTransaction();
try {
if(!empty($str)){
$category_data = explode(',',$str);
$this->set_num(BlogCategoryModel::class,$category_data,'del');
$this->param['id'] = ['in',$this->param['id']];
$this->del($this->param,$ids);
}
DB::commit();
}catch (Exception $e){
DB::rollBack();
... ...
... ... @@ -186,12 +186,10 @@ class NewsLogic extends BaseLogic
$str = $this->get_category_id($ids);
DB::beginTransaction();
try {
if(!empty($str)){
$category_data = explode(',',$str);
$this->set_num(NewsCategoryModel::class,$category_data,'del');
$this->param['id'] = ['in',$this->param['id']];
$this->del($this->param,$ids);
}
DB::commit();
}catch (Exception $e){
DB::rollBack();
... ...