mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-05 20:10:26 +00:00
perf: 优化自己的对话不限修改撤回时间
This commit is contained in:
parent
dcf96e2bf5
commit
923016197a
@ -1082,11 +1082,11 @@ class DialogController extends AbstractController
|
|||||||
$dialogIds = $dialog_ids ? explode(',', $dialog_ids) : [$dialog_id ?: 0];
|
$dialogIds = $dialog_ids ? explode(',', $dialog_ids) : [$dialog_id ?: 0];
|
||||||
foreach ($dialogIds as $dialog_id) {
|
foreach ($dialogIds as $dialog_id) {
|
||||||
//
|
//
|
||||||
WebSocketDialog::checkDialog($dialog_id);
|
$dialog = WebSocketDialog::checkDialog($dialog_id);
|
||||||
//
|
//
|
||||||
if ($update_id > 0) {
|
if ($update_id > 0) {
|
||||||
$action = $update_mark ? "update-$update_id" : "change-$update_id";
|
$action = $update_mark ? "update-$update_id" : "change-$update_id";
|
||||||
if (!$user->bot) {
|
if (!$user->bot && !$dialog->isSelfDialog()) {
|
||||||
Setting::validateMsgLimit('edit', $update_id);
|
Setting::validateMsgLimit('edit', $update_id);
|
||||||
}
|
}
|
||||||
} elseif ($reply_id > 0) {
|
} elseif ($reply_id > 0) {
|
||||||
@ -1811,7 +1811,9 @@ class DialogController extends AbstractController
|
|||||||
if (empty($msg)) {
|
if (empty($msg)) {
|
||||||
return Base::retError("消息不存在或已被删除");
|
return Base::retError("消息不存在或已被删除");
|
||||||
}
|
}
|
||||||
if (!$user->bot) {
|
$dialog = WebSocketDialog::checkDialog($msg->dialog_id);
|
||||||
|
//
|
||||||
|
if (!$user->bot && !$dialog->isSelfDialog()) {
|
||||||
Setting::validateMsgLimit('rev', $msg);
|
Setting::validateMsgLimit('rev', $msg);
|
||||||
}
|
}
|
||||||
$msg->withdrawMsg();
|
$msg->withdrawMsg();
|
||||||
|
|||||||
@ -666,6 +666,18 @@ class WebSocketDialog extends AbstractModel
|
|||||||
Task::deliver($task);
|
Task::deliver($task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查是否是单人对话
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isSelfDialog()
|
||||||
|
{
|
||||||
|
if ($this->type !== 'user') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return WebSocketDialogUser::whereDialogId($this->id)->where('userid', '>', 0)->count() === 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取对话(同时检验对话身份)
|
* 获取对话(同时检验对话身份)
|
||||||
* @param $dialog_id
|
* @param $dialog_id
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user