|
@@ -238,8 +238,10 @@ class CircleRepository
|
|
//删除图片后,判断该条是否为主信息,如果为主信息,则更新同批次下一条为主信息
|
|
//删除图片后,判断该条是否为主信息,如果为主信息,则更新同批次下一条为主信息
|
|
if($circle->is_main==1){
|
|
if($circle->is_main==1){
|
|
$tempPic = $this->interestCirclePicture->where('patch_num', $circle->patch_num)->first();
|
|
$tempPic = $this->interestCirclePicture->where('patch_num', $circle->patch_num)->first();
|
|
- $tempPic->is_main=1;
|
|
|
|
- $tempPic->save();
|
|
|
|
|
|
+ if($tempPic){
|
|
|
|
+ $tempPic->is_main=1;
|
|
|
|
+ $tempPic->save();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
$this->interestCircle->where('id',$circle->circle_id)->decrement('picture_count');
|
|
$this->interestCircle->where('id',$circle->circle_id)->decrement('picture_count');
|
|
DB::commit();
|
|
DB::commit();
|