优化推送筛选

This commit is contained in:
kuaifan 2022-07-08 17:01:35 +08:00
parent a5d0cae884
commit 1542720bc4
2 changed files with 5 additions and 2 deletions

View File

@ -603,7 +603,7 @@ class WebSocketDialogMsg extends AbstractModel
* @param bool $push_self 推送-是否推给自己 * @param bool $push_self 推送-是否推给自己
* @param bool $push_retry 推送-失败后重试1次有时候在事务里执行数据还没生成时会出现找不到消息的情况 * @param bool $push_retry 推送-失败后重试1次有时候在事务里执行数据还没生成时会出现找不到消息的情况
* @param bool|null $push_silence 推送-静默 * @param bool|null $push_silence 推送-静默
* - type = [notice|tag|todo] 默认为true * - type = [text|file|record|meeting] 默认为false
* @return array * @return array
*/ */
public static function sendMsg($action, $dialog_id, $type, $msg, $sender = 0, $push_self = false, $push_retry = false, $push_silence = null) public static function sendMsg($action, $dialog_id, $type, $msg, $sender = 0, $push_self = false, $push_retry = false, $push_silence = null)
@ -623,7 +623,7 @@ class WebSocketDialogMsg extends AbstractModel
} }
} }
if ($push_silence === null) { if ($push_silence === null) {
$push_silence = in_array($type, ['notice', 'tag', 'todo']); $push_silence = !in_array($type, ["text", "file", "record", "meeting"]);
} }
// //
$update_id = preg_match("/^update-(\d+)$/", $action, $match) ? $match[1] : 0; $update_id = preg_match("/^update-(\d+)$/", $action, $match) ? $match[1] : 0;

View File

@ -82,6 +82,7 @@ class EmailNoticeTask extends AbstractTask
if ($userMinute > -1) { if ($userMinute > -1) {
$builder->clone() $builder->clone()
->where("web_socket_dialog_msgs.dialog_type", "user") ->where("web_socket_dialog_msgs.dialog_type", "user")
->whereIn("web_socket_dialog_msgs.type", ["text", "file", "record", "meeting"])
->whereBetween("web_socket_dialog_msgs.created_at", [ ->whereBetween("web_socket_dialog_msgs.created_at", [
Carbon::now()->subMinutes($userMinute + 10), Carbon::now()->subMinutes($userMinute + 10),
Carbon::now()->subMinutes($userMinute) Carbon::now()->subMinutes($userMinute)
@ -94,6 +95,7 @@ class EmailNoticeTask extends AbstractTask
if ($groupMinute > -1) { if ($groupMinute > -1) {
$builder->clone() $builder->clone()
->where("web_socket_dialog_msgs.dialog_type", "group") ->where("web_socket_dialog_msgs.dialog_type", "group")
->whereIn("web_socket_dialog_msgs.type", ["text", "file", "record", "meeting"])
->whereBetween("web_socket_dialog_msgs.created_at", [ ->whereBetween("web_socket_dialog_msgs.created_at", [
Carbon::now()->subMinutes($groupMinute + 10), Carbon::now()->subMinutes($groupMinute + 10),
Carbon::now()->subMinutes($groupMinute) Carbon::now()->subMinutes($groupMinute)
@ -186,6 +188,7 @@ class EmailNoticeTask extends AbstractTask
->where("r.email", 0) ->where("r.email", 0)
->where("r.userid", $userid) ->where("r.userid", $userid)
->where("web_socket_dialog_msgs.dialog_type", $dialogType) ->where("web_socket_dialog_msgs.dialog_type", $dialogType)
->whereIn("web_socket_dialog_msgs.type", ["text", "file", "record", "meeting"])
->take(100) ->take(100)
->get(); ->get();
if (empty($data)) { if (empty($data)) {