diff --git a/app/Http/Controllers/Api/ApproveController.php b/app/Http/Controllers/Api/ApproveController.php index 38aca09ca..756be9e74 100755 --- a/app/Http/Controllers/Api/ApproveController.php +++ b/app/Http/Controllers/Api/ApproveController.php @@ -985,6 +985,20 @@ class ApproveController extends AbstractController 'comment_content' => $process['comment_contents']['content'] ?? '', 'comment_pictures' => $process['comment_contents']['pictures'] ?? [] ]; + $thumb = null; + if ($type === 'approve_reviewer') { + $thumb = $process['var']['other']; + } elseif ($type === 'approve_comment_notifier') { + $thumb = $data['comment_pictures'] ? $data['comment_pictures'][0] : null; + } + if ($thumb && file_exists(public_path($thumb))) { + $imageSize = getimagesize(public_path($thumb)); + $data['thumb'] = [ + 'url' => $thumb, + 'width' => $imageSize[0], + 'height' => $imageSize[1] + ]; + } $msgAction = null; $msgData = [ 'type' => $type, diff --git a/app/Models/WebSocketDialogMsg.php b/app/Models/WebSocketDialogMsg.php index ff661dfcf..31be91fcb 100644 --- a/app/Models/WebSocketDialogMsg.php +++ b/app/Models/WebSocketDialogMsg.php @@ -149,19 +149,29 @@ class WebSocketDialogMsg extends AbstractModel if (!is_array($msg)) { $msg = Base::json2array($msg); } - if ($type === 'file') { - $msg['type'] = in_array($msg['ext'], ['jpg', 'jpeg', 'webp', 'png', 'gif']) ? 'img' : 'file'; - $msg['path'] = Base::fillUrl($msg['path']); - $msg['thumb'] = Base::fillUrl($msg['thumb'] ?: Base::extIcon($msg['ext'])); - } else if ($type === 'record') { - $msg['path'] = Base::fillUrl($msg['path']); - $textUserid = is_array($msg['text_userid']) ? $msg['text_userid'] : []; - if (isset($msg['text_userid'])) { - unset($msg['text_userid']); - } - if ($msg['text'] && !in_array(Doo::userId(), $textUserid)) { - $msg['text'] = ""; - } + switch ($type) { + case 'file': + $msg['type'] = in_array($msg['ext'], ['jpg', 'jpeg', 'webp', 'png', 'gif']) ? 'img' : 'file'; + $msg['path'] = Base::fillUrl($msg['path']); + $msg['thumb'] = Base::fillUrl($msg['thumb'] ?: Base::extIcon($msg['ext'])); + break; + + case 'record': + $msg['path'] = Base::fillUrl($msg['path']); + $textUserid = is_array($msg['text_userid']) ? $msg['text_userid'] : []; + if (isset($msg['text_userid'])) { + unset($msg['text_userid']); + } + if ($msg['text'] && !in_array(Doo::userId(), $textUserid)) { + $msg['text'] = ""; + } + break; + + case 'template': + if ($msg['data']['thumb']) { + $msg['data']['thumb']['url'] = Base::fillUrl($msg['data']['thumb']['url']); + } + break; } return $msg; } diff --git a/resources/assets/js/pages/manage/components/DialogView/template/approve-comment-notifier.vue b/resources/assets/js/pages/manage/components/DialogView/template/approve-comment-notifier.vue index 21903f487..240c5ce86 100644 --- a/resources/assets/js/pages/manage/components/DialogView/template/approve-comment-notifier.vue +++ b/resources/assets/js/pages/manage/components/DialogView/template/approve-comment-notifier.vue @@ -5,7 +5,7 @@
{{$L('申请人')}}:@{{ msg.data.nickname }} {{ msg.data.department }}
{{$L('评论内容')}}{{ msg.data.comment_content }}
-[{{$L('图片')}}]
+{{$L("开始时间")}}:{{ msg.data.start_time }} ({{ msg.data.start_day_of_week }})
{{$L("结束时间")}}:{{ msg.data.end_time }} ({{ msg.data.end_day_of_week }})
{{$L("事由")}}:{{ msg.data.description }}
+