Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskonsite-архив-перенесен
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Korolev
taskonsite-архив-перенесен
Commits
ffb9b1da
Commit
ffb9b1da
authored
Mar 16, 2016
by
Шакарим Сапа
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Добавлена проверка на события внутри приложения
parent
578d46ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
common/modules/triggers/controllers/DefaultController.php
common/modules/triggers/controllers/DefaultController.php
+17
-0
No files found.
common/modules/triggers/controllers/DefaultController.php
View file @
ffb9b1da
...
...
@@ -7,6 +7,7 @@ use common\modules\triggers\components\conditions\Conditions;
use
common\modules\triggers\models\TriggerLogs
;
use
common\modules\triggers\models\TriggerSchedule
;
use
common\modules\triggers\models\TriggerTrigger
;
use
common\modules\users\models\User
;
use
\DateTime
;
use
yii\helpers\Json
;
...
...
@@ -59,6 +60,7 @@ class DefaultController extends BaseController
* Метод для крона и ручного вызова. Проверяет таблицу с расписанием, выполняет сработавшие триггеры.
*/
public
function
actionRechecktriggers
(){
// Производим проверку по расписанию
/** @var TriggerTrigger[] $actualTriggers */
// Получили текущую дату и время
$timeNow
=
new
DateTime
();
...
...
@@ -89,5 +91,20 @@ class DefaultController extends BaseController
$model
->
save
();
}
}
// Производим проверку событий
$users
=
User
::
find
()
->
where
(
'id>0'
)
->
all
();
foreach
(
$users
as
$user
)
{
foreach
(
$actualTriggers
as
$trigger
)
{
// Вызвали метод проверки срабатывания условий
$triggerResult
=
Conditions
::
init
()
->
handleUserByTriggerId
(
$user
->
getPrimaryKey
(),
$trigger
->
getPrimaryKey
());
// Если триггер сработал инициируем действие
if
(
$triggerResult
===
true
)
{
$init
=
$trigger
->
initAction
([
'email'
=>
$user
->
email
]);
if
(
$init
!==
true
)
echo
$init
;
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment