退会画面修正 - ログ出力追加、コメント追加
All checks were successful
Deploy preview (main_higashide) / deploy (push) Successful in 14s
All checks were successful
Deploy preview (main_higashide) / deploy (push) Successful in 14s
This commit is contained in:
parent
6d4d72e7c2
commit
c7a6c39e3f
@ -20,10 +20,14 @@ class UserWithdrawController extends Controller
|
||||
}
|
||||
$user_name = DB::table('user')->where('user_id', $user_id)->value('user_name');
|
||||
|
||||
\Log::info('退会確認画面にアクセス', [
|
||||
'user_id' => $user_id,
|
||||
]);
|
||||
|
||||
return view('user.withdraw_confirm')
|
||||
->with([
|
||||
'active_menu' => 'SWC-1-1',
|
||||
'user_name' => $user_name ?: '',
|
||||
'active_menu' => 'SWC-1-1', // マイページメニューの選択状態用
|
||||
'user_name' => $user_name ?: '', // ユーザー名(ヘッダー用)
|
||||
]);
|
||||
}
|
||||
|
||||
@ -38,6 +42,8 @@ class UserWithdrawController extends Controller
|
||||
$user = DB::table('user')->where('user_id', $user_id)->first();
|
||||
|
||||
$now = now();
|
||||
|
||||
// 利用者マスタの退会フラグを立てる
|
||||
DB::table('user')
|
||||
->where('user_id', $user_id)
|
||||
->update([
|
||||
@ -46,7 +52,7 @@ class UserWithdrawController extends Controller
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
|
||||
// 定期空き予約マスタ(reserve)の該当ユーザーのupdated_atを退会日時で更新
|
||||
// 定期空き予約マスタ(reserve)の予約を無効に更新
|
||||
DB::table('reserve')
|
||||
->where('user_id', $user_id)
|
||||
->update([
|
||||
@ -76,18 +82,24 @@ class UserWithdrawController extends Controller
|
||||
|
||||
if (!$contract) {
|
||||
// 契約なし→退会完了画面
|
||||
\Log::info('退会完了画面にアクセス', [
|
||||
'user_id' => $user_id,
|
||||
]);
|
||||
session()->forget('user_id');
|
||||
return view('user.withdraw_complete')->with([
|
||||
'active_menu' => 'SWC-1-1', // この画面のID
|
||||
'active_menu' => 'SWC-1-1', // マイページメニューの選択状態用
|
||||
'user_name' => $user ? $user->user_name : '', // ユーザー名(ヘッダー用)
|
||||
]);
|
||||
}
|
||||
|
||||
// 有効性判定
|
||||
if ($contract->contract_cancel_flag == 1 || $contract->contract_cancel_flag == 2) {
|
||||
\Log::info('退会完了画面にアクセス', [
|
||||
'user_id' => $user_id,
|
||||
]);
|
||||
session()->forget('user_id');
|
||||
return view('user.withdraw_complete')->with([
|
||||
'active_menu' => 'SWC-1-1', // この画面のID
|
||||
'active_menu' => 'SWC-1-1', // マイページメニューの選択状態用
|
||||
'user_name' => $user ? $user->user_name : '', // ユーザー名(ヘッダー用)
|
||||
]);
|
||||
}
|
||||
@ -100,9 +112,12 @@ class UserWithdrawController extends Controller
|
||||
|
||||
// 今月までなら退会完了
|
||||
if ($contract_year == $today_year && $contract_month == $today_month) {
|
||||
\Log::info('退会完了画面にアクセス', [
|
||||
'user_id' => $user_id,
|
||||
]);
|
||||
session()->forget('user_id');
|
||||
return view('user.withdraw_complete')->with([
|
||||
'active_menu' => 'SWC-1-1', // この画面のID
|
||||
'active_menu' => 'SWC-1-1', // マイページメニューの選択状態用
|
||||
'user_name' => $user ? $user->user_name : '', // ユーザー名(ヘッダー用)
|
||||
]);
|
||||
}
|
||||
@ -122,18 +137,23 @@ class UserWithdrawController extends Controller
|
||||
'updated_at' => $now,
|
||||
'operator_id' => null,
|
||||
]);
|
||||
\Log::info('退会完了画面にアクセス', [
|
||||
'user_id' => $user_id,
|
||||
]);
|
||||
session()->forget('user_id');
|
||||
return view('user.withdraw_complete')->with([
|
||||
'active_menu' => 'SWC-1-1', // この画面のID
|
||||
'active_menu' => 'SWC-1-1', // マイページメニューの選択状態用
|
||||
'user_name' => $user ? $user->user_name : '', // ユーザー名(ヘッダー用)
|
||||
]);
|
||||
}
|
||||
// どのifにも該当しない場合は退会完了画面にエラーメッセージを表示
|
||||
return view('user.withdraw_confirm')->with([
|
||||
'active_menu' => 'SWC-1-1',
|
||||
'user_name' => $user ? $user->user_name : '',
|
||||
\Log::info('退会完了画面にアクセス(エラーにつき退会失敗表示)', [
|
||||
'user_id' => $user_id,
|
||||
]);
|
||||
'active_menu' => 'SWC-1-1', // マイページメニューの選択状態用
|
||||
'user_name' => $user ? $user->user_name : '', // ユーザー名(ヘッダー用)
|
||||
'error_message' => '退会処理に失敗しました。申し訳ございませんが、So-Managerコールセンター(03-5856-4720)にご連絡をお願いいたします。',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user