增加任务动态邮件通知
Signed-off-by: vilson <545522390@qq.com>
This commit is contained in:
parent
b5e6701084
commit
b2d9f4dbbc
@ -187,6 +187,14 @@ function isOpenDingTalkNoticePush()
|
||||
{
|
||||
return config('config.dingtalk_push');
|
||||
}
|
||||
/**
|
||||
* 是否开启钉钉消息推送
|
||||
* @return mixed
|
||||
*/
|
||||
function isOpenMailNoticePush()
|
||||
{
|
||||
return config('config.mail_push');
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期格式标准输出
|
||||
|
@ -9,7 +9,6 @@
|
||||
namespace app\project\behavior;
|
||||
|
||||
|
||||
use app\common\Model\CommonModel;
|
||||
use app\common\Model\Member;
|
||||
use app\common\Model\Notify;
|
||||
use app\common\Model\ProjectLog;
|
||||
@ -17,13 +16,15 @@ use app\common\Model\ProjectVersion;
|
||||
use app\common\Model\TaskMember;
|
||||
use app\common\Model\TaskStages;
|
||||
use app\common\Model\TaskWorkflowRule;
|
||||
use Exception;
|
||||
use mail\Mail;
|
||||
use message\DingTalk;
|
||||
use service\MessageService;
|
||||
use think\Db;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\exception\DbException;
|
||||
use think\facade\Log;
|
||||
use think\facade\Request;
|
||||
|
||||
class Task
|
||||
{
|
||||
@ -279,6 +280,25 @@ class Task
|
||||
$messageDingTalk->sendCorporationMessage($member['dingtalk_userid'], $params);
|
||||
}
|
||||
}
|
||||
if (isOpenMailNoticePush()) {
|
||||
if (config('mail.open')) {
|
||||
$mailer = new Mail();
|
||||
try {
|
||||
$mail = $mailer->mail;
|
||||
$mail->CharSet = 'utf-8';
|
||||
$mail->setFrom(config('mail.Username'), 'pearProject');
|
||||
$mail->addAddress($member['email'], $member['realname']);
|
||||
//Content
|
||||
$mail->isHTML(true);
|
||||
$link = Request::domain() . '/#/project/space/task/' . $task['project_code'];
|
||||
$mail->Subject = '[任务动态] ' . $notifyData['title'];
|
||||
$mail->Body = "[任务] {$notifyData['content']} <a href='{$link}' target='_blank'>点击查看项目</a>";
|
||||
$mail->send();
|
||||
} catch (Exception $e) {
|
||||
ob_clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isOpenNoticePush()) {
|
||||
$socketMessage['notify'] = $result;
|
||||
$messageService->sendToUid($taskMember['member_code'], $socketMessage, $socketAction);
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
return [
|
||||
'notice_push' => false, //是否开启websocket消息推送
|
||||
'notice_push' => true, //是否开启websocket消息推送
|
||||
'dingtalk_push' => false, //是否开启钉钉消息推送
|
||||
'mail_push' => false, //是否开启邮件消息推送
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user