Add sendTime control for preregister email

This commit is contained in:
sas.fajri
2026-05-08 14:59:50 +07:00
parent 98ad7346fa
commit f9d3e0674b
5 changed files with 151 additions and 14 deletions

View File

@@ -438,6 +438,28 @@ class Email_gateway extends MY_Controller
$max_per_batch = 20;
$this->log($log_type, "Start Process $log_type Email");
$send_time = '20:00:00';
$sql_cfg = "SELECT Email_ConfigNofificationSendTime
FROM email_config_nofification
WHERE Email_ConfigNofificationIsActive = 'Y'
ORDER BY Email_ConfigNofificationID DESC
LIMIT 1";
$que_cfg = $this->db->query($sql_cfg);
if ($que_cfg && $que_cfg->num_rows() > 0) {
$cfg = $que_cfg->row_array();
if (!empty($cfg['Email_ConfigNofificationSendTime'])) {
$send_time = $cfg['Email_ConfigNofificationSendTime'];
}
}
$send_time_with_delay = date("H:i:s", strtotime($send_time . " +10 minutes"));
$now_time = date("H:i:s");
if ($now_time < $send_time_with_delay) {
$this->log($log_type, "Skip process, current time $now_time < send time+delay $send_time_with_delay");
exit;
}
$tmp_mark_file = "/xtmp/{$log_type}-file.json";
$this->load->library("Gmail");
$is_running = false;