增加RESEND信件功能、修正信件流水編號錯誤
This commit is contained in:
@ -331,4 +331,91 @@ class MetabolismFillFormController extends Controller
|
||||
}
|
||||
return redirect()->back()->with('success', '您已審格通過!');
|
||||
}
|
||||
|
||||
public function doResendNotifyGet(Request $request)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
$from = date('2025-06-26 16:43:00');
|
||||
$to = date('2025-07-13 11:07:00');
|
||||
$entries = EventMetabolism::whereBetween('updated_at', [$from, $to])->skip(0)->take(50)->get();
|
||||
|
||||
foreach($entries as $entry)
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
switch($entry->check_state) {
|
||||
case '1': //待審
|
||||
|
||||
Mail::to($entry->email)->send(new EventNotifyMail(
|
||||
'桃園市政府衛生局114年桃園市健康管理計畫「符合代謝新收案,早鳥報名最划算」登記成功信件',
|
||||
[
|
||||
"title" => "符合代謝新收案,早鳥報名最划算 登記成功!",
|
||||
"body" => "我們將於3個工作天內進行審核您的資料,並通知您審核結果,敬請留意收信。"
|
||||
."\n\n登記資料:"
|
||||
."\n流水號: A-".str_pad($entry->id, 6, '0', STR_PAD_LEFT)
|
||||
."\n就醫院所:".$entry->hospital_name
|
||||
."\n姓名:".(mb_strlen($entry->name) > 2 ? mb_substr($entry->name,0,1)."*".mb_substr($entry->name,-1) : mb_substr($entry->name,0,1)."*")
|
||||
."\n身份證字號:".substr($entry->twid,0,2)."****".substr($entry->twid,-4)
|
||||
."\n電話號碼:".substr($entry->phone,0,2)."****".substr($entry->phone,-4)
|
||||
,
|
||||
]));
|
||||
|
||||
|
||||
break;
|
||||
case '2': //過通
|
||||
|
||||
Mail::to($entry->email)->send(new EventNotifyMail(
|
||||
'桃園市政府衛生局114年桃園市健康管理計畫「符合代謝新收案,早鳥報名最划算」審核通過信件。',
|
||||
[
|
||||
"title" => "符合代謝新收案,早鳥報名最划算 審核通過!",
|
||||
"body" => "登記資料:"
|
||||
."\n流水號: A-".str_pad($entry->id, 6, '0', STR_PAD_LEFT)
|
||||
."\n就醫院所:".$entry->hospital_name
|
||||
."\n姓名:".(mb_strlen($entry->name) > 2 ? mb_substr($entry->name,0,1)."*".mb_substr($entry->name,-1) : mb_substr($entry->name,0,1)."*")
|
||||
."\n身份證字號:".substr($entry->twid,0,2)."****".substr($entry->twid,-4)
|
||||
."\n電話號碼:".substr($entry->phone,0,2)."****".substr($entry->phone,-4)
|
||||
."\n\n禮券發送方式說明:"
|
||||
."\n凡報名經審核通過者,我們將於3個工作天內,將7-ELEVEN電子禮券序號寄送至您報名時所填寫的電子信箱,敬請留意收信。"
|
||||
."\n抽獎說明:"
|
||||
."\n本活動將於10月抽出得獎名單並公告於「<a href=\"". route('news') ."\" target=\"_blank\">活動網站/最新消息</a>」及「<a href=\"https://dph.tycg.gov.tw/News.aspx?n=4219&sms=10121\" target=\"_blank\">桃園市政府衛生局網站/訊息公告/最新消息</a>」。"
|
||||
,
|
||||
]));
|
||||
|
||||
|
||||
break;
|
||||
case '3': //未通過
|
||||
|
||||
Mail::to($entry->email)->send(new EventNotifyMail(
|
||||
'桃園市政府衛生局114年桃園市健康管理計畫「符合代謝新收案,早鳥報名最划算」審核未通過信件。',
|
||||
[
|
||||
"title" => "符合代謝新收案,早鳥報名最划算 審核未通過!",
|
||||
"body" => "抱歉,您的審核未通過!請依以下理由重新上活動網站登記。"
|
||||
."\n理由:".$entry->check_reson
|
||||
."\n\n登記資料:"
|
||||
."\n流水號: A-".str_pad($entry->id, 6, '0', STR_PAD_LEFT)
|
||||
."\n就醫院所:".$entry->hospital_name
|
||||
."\n姓名:".(mb_strlen($entry->name) > 2 ? mb_substr($entry->name,0,1)."*".mb_substr($entry->name,-1) : mb_substr($entry->name,0,1)."*")
|
||||
."\n身份證字號:".substr($entry->twid,0,2)."****".substr($entry->twid,-4)
|
||||
."\n電話號碼:".substr($entry->phone,0,2)."****".substr($entry->phone,-4)
|
||||
,
|
||||
]));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$entry->updated_at = \Carbon\Carbon::now();
|
||||
$entry->save();
|
||||
|
||||
$result[] = ['id' => $entry->id, 'email' => $entry->email, 'state' => $entry->check_state, 'reason' => $entry->check_reson];
|
||||
} catch (Exception $ex) {
|
||||
$result[] = ['id' => $entry->id, 'email' => $entry->email, 'state' => $entry->check_state, 'reason' => $entry->check_reson, 'err' => $ex->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user