mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-15 13:22:49 +00:00
perf: 消息接口支持MARKDOWN
This commit is contained in:
parent
679a0002a7
commit
c2db186620
@ -20,6 +20,7 @@ use Carbon\Carbon;
|
||||
use DB;
|
||||
use Redirect;
|
||||
use Request;
|
||||
use Str;
|
||||
|
||||
/**
|
||||
* @apiDefine dialog
|
||||
@ -664,7 +665,10 @@ class DialogController extends AbstractController
|
||||
*
|
||||
* @apiParam {Number} dialog_id 对话ID
|
||||
* @apiParam {String} text 消息内容
|
||||
* @apiParam {Number} [update_id] 更新消息ID(优先大于reply_id)
|
||||
* @apiParam {String} [text_type] 消息类型
|
||||
* - html: HTML(默认)
|
||||
* - md: MARKDOWN
|
||||
* @apiParam {Number} [update_id] 更新消息ID(优先大于 reply_id)
|
||||
* @apiParam {Number} [reply_id] 回复ID
|
||||
* @apiParam {String} [silence] 是否静默发送
|
||||
* - no: 正常发送(默认)
|
||||
@ -694,7 +698,8 @@ class DialogController extends AbstractController
|
||||
$update_id = intval(Request::input('update_id'));
|
||||
$reply_id = intval(Request::input('reply_id'));
|
||||
$text = trim(Request::input('text'));
|
||||
$silence = trim(Request::input('silence')) === 'yes';
|
||||
$text_type = strtolower(trim(Request::input('text_type')));
|
||||
$silence = in_array(strtolower(trim(Request::input('silence'))), ['yes', 'true', '1']);
|
||||
//
|
||||
WebSocketDialog::checkDialog($dialog_id);
|
||||
//
|
||||
@ -706,6 +711,9 @@ class DialogController extends AbstractController
|
||||
$action = "";
|
||||
}
|
||||
//
|
||||
if (in_array($text_type, ['md', 'markdown'])) {
|
||||
$text = Str::markdown($text);
|
||||
}
|
||||
$text = WebSocketDialogMsg::formatMsg($text, $dialog_id);
|
||||
$strlen = mb_strlen($text);
|
||||
$noimglen = mb_strlen(preg_replace("/<img[^>]*?>/i", "", $text));
|
||||
|
||||
78
public/docs/assets/main.bundle.js
vendored
78
public/docs/assets/main.bundle.js
vendored
File diff suppressed because one or more lines are too long
1
public/docs/assets/main.css
vendored
1
public/docs/assets/main.css
vendored
@ -49,7 +49,6 @@ input[type="date"] {
|
||||
src: url('./glyphicons-halflings-regular.eot');
|
||||
src: url('./glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
|
||||
url('./glyphicons-halflings-regular.woff') format('woff'),
|
||||
url('./glyphicons-halflings-regular.woff2') format('woff2'),
|
||||
url('./glyphicons-halflings-regular.ttf') format('truetype'),
|
||||
url('./glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg');
|
||||
}
|
||||
|
||||
@ -5,13 +5,13 @@
|
||||
<meta name="description" content="APP接口文档">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link href="assets/bootstrap.min.css?v=1679925462953" rel="stylesheet" media="screen">
|
||||
<link href="assets/prism.css?v=1679925462953" rel="stylesheet" />
|
||||
<link href="assets/main.css?v=1679925462953" rel="stylesheet" media="screen, print">
|
||||
<link href="assets/favicon.ico?v=1679925462953" rel="icon" type="image/x-icon">
|
||||
<link href="assets/apple-touch-icon.png?v=1679925462953" rel="apple-touch-icon" sizes="180x180">
|
||||
<link href="assets/favicon-32x32.png?v=1679925462953" rel="icon" type="image/png" sizes="32x32">
|
||||
<link href="assets/favicon-16x16.png?v=1679925462953" rel="icon" type="image/png" sizes="16x16">
|
||||
<link href="assets/bootstrap.min.css" rel="stylesheet" media="screen">
|
||||
<link href="assets/prism.css" rel="stylesheet" />
|
||||
<link href="assets/main.css" rel="stylesheet" media="screen, print">
|
||||
<link href="assets/favicon.ico" rel="icon" type="image/x-icon">
|
||||
<link href="assets/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180">
|
||||
<link href="assets/favicon-32x32.png" rel="icon" type="image/png" sizes="32x32">
|
||||
<link href="assets/favicon-16x16.png"rel="icon" type="image/png" sizes="16x16">
|
||||
</head>
|
||||
|
||||
<body class="container-fluid">
|
||||
@ -306,7 +306,7 @@
|
||||
{{#if optional}}
|
||||
<span class="label optional">{{__ "optional"}}</span>
|
||||
{{else}}
|
||||
{{#if ../../template.showRequiredLabels}}
|
||||
{{#if ../template.showRequiredLabels}}
|
||||
<span class="label required">{{__ "required"}}</span>
|
||||
{{/if}}
|
||||
{{/if}}</td>
|
||||
@ -928,6 +928,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="assets/main.bundle.js?v=1679925462953"></script>
|
||||
<script src="assets/main.bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user