Add: send mail batch php - 7days left, overdated

This commit is contained in:
2022-07-24 00:55:21 +09:00
parent 67399ba1ad
commit 8c0fd90136
6 changed files with 216 additions and 39 deletions
@@ -4,40 +4,42 @@
include "./../../web/server/setup/connect_db.php";
include "./../../web/php/mail/mail_sender.php";
//include "./../../web/php/mail/chocomae_info.php";
include "./../../web/php/mail/mail_setting.php";
include "./../../web/php/mail/chocomae_info.php";
include './../../web/server/mail/mail_contents.php';
include './../../web/server/lib/maestro_account_info.php';
include "./../../web/server/mail/send_naver_mail.php";
$maestroList = null;
$maestroList = get_maestro_list();
print_r($maestroList);
$maestroList = get_7days_left_maestro_list();
//print_r($maestroList);
foreach ($maestroList as $maestro) {
$result = sendMailTo7DaysLeftMestroEmail($maestro["maestroName"], $maestro["email"], $maestro["availableActivateDateTime"]);
// printf("result : %s\n", $result);
}
exit;
function get_maestro_list(): array
function get_7days_left_maestro_list(): array
{
global $db_conn;
/*
$query = "
select MaestroID, Name, AccountType, ActivateStatus, AvailableActivateDateTime, AcceptClausesDateTime, PlayerCount
select MaestroID, Name, Email, AccountType, ActivateStatus, AvailableActivateDateTime, AcceptClausesDateTime, PlayerCount
from maestro
where DATE(AvailableActivateDateTime) - INTERVAL 7 DAY = DATE(NOW()) AND ActivateStatus = 1
";
*/
$query = "
select MaestroID, Name, AccountType, ActivateStatus, AvailableActivateDateTime, AcceptClausesDateTime, PlayerCount
from maestro
where DATE(AvailableActivateDateTime) - INTERVAL 70 DAY < DATE(NOW()) AND ActivateStatus = 1
";
$stmt = $db_conn->prepare($query);
$stmt->execute();
$stmt->bind_result($maestroID, $name, $accountType, $activateStatus, $availableActivateDateTime , $acceptClausesDateTime, $playerCount);
$stmt->bind_result($maestroID, $name, $email, $accountType, $activateStatus, $availableActivateDateTime , $acceptClausesDateTime, $playerCount);
$maestroList = array();
while($stmt->fetch()) {
$maestro["maestroID"] = $maestroID;
$maestro["maestroName"] = $name;
$maestro["email"] = $email;
$maestro["accountType"] = $accountType;
$maestro["activateStatus"] = $activateStatus;
$maestro["availableActivateDateTime"] = $availableActivateDateTime;