🐛 修复 BUG

This commit is contained in:
Wisp X
2022-01-19 22:59:20 +08:00
parent 78b87d60f0
commit 95fd2298e7
2 changed files with 7 additions and 1 deletions
@@ -142,10 +142,13 @@ class ImageController extends Controller
{
/** @var User $user */
$user = Auth::user();
$model = Image::with('strategy')->where('user_id', $user->id)->whereIn('id', $request->all() ?: []);
$model = Image::with('strategy', 'album')->where('user_id', $user->id)->whereIn('id', $request->all() ?: []);
DB::transaction(function () use ($model, $user) {
/** @var Image $image */
foreach ($model->cursor() as $image) {
// 相册图片数量更新
$image->album?->decrement('image_num');
// 更新相册图片数量
$image->delete();
}
// 更新数量