Different Reminder for PPPOE and Hotspot using <divider>

This commit is contained in:
iBNu Maksum
2025-03-11 11:55:48 +07:00
parent 827bb8706d
commit 3c7e6c7a64
4 changed files with 109 additions and 24 deletions

View File

@ -393,6 +393,18 @@ class Message
}
}
public static function getMessageType($type, $message){
if(strpos($message, "<divider>") === false){
return $message;
}
$msgs = explode("<divider>", $message);
if($type == "PPPOE"){
return $msgs[1];
}else{
return $msgs[0];
}
}
public static function logMessage($messageType, $recipient, $messageContent, $status, $errorMessage = null)
{
$log = ORM::for_table('tbl_message_logs')->create();

View File

@ -51,23 +51,40 @@ foreach ($d as $ds) {
}
if ($ds['expiration'] == $day7 && $config['notification_reminder_7day'] !== 'no') {
try {
echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_7_day'), $config['user_notification_reminder']) . "\n";
echo Message::sendPackageNotification(
$c,
$p['name_plan'],
$price,
Message::getMessageType($p['type'], Lang::getNotifText('reminder_7_day')),
$config['user_notification_reminder']
) . "\n";
} catch (Exception $e) {
sendTelegram("Cron Reminder failed to send 7-day reminder to " . $ds['username'] . " Error: " . $e->getMessage());
}
} else if ($ds['expiration'] == $day3 && $config['notification_reminder_3day'] !== 'no') {
try {
echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_3_day'), $config['user_notification_reminder']) . "\n";
echo Message::sendPackageNotification(
$c,
$p['name_plan'],
$price,
Message::getMessageType($p['type'], Lang::getNotifText('reminder_3_day')),
$config['user_notification_reminder']
) . "\n";
} catch (Exception $e) {
sendTelegram("Cron Reminder failed to send 3-day reminder to " . $ds['username'] . " Error: " . $e->getMessage());
}
} else if ($ds['expiration'] == $day1 && $config['notification_reminder_1day'] !== 'no') {
try {
echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_1_day'), $config['user_notification_reminder']) . "\n";
echo Message::sendPackageNotification(
$c,
$p['name_plan'],
$price,
Message::getMessageType($p['type'], Lang::getNotifText('reminder_1_day')),
$config['user_notification_reminder']
) . "\n";
} catch (Exception $e) {
sendTelegram("Cron Reminder failed to send 1-day reminder to " . $ds['username'] . " Error: " . $e->getMessage());
}
}
}
}
}

View File

@ -1120,5 +1120,29 @@
"Delete_this_widget_": "Delete this widget?",
"Remove_this_widget_": "Remove this widget?",
"PPPoE_Remote_IP": "PPPoE Remote IP",
"Continue_the_Recharge_process": "Continue the Recharge process"
"Continue_the_Recharge_process": "Continue the Recharge process",
"Contributors": "Contributors",
"Discussions": "Discussions",
"Get_help_from_community": "Get help from community",
"Github_Discussions": "Github Discussions",
"Telegram_Group": "Telegram Group",
"Feedback_and_Bug_Report": "Feedback and Bug Report",
"Give_Feedback": "Give Feedback",
"Chat_with_me": "Chat with me",
"_50_Paid_Support": "$50 Paid Support",
"donation_confirmation_": "donation confirmation?",
"Or_ask_any_Donation_Alternative": "Or ask any Donation Alternative",
"Free_WhatsApp_Gateway_and_Telegram_Bot_creater": "Free WhatsApp Gateway and Telegram Bot creater",
"There_is_a_Telegram_bot_wizard_in_here": "There is a Telegram bot wizard in here",
"is_a_billing_Hotspot_and_PPPOE_for_Mikrotik_using_PHP_and_Mikrotik_API_to_comunicate_with_router__If_you_get_more_profit_with_this_application__please_donate_us_": "is a billing Hotspot and PPPOE for Mikrotik using PHP and Mikrotik API to comunicate with router. If you get more profit with this application, please donate us.",
"Watch_project": "Watch project",
"in_here": "in here",
"Install_Latest_Version": "Install Latest Version",
"Download_Latest_Version": "Download Latest Version",
"Select_Old_Version": "Select Old Version",
"Current_Changelog": "Current Changelog",
"Repo_Changelog": "Repo Changelog",
"If_you_Download_manual_the_update_file__sometime_update_change_database__after_uploading__click_this_button_to_update_database_structure_": "If you Download manual the update file, sometime update change database, after uploading, click this button to update database structure.",
"Update_Database": "Update Database",
"Credits": "Credits"
}