From 27cd042df9aca0383a49f3514bc21958dd890912 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 29 六月 2026 15:42:23 +0800
Subject: [PATCH] 银川 1.联调产品维护页面 2.添加IM即时通讯模块
---
src/api/im/rtc/index.ts | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 105 insertions(+), 0 deletions(-)
diff --git a/src/api/im/rtc/index.ts b/src/api/im/rtc/index.ts
new file mode 100644
index 0000000..801df2a
--- /dev/null
+++ b/src/api/im/rtc/index.ts
@@ -0,0 +1,105 @@
+import { requestClient } from '#/api/request';
+
+export namespace ImRtcApi {
+ /** 鍒涘缓鏂伴�氳瘽璇锋眰 VO */
+ export interface RtcCallCreateReqVO {
+ conversationType: number;
+ mediaType: number;
+ groupId?: number;
+ inviteeIds: number[]; // 琚個璇风殑鐢ㄦ埛缂栧彿闆嗗悎锛涚鑱婂繀浼� 1 涓绔紝缇よ亰蹇呬紶鑷冲皯 1 浜�
+ }
+
+ /** 閫氳瘽涓拷鍔犻個璇疯姹� VO锛涗粎缇ら�氳瘽鍙敤 */
+ export interface RtcCallInviteReqVO {
+ room: string;
+ inviteeIds: number[];
+ }
+
+ /** 閫氳瘽浼氳瘽 VO锛沜reate / join / accept / refreshToken 鍏辩敤 */
+ export interface RtcCallRespVO {
+ room: string; // 涓氬姟閫氳瘽缂栧彿锛堝悓鏃朵綔涓� LiveKit 鎴块棿鍚嶏級
+ livekitUrl: string;
+ token?: string; // ENDED 鐘舵�佹椂涓� null锛堟棤闇� connect LiveKit锛�
+ conversationType: number;
+ mediaType: number;
+ status: number;
+ endReason?: number; // 缁撴潫鍘熷洜锛涗粎 status=ENDED 鏃舵湁鍊�
+ inviterId: number;
+ groupId?: number;
+ inviteeIds?: number[];
+ joinedUserIds?: number[];
+ }
+
+ /** 缇ゆ椿璺冮�氳瘽鏌ヨ鍝嶅簲锛涗笉鍚� token */
+ export interface RtcGroupCallRespVO {
+ room: string;
+ groupId: number;
+ mediaType: number;
+ inviterId: number;
+ joinedUserIds?: number[];
+ inviteeIds?: number[];
+ }
+}
+
+
+/** 鍒涘缓鏂伴�氳瘽锛涚鑱婃垨缇よ亰鏍规嵁 conversationType 鍖哄垎 */
+export function createCall(data: ImRtcApi.RtcCallCreateReqVO) {
+ return requestClient.post<ImRtcApi.RtcCallRespVO>('/im/rtc/create', data);
+}
+
+/** 閫氳瘽涓拷鍔犻個璇凤紱浠呯兢閫氳瘽鍙敤 */
+export function inviteCall(data: ImRtcApi.RtcCallInviteReqVO) {
+ return requestClient.post<boolean>('/im/rtc/invite', data);
+}
+
+/** 鍔犲叆宸叉湁缇ら�氳瘽锛涚敤浜庤兌鍥婃潯銆屽姞鍏ャ�嶆寜閽� */
+export function joinCall(room: string) {
+ return requestClient.post<ImRtcApi.RtcCallRespVO>('/im/rtc/join', undefined, {
+ params: { room },
+ });
+}
+
+/** 鎺ュ惉閫氳瘽 */
+export function acceptCall(room: string) {
+ return requestClient.post<ImRtcApi.RtcCallRespVO>('/im/rtc/accept', undefined, {
+ params: { room },
+ });
+}
+
+/** 鎷掔粷閫氳瘽 */
+export function rejectCall(room: string) {
+ return requestClient.post<boolean>('/im/rtc/reject', undefined, {
+ params: { room },
+ });
+}
+
+/** 鍙栨秷閭�璇凤紱涓诲彨鎺ラ�氬墠璋冪敤 */
+export function cancelCall(room: string) {
+ return requestClient.post<boolean>('/im/rtc/cancel', undefined, {
+ params: { room },
+ });
+}
+
+/** 绂诲紑閫氳瘽锛涙帴閫氬悗璋冪敤 */
+export function leaveCall(room: string) {
+ return requestClient.post<boolean>('/im/rtc/leave', undefined, {
+ params: { room },
+ });
+}
+
+/** 鎸搩瓒呮椂妫�鏌ワ紱RUNNING 绔� timer 鍏滃簳锛岃Е鍙戝悗绔珛鍗虫壂鎻忚 room 鐨勮秴鏃� INVITING锛堟帴鍙i潤榛橈級 */
+export function noAnswerCallCheck(room: string) {
+ return requestClient.post<boolean>(
+ '/im/rtc/no-answer-call-check',
+ undefined,
+ { params: { room } },
+ );
+}
+
+/** 鏌ヨ褰撳墠杩涜涓殑閫氳瘽锛涚洰鍓嶄粎缇よ亰鍦烘櫙锛堣兌鍥婃潯锛夛紝杩斿洖 null 琛ㄧず鏃犳椿璺冮�氳瘽 */
+export function getActiveCall(groupId: number) {
+ return requestClient.get<ImRtcApi.RtcGroupCallRespVO | null>(
+ '/im/rtc/get-active-call',
+ { params: { groupId } },
+ );
+}
--
Gitblit v1.9.3