EXPIRY log message : ps

This commit is contained in:
VE10-Sanjeev 2024-01-25 18:18:14 +05:30
parent f802377fe9
commit a8f2e8eca7

View File

@ -482,8 +482,8 @@ class Notifications extends BaseController
return;
}
$emailTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_EMAIL);
foreach ($queryResult as $row) {
echo "Started.<br> Dated = ".$newDate." <br> There are ".count($queryResult)." persons <br>";
foreach ($queryResult as $inx => $row) {
$userFirstName = $row['first_name'];
$userLastName = $row['last_name'];
$fullName = $userFirstName . ' ' . $userLastName;
@ -538,7 +538,7 @@ class Notifications extends BaseController
$history_parent_statement = $NotificationModel->update_notification_history_parent_status(['status' => 1],$history_parent_id,$campaign_id);
$this->logger->info($history_parent_statement);
echo $history_msg;
echo ($inx+1).") ".$history_msg."<br>";
} else {
$history_msg = (strtolower(gettype($emailResult)) == "string" ? $emailResult : json_encode($emailResult)) ;
$history_child_updatedata = ['receiving_status'=>0,'result'=>$history_msg];
@ -548,19 +548,21 @@ class Notifications extends BaseController
$history_parent_statement = $NotificationModel->update_notification_history_parent_status(['status' => 1],$history_parent_id,$campaign_id);
$this->logger->info($history_parent_statement);
echo 'Failed to send email';
echo ($inx+1).") Failed to send email <br>";
}
} else {
$history_msg = 'There is no email template found by the name of EXPIRAY_NOTIFY_TEMPLATE_EMAIL';
// $receiving_status = 0 ;
$this->logger->info($history_msg);
echo $history_msg."<br>";
continue;
}
# EXPIRAY_NOTIFY_TEMPLATE_EMAIL Closed
# EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP
$whatsappTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP);
if (count($whatsappTemplateName) && !empty($whatsappTemplateName)) {
// print_r($whatsappTemplateName);die;
if ((count($whatsappTemplateName) > 0) && !empty($whatsappTemplateName)) {
$campaign_id = 2; // hardcoded because static Template.
$history_parents_data = ['campaign_id' => $campaign_id,'status' => 0];
$history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data);
@ -574,6 +576,7 @@ class Notifications extends BaseController
$history_parent_statement = $NotificationModel->update_notification_history_parent_status(['status' => 1],$history_parent_id,$campaign_id);
$this->logger->info($history_parent_statement);
$this->logger->info($history_msg);
echo ($inx+1).") ".$history_msg."<br>";
continue;
}
# Insertion on History Whatsapp Means Campaign ID 2 Hardcoded
@ -616,15 +619,34 @@ class Notifications extends BaseController
$history_parent_statement = $NotificationModel->update_notification_history_parent_status(['status' => 1],$history_parent_id,$campaign_id);
$this->logger->info($history_parent_statement);
$this->logger->info("EXPIRAY NOTIFY TEMPLATE WHATSAPP Reponse = " . $history_msg);
if(strtolower(gettype($whatsapp_result)) == "string"){
echo ($inx+1).") ".$whatsapp_result."<br>";
}
else{
$result = json_encode($whatsapp_result['reponse']);
$decodedResult = json_decode($result, true);
if ($decodedResult && isset($decodedResult['message']['key']['remoteJid'])) {
$remoteJid = $decodedResult['message']['key']['remoteJid'];
$this->logger->info("EXPIRAY NOTIFY TEMPLATE WHATSAPP Remote Jid = " . $remoteJid);
echo ($inx+1).") Whatsapp sent successfully <br>";
} else {
// echo "Failed to extract remoteJid";
$this->logger->info("EXPIRAY NOTIFY TEMPLATE WHATSAPP Failed to extract remoteJid ");
echo ($inx+1).") Failed to send Whatsapp <br>";
}
}
} else {
// $receiving_status = 0;
$history_msg = 'There is no Whatsapp template found by the name of EXPIRAY NOTIFY TEMPLATE WHATSAPP ';
$this->logger->info($history_msg);
echo "There is no Whatsapp template <br>";
continue;
}
# EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP Closed
}
# Loop Closed
echo "Process Completed <br>";
}
# getExpCustomerDetail fns Closed