36867 Интеграция с модерацией, реализация cron-task

This commit is contained in:
2019-12-24 17:04:30 +03:00
parent 372c7c9744
commit 580081a388
12 changed files with 429 additions and 68 deletions

View File

@@ -41,7 +41,7 @@ class MoleTask extends \yii\db\ActiveRecord
public function rules()
{
return [
[['parentId', 'isReady', 'childsTotalCount', 'childsCompleted', 'status'], 'required'],
//[['parentId', 'isReady', 'childsTotalCount', 'childsCompleted', 'status'], 'required'],
[['parentId', 'isReady', 'completed', 'priority', 'childsTotalCount', 'childsCompleted'], 'integer'],
[['dateAdd', 'dateStart', 'dateEnd'], 'safe'],
[['params'], 'string'],
@@ -57,7 +57,7 @@ class MoleTask extends \yii\db\ActiveRecord
{
return [
'id' => Yii::t('mole', 'ID'),
/* 'parentId' => Yii::t('mole', 'Parent ID'),
'parentId' => Yii::t('mole', 'Parent ID'),
'dateAdd' => Yii::t('mole', 'Date Add'),
'dateStart' => Yii::t('mole', 'Date Start'),
'dateEnd' => Yii::t('mole', 'Date End'),
@@ -72,7 +72,23 @@ class MoleTask extends \yii\db\ActiveRecord
'childsTotalCount' => Yii::t('mole', 'Childs Total Count'),
'childsCompleted' => Yii::t('mole', 'Childs Completed'),
'status' => Yii::t('mole', 'Status'),
'project' => Yii::t('mole', 'Project'),*/
'project' => Yii::t('mole', 'Project'),
];
}
/**
* Выбираем все строки с project
*/
public function getAllTask()
{
return self::find()
->andWhere([
'project'=> Yii::$app->getModule('cron')->project,
'completed' => 0,
])
->andWhere(['IS', 'dateStart', NULL])
->andWhere(['IS', 'dateEnd', NULL])
// ->andWhere(['<=', 'dateAdd', date('Y-m-d H:i:s')])
->all();
}
}