Compare commits
2 Commits
32cd4f873c
...
ab6029e1c8
| Author | SHA1 | Date | |
|---|---|---|---|
| ab6029e1c8 | |||
| 9db2776167 |
@ -764,10 +764,6 @@ class RegularContractCreateController extends Controller
|
|||||||
$month = $request->input('month');
|
$month = $request->input('month');
|
||||||
$price = $request->input('price_' . $month);
|
$price = $request->input('price_' . $month);
|
||||||
|
|
||||||
\Log::info('契約期間更新処理', [
|
|
||||||
'month' => $month,
|
|
||||||
'price' => $price,
|
|
||||||
]);
|
|
||||||
$today = now();
|
$today = now();
|
||||||
$day = $today->day;
|
$day = $today->day;
|
||||||
if ($day <= 19) {
|
if ($day <= 19) {
|
||||||
|
|||||||
@ -75,12 +75,12 @@ class UserWithdrawController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 退会契約チェック
|
// 退会契約チェック
|
||||||
$contract = DB::table('regular_contract')
|
$contracts = DB::table('regular_contract')
|
||||||
->where('user_id', $user_id)
|
->where('user_id', $user_id)
|
||||||
->orderByDesc('contract_id')
|
->orderByDesc('contract_id')
|
||||||
->first();
|
->get();
|
||||||
|
|
||||||
if (!$contract) {
|
if ($contracts->isEmpty()) {
|
||||||
// 契約なし→退会完了画面
|
// 契約なし→退会完了画面
|
||||||
\Log::info('退会完了画面にアクセス', [
|
\Log::info('退会完了画面にアクセス', [
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
@ -92,68 +92,53 @@ class UserWithdrawController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 有効性判定
|
foreach ($contracts as $contract) {
|
||||||
if ($contract->contract_cancel_flag == 1 || $contract->contract_cancel_flag == 2) {
|
// 有効性判定
|
||||||
\Log::info('退会完了画面にアクセス', [
|
if ($contract->contract_cancel_flag == 1 || $contract->contract_cancel_flag == 2) {
|
||||||
'user_id' => $user_id,
|
continue; // この契約はスキップして次へ
|
||||||
]);
|
}
|
||||||
session()->forget('user_id');
|
|
||||||
return view('user.withdraw_complete')->with([
|
|
||||||
'active_menu' => 'SWC-1-1', // マイページメニューの選択状態用
|
|
||||||
'user_name' => $user ? $user->user_name : '', // ユーザー名(ヘッダー用)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 契約期間のyear/month取得
|
// 契約期間のyear/month取得
|
||||||
$contract_year = date('Y', strtotime($contract->contract_periode));
|
$contract_year = $contract->contract_periode ? date('Y', strtotime($contract->contract_periode)) : null;
|
||||||
$contract_month = date('m', strtotime($contract->contract_periode));
|
$contract_month = $contract->contract_periode ? date('m', strtotime($contract->contract_periode)) : null;
|
||||||
$today_year = $now->year;
|
$today_year = $now->year;
|
||||||
$today_month = $now->month;
|
$today_month = $now->month;
|
||||||
|
|
||||||
// 今月までなら退会完了
|
// 年月が空欄の場合は次の契約へ
|
||||||
if ($contract_year == $today_year && $contract_month == $today_month) {
|
if (empty($contract_year) || empty($contract_month)) {
|
||||||
\Log::info('退会完了画面にアクセス', [
|
continue;
|
||||||
'user_id' => $user_id,
|
}
|
||||||
]);
|
|
||||||
session()->forget('user_id');
|
|
||||||
return view('user.withdraw_complete')->with([
|
|
||||||
'active_menu' => 'SWC-1-1', // マイページメニューの選択状態用
|
|
||||||
'user_name' => $user ? $user->user_name : '', // ユーザー名(ヘッダー用)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 翌月以降なら返金処理キュー登録
|
// 今月までなら次の契約へ
|
||||||
if ($contract_year > $today_year || ($contract_year == $today_year && $contract_month > $today_month)) {
|
if ($contract_year == $today_year && $contract_month == $today_month) {
|
||||||
DB::table('operator_que')->insert([
|
continue;
|
||||||
'que_class' => 13,
|
}
|
||||||
'user_id' => $user_id,
|
|
||||||
'contract_id' => $contract->contract_id,
|
// 翌月以降なら返金処理キュー登録
|
||||||
'park_id' => $contract->park_id,
|
if ($contract_year > $today_year || ($contract_year == $today_year && $contract_month > $today_month)) {
|
||||||
'que_comment' => null,
|
DB::table('operator_que')->insert([
|
||||||
'que_status' => 1,
|
'que_class' => 13,
|
||||||
'que_status_comment' => '返金処理が必要な契約があります',
|
'user_id' => $user_id,
|
||||||
'work_instructions' => 'お客様にの契約を確認し、退会後の返金処理をおこなってください。',
|
'contract_id' => $contract->contract_id,
|
||||||
'created_at' => $now,
|
'park_id' => $contract->park_id,
|
||||||
'updated_at' => $now,
|
'que_comment' => null,
|
||||||
'operator_id' => null,
|
'que_status' => 1,
|
||||||
]);
|
'que_status_comment' => '返金処理が必要な契約があります',
|
||||||
\Log::info('退会完了画面にアクセス', [
|
'work_instructions' => 'お客様にの契約を確認し、退会後の返金処理をおこなってください。',
|
||||||
'user_id' => $user_id,
|
'created_at' => $now,
|
||||||
]);
|
'updated_at' => $now,
|
||||||
session()->forget('user_id');
|
'operator_id' => null,
|
||||||
return view('user.withdraw_complete')->with([
|
]);
|
||||||
'active_menu' => 'SWC-1-1', // マイページメニューの選択状態用
|
}
|
||||||
'user_name' => $user ? $user->user_name : '', // ユーザー名(ヘッダー用)
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
// どのifにも該当しない場合は退会完了画面にエラーメッセージを表示
|
// 全件確認後に退会完了画面へ
|
||||||
\Log::info('退会完了画面にアクセス(エラーにつき退会失敗表示)', [
|
\Log::info('退会完了画面にアクセス', [
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
]);
|
]);
|
||||||
return view('user.withdraw_confirm')->with([
|
session()->forget('user_id');
|
||||||
|
return view('user.withdraw_complete')->with([
|
||||||
'active_menu' => 'SWC-1-1', // マイページメニューの選択状態用
|
'active_menu' => 'SWC-1-1', // マイページメニューの選択状態用
|
||||||
'user_name' => $user ? $user->user_name : '', // ユーザー名(ヘッダー用)
|
'user_name' => $user ? $user->user_name : '', // ユーザー名(ヘッダー用)
|
||||||
'error_message' => '退会処理に失敗しました。申し訳ございませんが、So-Managerコールセンター(03-5856-4720)にご連絡をお願いいたします。',
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user