diff --git a/manager/public/config.js b/manager/public/config.js
index 09375686..1d52a7f1 100644
--- a/manager/public/config.js
+++ b/manager/public/config.js
@@ -3,10 +3,10 @@ var BASE = {
* @description api请求基础路径
*/
API_DEV: {
- common: "http://127.0.0.1:8890",
- buyer: "http://127.0.0.1:8888",
- seller: "http://127.0.0.1:8889",
- manager: "http://127.0.0.1:8887",
+ common: "https://common-api.pickmall.cn",
+ buyer: "https://buyer-api.pickmall.cn",
+ seller: "https://store-api.pickmall.cn",
+ manager: "https://admin-api.pickmall.cn"
},
API_PROD: {
common: "https://common-api.pickmall.cn",
diff --git a/manager/src/types/live.ts b/manager/src/types/live.ts
index e7fc3cba..1086ea3e 100644
--- a/manager/src/types/live.ts
+++ b/manager/src/types/live.ts
@@ -17,6 +17,17 @@ export interface LiveRoomForm {
endTime?: string
pushStreamServer?: string
pushStreamCode?: string
+ imSdkAppid?: string | number
+ imSdkAppId?: string | number
+ sdkAppId?: string | number
+ imSdkSecretKey?: string
+ sdkSecretKey?: string
+ secretKey?: string
+ userSig?: string
+ imUserSig?: string
+ adminUserSig?: string
+ imGroupId?: string
+ groupId?: string
}
export interface LiveCoupon {
diff --git a/manager/src/views/live/components/CommentReview.vue b/manager/src/views/live/components/CommentReview.vue
index 60018d8c..85f102f4 100644
--- a/manager/src/views/live/components/CommentReview.vue
+++ b/manager/src/views/live/components/CommentReview.vue
@@ -38,9 +38,13 @@
- 通过
- |
- 拒绝
+
+ 通过
+
+
+ |
+
+ 拒绝
@@ -82,9 +86,13 @@
- 通过
- |
- 拒绝
+
+ 通过
+
+
+ |
+
+ 拒绝
@@ -262,6 +270,14 @@ export default {
const map = { PASS: "success", REFUSE: "danger", TOBEAUDITED: "warning" };
return map[status] || "info";
},
+ canPassAuth(row) {
+ const status = row?.authStatus;
+ return status === "TOBEAUDITED" || status === "REFUSE" || !status;
+ },
+ canRejectAuth(row) {
+ const status = row?.authStatus;
+ return status === "TOBEAUDITED" || status === "PASS" || !status;
+ },
parsePageResult(res) {
if (!res) return { records: [], total: 0 };
if (res.records) {
@@ -342,7 +358,10 @@ export default {
});
},
handleAuth(record, authStatus) {
- authLiveMessage({ id: record.id, authStatus }).then((res) => {
+ authLiveMessage({
+ ...record,
+ authStatus,
+ }).then((res) => {
if (res.success) {
this.$Message.success("操作成功");
this.loadMessages();
diff --git a/manager/src/views/live/components/LiveChatPanel.vue b/manager/src/views/live/components/LiveChatPanel.vue
index 8a55e049..8b8dff4b 100644
--- a/manager/src/views/live/components/LiveChatPanel.vue
+++ b/manager/src/views/live/components/LiveChatPanel.vue
@@ -46,6 +46,7 @@
import Cookies from "js-cookie";
import { toRef } from "vue";
import { useChat } from "../composables/useChat";
+import { resolveImConfigFromDetail } from "../composables/useLiveSetting";
export default {
name: "LiveChatPanel",
@@ -71,7 +72,7 @@ export default {
userInfo = {};
}
- return useChat(toRef(props, "liveId"), userInfo);
+ return useChat(toRef(props, "liveId"), userInfo, toRef(props, "liveDetail"));
},
data() {
return {
@@ -84,30 +85,60 @@ export default {
imGroupId() {
return this.liveDetail?.imGroupId || this.liveDetail?.groupId || this.liveId || "";
},
+ imSdkAppId() {
+ return resolveImConfigFromDetail(this.liveDetail).sdkAppId;
+ },
+ canInitChat() {
+ const { sdkAppId, secretKey, userSig } = resolveImConfigFromDetail(this.liveDetail);
+ return !!(this.imGroupId && sdkAppId && (userSig || secretKey));
+ },
},
watch: {
- imGroupId: {
+ canInitChat: {
immediate: true,
- handler(id) {
- if (!id) return;
- this.setGroupID(id);
+ handler(ready) {
+ if (!ready) return;
+ this.setGroupID(this.imGroupId);
if (this.active) {
this.bootstrapChat();
}
},
},
+ imGroupId(id) {
+ if (!id) return;
+ this.setGroupID(id);
+ },
active(val) {
- if (val && this.imGroupId && !this.chatInited) {
+ if (val && this.canInitChat && !this.chatInited) {
this.bootstrapChat();
}
},
liveId() {
this.chatInited = false;
this.cleanup();
- if (this.active && this.imGroupId) {
+ if (this.active && this.canInitChat) {
this.bootstrapChat();
}
},
+ liveDetail: {
+ deep: true,
+ handler(detail, oldDetail) {
+ const nextConfig = resolveImConfigFromDetail(detail);
+ const prevConfig = resolveImConfigFromDetail(oldDetail);
+ if (
+ nextConfig.sdkAppId &&
+ (nextConfig.sdkAppId !== prevConfig.sdkAppId ||
+ nextConfig.secretKey !== prevConfig.secretKey ||
+ nextConfig.userSig !== prevConfig.userSig)
+ ) {
+ this.chatInited = false;
+ this.cleanup();
+ if (this.active && this.canInitChat) {
+ this.bootstrapChat();
+ }
+ }
+ },
+ },
},
beforeUnmount() {
this.cleanup();
@@ -117,7 +148,7 @@ export default {
this.createTextMessageByInput();
},
async bootstrapChat() {
- if (!this.liveId || this.chatInited || this.initializing) {
+ if (!this.liveId || this.chatInited || this.initializing || !this.canInitChat) {
return;
}
diff --git a/manager/src/views/live/composables/useChat.js b/manager/src/views/live/composables/useChat.js
index 27e09adb..6f3e74b8 100644
--- a/manager/src/views/live/composables/useChat.js
+++ b/manager/src/views/live/composables/useChat.js
@@ -3,13 +3,13 @@ import { nextTick, ref, unref, watch } from "vue";
import { postSendMessage } from "@/api/live";
import { Message } from "@/utils/message";
import TencentCloudChat from "@tencentcloud/chat";
-import { fetchLiveSetting } from "./useLiveSetting";
+import { resolveImConfigFromDetail } from "./useLiveSetting";
import { genTestUserSig } from "../utils/GenerateTestUserSig";
const MAX_MESSAGE_COUNT = 100;
const ADMIN_IM_USER_ID = "admin";
-export function useChat(liveId, userInfo) {
+export function useChat(liveId, userInfo, liveDetail) {
const chat = ref(null);
const groupID = ref("");
const messageList = ref([]);
@@ -67,22 +67,25 @@ export function useChat(liveId, userInfo) {
return;
}
- const setting = await fetchLiveSetting();
- if (!setting?.imSdkAppid) {
- initError.value = "请先在系统设置中配置直播 IM SDK APPID";
- return;
- }
- if (!setting?.imSdkSecretKey) {
- initError.value = "请先在系统设置中配置直播 IM SDK 密钥";
+ const detail = unref(liveDetail) || {};
+ const { sdkAppId, secretKey, userSig: detailUserSig } = resolveImConfigFromDetail(detail);
+ if (!sdkAppId) {
+ initError.value = "直播间详情缺少 IM SDK APPID";
return;
}
- const sdkAppId = Number(setting.imSdkAppid);
- const { userSig } = genTestUserSig({
- SDKAppID: sdkAppId,
- secretKey: setting.imSdkSecretKey,
- userID: ADMIN_IM_USER_ID,
- });
+ let userSig = detailUserSig;
+ if (!userSig) {
+ if (!secretKey) {
+ initError.value = "直播间详情缺少 IM 登录凭证";
+ return;
+ }
+ userSig = genTestUserSig({
+ SDKAppID: sdkAppId,
+ secretKey,
+ userID: ADMIN_IM_USER_ID,
+ }).userSig;
+ }
if (chat.value) {
detachChatEvents(chat.value);
diff --git a/manager/src/views/live/composables/useLiveSetting.js b/manager/src/views/live/composables/useLiveSetting.js
index d0dd82ba..944fc50c 100644
--- a/manager/src/views/live/composables/useLiveSetting.js
+++ b/manager/src/views/live/composables/useLiveSetting.js
@@ -34,7 +34,7 @@ export async function fetchLiveSetting(force = false) {
return fetchingPromise;
}
-/** 解析 IM SDK AppID */
+/** 解析 IM SDK AppID(系统设置,兼容旧逻辑) */
export function resolveSdkAppId(setting) {
if (!setting?.imSdkAppid) {
return 0;
@@ -42,3 +42,30 @@ export function resolveSdkAppId(setting) {
const id = Number(setting.imSdkAppid);
return Number.isNaN(id) ? 0 : id;
}
+
+/** 从直播间详情解析 IM SDK AppID */
+export function resolveSdkAppIdFromDetail(detail) {
+ return resolveImConfigFromDetail(detail).sdkAppId;
+}
+
+/** 从直播间详情解析 IM 配置 */
+export function resolveImConfigFromDetail(detail) {
+ if (!detail) {
+ return { sdkAppId: 0, secretKey: "", userSig: "" };
+ }
+
+ const sdkRaw = detail.sdkAppId ?? detail.imSdkAppId ?? detail.imSdkAppid;
+ const sdkAppId =
+ sdkRaw == null || sdkRaw === "" ? 0 : Number(sdkRaw);
+
+ const secretKey =
+ detail.imSdkSecretKey ?? detail.sdkSecretKey ?? detail.secretKey ?? "";
+ const userSig =
+ detail.userSig ?? detail.imUserSig ?? detail.adminUserSig ?? "";
+
+ return {
+ sdkAppId: Number.isNaN(sdkAppId) ? 0 : sdkAppId,
+ secretKey: String(secretKey || ""),
+ userSig: String(userSig || ""),
+ };
+}
diff --git a/manager/src/views/live/control-panel.vue b/manager/src/views/live/control-panel.vue
index 3be1dedd..06c9f69f 100644
--- a/manager/src/views/live/control-panel.vue
+++ b/manager/src/views/live/control-panel.vue
@@ -239,7 +239,6 @@