0
定時任務執行所以,我有下面的代碼cron作業:(PHP-Yii開發羣組)不停止
class UGCJReminder extends UGCronJob {
/**
* return the cron description
*/
protected function getDescription()
{
return Yii::t('userGroupsModule.cron', 'manda email para os usuarios cadastrados para cadastrar suas atividades');
}
/**
* return the cron table model name
*/
protected function getCronTable()
{
return 'UserGroupsCron';
}
/**
* return the cron name
*/
protected function getName()
{
return 'reminder';
}
/**
* returns the number of days that have to pass before performing this cron job
*/
protected function getLapse()
{
return 1;
}
/**
* return the model
*/
protected function getModel()
{
return new UserGroupsUser;
}
/**
* return the action method
*/
protected function getAction()
{
Yii::import('ext.yii-mail.YiiMailMessage');
$message = new YiiMailMessage;
$message->setBody('Message', 'text/html');
$message->subject = 'Lembrete';
$message->addTo('my-email');
$message->from = Yii::app()->params['adminEmail'];
return Yii::app()->mail->send($message);
}
/**
* return the action criteria
*/
protected function getCriteria()
{
return new CDbCriteria;
}
/**
* return the interested database fields
*/
protected function getColumns()
{
return array('email' => UserGroupsUser::ACTIVE);
#return NULL;
}
}
我做的文檔該羣組中的所有其他變化(Yii的模塊)要求,和cron列表說我的cron已經安裝並正在運行。但是,它每天運行多次,每天只運行一次。那麼我做錯了什麼?
我還會接受針對此問題的另一個解決方案(每天在確定的時間發送電子郵件)。請考慮我正在使用Yii,並且因此想在框架內執行此操作(例如擴展名)
PS:如果您知道良好的文檔來源(因爲Usergroups,Cron-tab和Yii本身不是那麼強大的記錄如何所有這些工作)關於這一切,我仍然會對此感興趣
由於cron作業在我點擊cron作業選項卡(在用戶組管理頁面上)後立即加載,我無法輸入這部分代碼來檢查。我懷疑這是有點因爲這個,但我結束了使用服務器crontab來做我所需要的。感謝你的回答 :) –