-1
我有一個每月定期帳單,並且我希望在到期前6天向該人發送電子郵件,並且如果它已經發送,則不會重新發送。在PHP中工作。我目前在db:paidUntil和sentReminder中有兩列,都是DATETIME,但如有必要可以更改。日期範圍 - 在一個範圍內,但不超過 - 在PHP
因此,在僞代碼:
IF(between 6 days before expiration and expiration date AND reminder NOT sent)
send reminder
set that reminder was already sent
else
if the month has past and time for new reminder, go back to top
下個月重新啓動整個過程。請注意,人們可能會在第1天,第9天或本月的任何給定日期到期。請幫忙!
編輯:我基本上希望在會員到期前6或5天發送一次提醒,每個月。就這樣。這裏是我的一些代碼,但我一直徘徊在如何檢查我發送上次提醒的時間是否已經足夠通過以生成新的提醒...抱歉,所有評論都在這裏!
$paidUntil = strtotime($oneUser->paidUntil);
$paidUntilMonthPrior = strtotime('-1 month', $paidUntil);
$reminderSent = strtotime($oneUser->reminderSent);
//$paidDateRemindRange = strtotime('-6 days', $paidUntil); //6 days till u remind somebody
$noNeedToSend = strtotime('+25 days', $reminderSent);
//$paidDateReset = strtotime('+1 day', $paidUntil);
//if($thisMonth==date('F',$paidUntil)) {
// $sameMonth=true;
//}
//if($todayTime>$paidDateReminder && $todayTime<$paidUntil && $todayTime>$reminderSent)
// $expirationRange=true;
if($todayTime < $noNeedToSend) {
// is within 25 days from last sending - do nothing
}
elseif($todayTime>$noNeedToSend && $todayTime<$paidUntil) {
//is between 25 days and still less than the paid until time AND has not been sent this cycle
// send expiration email and mark that its been sent
$expirationRange=true;
}
你需要什麼幫助?聽起來很適合我。 – ceejayoz 2012-04-05 21:14:06
你到目前爲止嘗試過什麼?我們將幫助修復損壞的代碼,但不會從頭開始爲您編寫此代碼。表明你已經付出了一些努力。 – 2012-04-05 21:14:33
這些人都說了什麼。發佈一些代碼,你的解釋和僞代碼看起來不像他們在談論同樣的過程給我。 – rgin 2012-04-05 21:17:17