perf: 添加定位签到

This commit is contained in:
kuaifan
2024-11-08 21:46:07 +08:00
parent 2fc329a403
commit 3b9c9872ca
19 changed files with 1997 additions and 763 deletions

View File

@@ -957,6 +957,7 @@ class WebSocketDialogMsg extends AbstractModel
/**
* 发送消息、修改消息
* @param string $action 动作
* - null发送消息
* - reply-98回复消息ID=98
* - update-99更新消息ID=99标记修改
* - change-99更新消息ID=99不标记修改
@@ -994,6 +995,19 @@ class WebSocketDialogMsg extends AbstractModel
if (in_array($msg['ext'], ['jpg', 'jpeg', 'webp', 'png', 'gif'])) {
$mtype = 'image';
}
} elseif ($type === 'location') {
if (preg_match('/^https*:\/\//', $msg['preview'])) {
$preview = file_get_contents($msg['preview']);
if (empty($preview)) {
throw new ApiException('获取地图快照失败');
}
$filePath = "uploads/chat/" . date("Ym") . "/" . $dialog_id . "/" . md5s($msg['preview']) . ".jpg";
Base::makeDir(dirname(public_path($filePath)));
if (!Base::saveContentImage(public_path($filePath), $preview, 90)) {
throw new ApiException('保存地图快照失败');
}
$msg['preview'] = $filePath;
}
}
if ($push_silence === null) {
$push_silence = !in_array($type, ["text", "file", "record", "meeting"]);