|
|
@@ -6,6 +6,7 @@ namespace common\libs\taskQueue;
|
|
|
|
|
|
use common\helpers\Cache;
|
|
|
use common\helpers\Date;
|
|
|
+use common\helpers\DingTalk;
|
|
|
use common\models\forms\HistoryBonusForm;
|
|
|
use common\models\TaskQueue;
|
|
|
use SebastianBergmann\CodeCoverage\Report\PHP;
|
|
|
@@ -42,4 +43,24 @@ class TaskFunc
|
|
|
public static function testTaskQueue(){
|
|
|
print_r('执行到测试任务'.PHP_EOL);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始化自动发送钉钉提醒任务
|
|
|
+ */
|
|
|
+ public static function initAutoSendDingTalk() {
|
|
|
+ // 查看数据库中是否存在未开始的任务,如果没有就添加一个新任务
|
|
|
+ if(!TaskQueue::find()->where('TYPE=:TYPE AND CONTENT=:CONTENT AND STARTED_AT>:STARTED_AT', [':TYPE'=>Queue::TYPE_FUNC, ':CONTENT'=>TaskFunc::class.'::autoSendDingTalkTable', ':STARTED_AT'=>Date::nowTime()])->asArray()->exists()){
|
|
|
+ // 获取站点配置中的备份时间
|
|
|
+ $config = Cache::getSystemConfig();
|
|
|
+ $sendDingTalkTime = (int)$config['sendDingTalkTime']['VALUE'];
|
|
|
+ Queue::instance()->addTask(Queue::TYPE_FUNC, TaskFunc::class.'::autoSendDingTalkTable', [], Queue::LOOP_TYPE_DAY, $sendDingTalkTime . ':00', 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自动送钉钉提醒
|
|
|
+ */
|
|
|
+ public static function autoSendDingTalkTable() {
|
|
|
+ DingTalk::sendNotice('(NG)提醒:自动发送...');
|
|
|
+ }
|
|
|
}
|