mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-04 16:37:06 +00:00
feat: 免打扰导致推送角标数量不对
This commit is contained in:
parent
271d2c97fa
commit
3249501950
@ -159,7 +159,7 @@ class UmengAlias extends AbstractModel
|
||||
->chunkById(100, function ($datas) use ($array) {
|
||||
$uids = $datas->groupBy('userid');
|
||||
foreach ($uids as $uid => $rows) {
|
||||
$array['badge'] = WebSocketDialogMsgRead::whereUserid($uid)->whereReadAt(null)->count();
|
||||
$array['badge'] = WebSocketDialogMsgRead::whereUserid($uid)->whereSilence(0)->whereReadAt(null)->count();
|
||||
$lists = $rows->groupBy('platform');
|
||||
foreach ($lists as $platform => $list) {
|
||||
$alias = $list->pluck('alias')->implode(',');
|
||||
|
||||
@ -12,6 +12,7 @@ use Carbon\Carbon;
|
||||
* @property int|null $msg_id 消息ID
|
||||
* @property int|null $userid 接收会员ID
|
||||
* @property int|null $mention 是否提及(被@)
|
||||
* @property int|null $silence 是否免打扰:0否,1是
|
||||
* @property int|null $email 是否发了邮件
|
||||
* @property int|null $after 在阅读之后才添加的记录
|
||||
* @property string|null $read_at 阅读时间
|
||||
@ -26,6 +27,7 @@ use Carbon\Carbon;
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsgRead whereMention($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsgRead whereMsgId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsgRead whereReadAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsgRead whereSilence($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsgRead whereUserid($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
|
||||
@ -111,10 +111,11 @@ class WebSocketDialogMsgTask extends AbstractTask
|
||||
// 推送目标①:会话成员/群成员
|
||||
$array = [];
|
||||
foreach ($userids AS $userid) {
|
||||
$silence = $this->silence || $silences[$userid];
|
||||
if ($userid == $msg->userid) {
|
||||
$array[$userid] = [
|
||||
'userid' => $userid,
|
||||
'silence' => $this->silence || $silences[$userid],
|
||||
'silence' => $silence,
|
||||
'mention' => false,
|
||||
];
|
||||
} else {
|
||||
@ -124,10 +125,11 @@ class WebSocketDialogMsgTask extends AbstractTask
|
||||
'msg_id' => $msg->id,
|
||||
'userid' => $userid,
|
||||
'mention' => $mention,
|
||||
'silence' => $silence,
|
||||
])->saveOrIgnore();
|
||||
$array[$userid] = [
|
||||
'userid' => $userid,
|
||||
'silence' => $this->silence || $silences[$userid],
|
||||
'silence' => $silence,
|
||||
'mention' => $mention,
|
||||
];
|
||||
// 机器人收到消处理
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddWebSocketDialogMsgReadsAddSilence extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('web_socket_dialog_msg_reads', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('web_socket_dialog_msg_reads', 'silence')) {
|
||||
$table->boolean('silence')->default(0)->nullable()->after('mention')->comment('是否免打扰:0否,1是');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('web_socket_dialog_msg_reads', function (Blueprint $table) {
|
||||
$table->dropColumn("silence");
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user