mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-13 09:48:11 +00:00
perf: 机器人支持静默推送
This commit is contained in:
parent
0c8a682fd0
commit
5c6eb18d74
@ -579,9 +579,12 @@ class DialogController extends AbstractController
|
||||
* @apiName msg__sendtext
|
||||
*
|
||||
* @apiParam {Number} dialog_id 对话ID
|
||||
* @apiParam {String} text 消息内容
|
||||
* @apiParam {Number} [update_id] 更新消息ID(优先大于reply_id)
|
||||
* @apiParam {Number} [reply_id] 回复ID
|
||||
* @apiParam {String} text 消息内容
|
||||
* @apiParam {String} [silence] 是否静默发送
|
||||
* - no: 正常发送(默认)
|
||||
* - yes: 静默发送
|
||||
*
|
||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||
@ -608,6 +611,7 @@ class DialogController extends AbstractController
|
||||
$update_id = Base::getPostInt('update_id');
|
||||
$reply_id = Base::getPostInt('reply_id');
|
||||
$text = trim(Base::getPostValue('text'));
|
||||
$silence = trim(Base::getPostValue('silence')) === 'yes';
|
||||
//
|
||||
WebSocketDialog::checkDialog($dialog_id);
|
||||
//
|
||||
@ -648,10 +652,10 @@ class DialogController extends AbstractController
|
||||
'height' => -1,
|
||||
'ext' => 'htm',
|
||||
];
|
||||
return WebSocketDialogMsg::sendMsg($action, $dialog_id, 'file', $fileData, $user->userid);
|
||||
return WebSocketDialogMsg::sendMsg($action, $dialog_id, 'file', $fileData, $user->userid, false, false, $silence);
|
||||
}
|
||||
//
|
||||
return WebSocketDialogMsg::sendMsg($action, $dialog_id, 'text', ['text' => $text], $user->userid);
|
||||
return WebSocketDialogMsg::sendMsg($action, $dialog_id, 'text', ['text' => $text], $user->userid, false, false, $silence);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -224,7 +224,7 @@ class BotReceiveMsgTask extends AbstractTask
|
||||
])->render();
|
||||
$text = preg_replace("/^\x20+/", "", $text);
|
||||
$text = preg_replace("/\n\x20+/", "\n", $text);
|
||||
WebSocketDialogMsg::sendMsg(null, $msg->dialog_id, 'text', ['text' => $text], $this->userid); // todo 未能在任务end事件来发送任务
|
||||
WebSocketDialogMsg::sendMsg(null, $msg->dialog_id, 'text', ['text' => $text], $this->userid, false, false, true); // todo 未能在任务end事件来发送任务
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -66,6 +66,7 @@
|
||||
--header 'token: <span style="color:#84c56a">{机器人Token}</span>' \
|
||||
--form 'dialog_id="<span style="color:#84c56a">{对话ID}</span>"' \
|
||||
--form 'text="<span style="color:#84c56a">{消息内容}</span>"'
|
||||
--form 'silence="<span style="color:#84c56a">[yes|no]</span>"'
|
||||
@elseif ($type === 'notice')
|
||||
{{$notice}}
|
||||
@else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user