no message

This commit is contained in:
kuaifan 2025-05-01 12:24:30 +08:00
parent bf34beec20
commit c415ace453
3 changed files with 45 additions and 38 deletions

View File

@ -891,7 +891,7 @@ class WebSocketDialog extends AbstractModel
$data = []; $data = [];
foreach ($dialogIds as $dialog_id) { foreach ($dialogIds as $dialog_id) {
$dialog = WebSocketDialog::checkDialog($dialog_id); $dialog = WebSocketDialog::checkDialog($dialog_id);
//
$action = $replyId > 0 ? "reply-$replyId" : ""; $action = $replyId > 0 ? "reply-$replyId" : "";
$path = "uploads/chat/" . date("Ym") . "/" . $dialog_id . "/"; $path = "uploads/chat/" . date("Ym") . "/" . $dialog_id . "/";
if ($image64) { if ($image64) {
@ -916,18 +916,19 @@ class WebSocketDialog extends AbstractModel
"compressVideo" => $setting['compress_video'] === 'open', "compressVideo" => $setting['compress_video'] === 'open',
]); ]);
} }
//
if (Base::isError($data)) { if (Base::isError($data)) {
throw new ApiException($data['msg']); throw new ApiException($data['msg']);
} else { }
$fileData = $data['data']; $fileData = $data['data'];
$filePath = $fileData['file']; $filePath = $fileData['file'];
$fileName = $fileData['name']; $fileName = $fileData['name'];
$fileData['thumb'] = Base::unFillUrl($fileData['thumb']); $fileData['thumb'] = Base::unFillUrl($fileData['thumb']);
$fileData['size'] *= 1024; $fileData['size'] *= 1024;
//
if ($dialog->type === 'group' && $dialog->group_type === 'task') { // 任务群组保存文件 // 任务群组保存文件
if ($imageAttachment || !in_array($fileData['ext'], File::imageExt)) { // 如果是图片不保存 if ($dialog->group_type === 'task') {
// 如果是图片不保存
if ($imageAttachment || !in_array($fileData['ext'], File::imageExt)) {
$task = ProjectTask::whereDialogId($dialog->id)->first(); $task = ProjectTask::whereDialogId($dialog->id)->first();
if ($task) { if ($task) {
$file = ProjectTaskFile::createInstance([ $file = ProjectTaskFile::createInstance([
@ -944,7 +945,8 @@ class WebSocketDialog extends AbstractModel
} }
} }
} }
//
// 发送消息
$result = WebSocketDialogMsg::sendMsg($action, $dialog_id, 'file', $fileData, $user->userid); $result = WebSocketDialogMsg::sendMsg($action, $dialog_id, 'file', $fileData, $user->userid);
if (Base::isSuccess($result)) { if (Base::isSuccess($result)) {
if (isset($task)) { if (isset($task)) {
@ -952,7 +954,6 @@ class WebSocketDialog extends AbstractModel
} }
} }
} }
}
return $result; return $result;
} }
} }

View File

@ -827,12 +827,19 @@ class Base
} }
return $str; return $str;
} }
try { if (empty($str)) {
$find = url(''); return $str;
} catch (\Throwable) {
$find = self::getSchemeAndHost();
} }
return Base::leftDelete($str, $find . '/'); $parsedUrl = parse_url($str);
if (isset($parsedUrl['scheme']) && isset($parsedUrl['host'])) {
$relativePath = $parsedUrl['path'] ?? '';
$relativePath = ltrim($relativePath, '/');
$absolutePath = public_path($relativePath);
if (file_exists($absolutePath) || file_exists(Base::thumbRestore($absolutePath))) {
return $relativePath;
}
}
return $str;
} }
/** /**

View File

@ -341,7 +341,7 @@
<!--移动端选项卡--> <!--移动端选项卡-->
<transition name="mobile-slide"> <transition name="mobile-slide">
<MobileTabbar v-if="mobileTabbar && keyboardShow" @on-click="onTabbarClick"/> <MobileTabbar v-if="mobileTabbar" @on-click="onTabbarClick"/>
</transition> </transition>
<!-- okr明细 --> <!-- okr明细 -->
@ -521,7 +521,6 @@ export default {
'okrWindow', 'okrWindow',
'formOptions', 'formOptions',
'mobileTabbar', 'mobileTabbar',
'keyboardShow',
'longpressData', 'longpressData',
]), ]),