|
@@ -162,8 +162,8 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</scroll-view>
|
|
</scroll-view>
|
|
|
- <!-- 新增:消息发送限制提示 -->
|
|
|
|
|
- <view class="message-limit-tip">
|
|
|
|
|
|
|
+ <!-- 新增:消息发送限制提示(双方都不是红娘,且不是从红娘工作台进入时才显示) -->
|
|
|
|
|
+ <view class="message-limit-tip" v-if="!(String(userId).startsWith('m_') || String(targetUserId).startsWith('m_') || fromMatchmaker)">
|
|
|
<!-- 同时判断isVip和hasMessageLimit,增强可靠性 -->
|
|
<!-- 同时判断isVip和hasMessageLimit,增强可靠性 -->
|
|
|
<text v-if="isVip || !hasMessageLimit" class="vip-tip">✨ VIP特权:无发送次数限制</text>
|
|
<text v-if="isVip || !hasMessageLimit" class="vip-tip">✨ VIP特权:无发送次数限制</text>
|
|
|
<text v-else class="limit-tip">
|
|
<text v-else class="limit-tip">
|
|
@@ -363,27 +363,42 @@ export default {
|
|
|
rawUserId = parseInt(rawUserId);
|
|
rawUserId = parseInt(rawUserId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (!rawUserId || isNaN(rawUserId)) {
|
|
|
|
|
- console.error('❌ 无法获取有效的用户ID');
|
|
|
|
|
- uni.showModal({
|
|
|
|
|
- title: '用户信息错误',
|
|
|
|
|
- content: '无法获取用户ID,请重新登录',
|
|
|
|
|
- showCancel: false,
|
|
|
|
|
- success: () => {
|
|
|
|
|
- uni.removeStorageSync('token');
|
|
|
|
|
- uni.removeStorageSync('userInfo');
|
|
|
|
|
- uni.removeStorageSync('userId');
|
|
|
|
|
- uni.reLaunch({
|
|
|
|
|
- url: '/pages/page3/page3'
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ // 标记是否为用户与红娘的聊天,用于跳过每日5条限制和文本审核
|
|
|
|
|
+ // 支持两种格式:'1' 或 'true'
|
|
|
|
|
+ this.fromMatchmaker = options.fromMatchmaker === '1' || options.fromMatchmaker === 'true';
|
|
|
|
|
+
|
|
|
|
|
+ // 根据入口来源确定当前会话中的“自己”是谁
|
|
|
|
|
+ if (this.fromMatchmaker) {
|
|
|
|
|
+ // 红娘工作台入口:使用当前 TIM 登录账号作为 userId(例如 m_22)
|
|
|
|
|
+ const imUserId = timManager.getCurrentUserId();
|
|
|
|
|
+ if (!imUserId) {
|
|
|
|
|
+ console.error('❌ TIM 未登录,无法获取红娘IM账号');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.userId = String(imUserId);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 普通用户入口:仍然使用本地存储的 userId
|
|
|
|
|
+ if (!rawUserId || isNaN(rawUserId)) {
|
|
|
|
|
+ console.error('❌ 无法获取有效的用户ID');
|
|
|
|
|
+ uni.showModal({
|
|
|
|
|
+ title: '用户信息错误',
|
|
|
|
|
+ content: '无法获取用户ID,请重新登录',
|
|
|
|
|
+ showCancel: false,
|
|
|
|
|
+ success: () => {
|
|
|
|
|
+ uni.removeStorageSync('token');
|
|
|
|
|
+ uni.removeStorageSync('userInfo');
|
|
|
|
|
+ uni.removeStorageSync('userId');
|
|
|
|
|
+ uni.reLaunch({
|
|
|
|
|
+ url: '/pages/page3/page3'
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.userId = String(rawUserId);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
|
|
|
- // 保存用户ID(TIM需要字符串格式)
|
|
|
|
|
- this.userId = String(rawUserId);
|
|
|
|
|
|
|
+ // 头像:默认先用用户信息中的头像(红娘入口会被 loadMatchmakerAvatarByImId 覆盖)
|
|
|
this.userAvatar = userInfo.avatar || userInfo.avatarUrl || '/static/default-avatar.svg';
|
|
this.userAvatar = userInfo.avatar || userInfo.avatarUrl || '/static/default-avatar.svg';
|
|
|
|
|
|
|
|
// 获取对方用户信息(确保是字符串格式)
|
|
// 获取对方用户信息(确保是字符串格式)
|
|
@@ -391,133 +406,60 @@ export default {
|
|
|
this.targetUserName = decodeURIComponent(options.targetUserName || '用户');
|
|
this.targetUserName = decodeURIComponent(options.targetUserName || '用户');
|
|
|
this.targetUserAvatar = decodeURIComponent(options.targetUserAvatar || '/static/default-avatar.svg');
|
|
this.targetUserAvatar = decodeURIComponent(options.targetUserAvatar || '/static/default-avatar.svg');
|
|
|
|
|
|
|
|
- // 标记是否为用户与红娘的聊天,用于跳过每日5条限制和文本审核
|
|
|
|
|
- // 支持两种格式:'1' 或 'true'
|
|
|
|
|
- this.fromMatchmaker = options.fromMatchmaker === '1' || options.fromMatchmaker === 'true';
|
|
|
|
|
-
|
|
|
|
|
// 生成会话 ID
|
|
// 生成会话 ID
|
|
|
this.conversationID = `C2C${this.targetUserId}`;
|
|
this.conversationID = `C2C${this.targetUserId}`;
|
|
|
|
|
|
|
|
console.log('✅ 聊天页面初始化成功:');
|
|
console.log('✅ 聊天页面初始化成功:');
|
|
|
- console.log(' - 当前用户ID:', rawUserId, '(TIM格式:', this.userId, ')');
|
|
|
|
|
|
|
+ console.log(' - 当前用户ID:', this.userId);
|
|
|
console.log(' - 对方用户ID:', this.targetUserId);
|
|
console.log(' - 对方用户ID:', this.targetUserId);
|
|
|
console.log(' - 会话ID:', this.conversationID);
|
|
console.log(' - 会话ID:', this.conversationID);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 初始化 TIM
|
|
// 初始化 TIM
|
|
|
await this.initTIM();
|
|
await this.initTIM();
|
|
|
- // 获取用户消息发送限制(VIP状态+剩余次数)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 获取用户消息发送限制(VIP 状态 + 剩余次数)
|
|
|
await this.getUserMessageLimit();
|
|
await this.getUserMessageLimit();
|
|
|
|
|
+
|
|
|
// 等待 SDK Ready 后再加载消息
|
|
// 等待 SDK Ready 后再加载消息
|
|
|
await this.waitForSDKReady();
|
|
await this.waitForSDKReady();
|
|
|
|
|
+
|
|
|
// 先检查拉黑状态
|
|
// 先检查拉黑状态
|
|
|
- this.isBlockedByTarget = await this.checkIsBlockedByTarget();
|
|
|
|
|
- if (this.isBlockedByTarget) {
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '你已被对方拉黑,无法发送消息',
|
|
|
|
|
- icon: 'none',
|
|
|
|
|
- duration: 3000
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.isBlockedByTarget = await this.checkIsBlockedByTarget();
|
|
|
|
|
+ if (this.isBlockedByTarget) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '你已被对方拉黑,无法发送消息',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration: 3000
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 加载历史消息
|
|
// 加载历史消息
|
|
|
await this.loadMessages();
|
|
await this.loadMessages();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 监听新消息
|
|
// 监听新消息
|
|
|
this.listenMessages();
|
|
this.listenMessages();
|
|
|
-
|
|
|
|
|
- // 监听已读回执(确保在 SDK Ready 之后调用)
|
|
|
|
|
- this.listenMessageReadReceipt();
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 监听已读回执
|
|
|
|
|
+ this.listenMessageReadReceipt && this.listenMessageReadReceipt();
|
|
|
|
|
+
|
|
|
// 标记当前会话的消息为已读
|
|
// 标记当前会话的消息为已读
|
|
|
- this.markConversationRead();
|
|
|
|
|
-
|
|
|
|
|
- // 初始化在线状态监听(HTTP 轮询方式)
|
|
|
|
|
- this.initOnlineStatusPolling();
|
|
|
|
|
-
|
|
|
|
|
|
|
+ this.markConversationRead && this.markConversationRead();
|
|
|
|
|
+
|
|
|
|
|
+ // 初始化在线状态轮询
|
|
|
|
|
+ this.initOnlineStatusPolling && this.initOnlineStatusPolling();
|
|
|
|
|
+
|
|
|
// 如果有预设消息,自动发送
|
|
// 如果有预设消息,自动发送
|
|
|
if (options.message) {
|
|
if (options.message) {
|
|
|
const message = decodeURIComponent(options.message);
|
|
const message = decodeURIComponent(options.message);
|
|
|
console.log('检测到预设消息,准备自动发送:', message);
|
|
console.log('检测到预设消息,准备自动发送:', message);
|
|
|
- // 等待一下再发送,确保TIM已经初始化完成
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
this.inputText = message;
|
|
this.inputText = message;
|
|
|
this.sendTextMessage();
|
|
this.sendTextMessage();
|
|
|
}, 1500);
|
|
}, 1500);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 页面显示时(从其他页面返回)
|
|
|
|
|
- */
|
|
|
|
|
- async onShow() {
|
|
|
|
|
- console.log('=== 聊天页面显示 ===');
|
|
|
|
|
-
|
|
|
|
|
- // 🔥 重新查询会话的 peerReadTime,更新已读状态
|
|
|
|
|
- // 这样即使 A 离开页面期间 B 阅读了消息,A 返回时也能看到最新的已读状态
|
|
|
|
|
- if (this.conversationID && timManager.tim) {
|
|
|
|
|
- try {
|
|
|
|
|
- console.log('🔄 重新查询会话已读状态...');
|
|
|
|
|
- const conversationRes = await timManager.tim.getConversationProfile(this.conversationID);
|
|
|
|
|
-
|
|
|
|
|
- if (conversationRes && conversationRes.data && conversationRes.data.conversation) {
|
|
|
|
|
- const peerReadTime = conversationRes.data.conversation.peerReadTime;
|
|
|
|
|
- console.log(' - 对方最后阅读时间:', peerReadTime, peerReadTime > 0 ? new Date(peerReadTime * 1000).toLocaleString() : '未读');
|
|
|
|
|
-
|
|
|
|
|
- if (peerReadTime && peerReadTime > 0) {
|
|
|
|
|
- let updatedCount = 0;
|
|
|
|
|
-
|
|
|
|
|
- // 更新所有发送时间 <= peerReadTime 的消息为已读
|
|
|
|
|
- this.messages.forEach((msg, index) => {
|
|
|
|
|
- if (msg.fromUserId === this.userId && !msg.isPeerRead && msg.sendStatus !== 4) {
|
|
|
|
|
- const msgTime = Math.floor(msg.sendTime.getTime() / 1000);
|
|
|
|
|
-
|
|
|
|
|
- if (msgTime <= peerReadTime) {
|
|
|
|
|
- this.$set(this.messages[index], 'isPeerRead', true);
|
|
|
|
|
- updatedCount++;
|
|
|
|
|
- console.log(` - 消息 ${msg.messageId} 已标记为已读`);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- console.log(`✅ 页面显示时更新了 ${updatedCount} 条消息为已读状态`);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('❌ 重新查询会话已读状态失败:', error);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 重新标记当前会话为已读(通知对方)
|
|
|
|
|
- this.markConversationRead();
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- onUnload() {
|
|
|
|
|
- // 页面卸载时移除监听
|
|
|
|
|
- timManager.offMessage(this.handleNewMessage);
|
|
|
|
|
-
|
|
|
|
|
- // 移除消息状态变更监听(已注释)
|
|
|
|
|
- /*
|
|
|
|
|
- if (timManager.tim && this.handleStatusChange) {
|
|
|
|
|
- timManager.tim.off(TIM.EVENT.MESSAGE_STATUS_CHANGED, this.handleStatusChange);
|
|
|
|
|
- }
|
|
|
|
|
- */
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
methods: {
|
|
methods: {
|
|
|
- /**
|
|
|
|
|
- * 计算语音消息宽度(根据时长动态变化)
|
|
|
|
|
- * @param {Number} duration 语音时长(秒)
|
|
|
|
|
- * @return {String} 宽度值
|
|
|
|
|
- */
|
|
|
|
|
- getVoiceWidth(duration) {
|
|
|
|
|
- // 基础宽度 100rpx,每秒增加 10rpx,最大 400rpx
|
|
|
|
|
- const baseWidth = 100;
|
|
|
|
|
- const widthPerSecond = 10;
|
|
|
|
|
- const maxWidth = 400;
|
|
|
|
|
-
|
|
|
|
|
- const width = Math.min(baseWidth + (duration * widthPerSecond), maxWidth);
|
|
|
|
|
- return width + 'rpx';
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 初始化 TIM
|
|
* 初始化 TIM
|
|
|
*/
|
|
*/
|
|
@@ -525,19 +467,19 @@ export default {
|
|
|
try {
|
|
try {
|
|
|
// 如果未初始化,先初始化
|
|
// 如果未初始化,先初始化
|
|
|
if (!timManager.tim) {
|
|
if (!timManager.tim) {
|
|
|
- timManager.init(1600109674); // ✅ 已更新为正确的 SDKAppID
|
|
|
|
|
|
|
+ timManager.init(1600109674); // 使用正确的 SDKAppID
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 如果未登录,获取 userSig 并登录
|
|
// 如果未登录,获取 userSig 并登录
|
|
|
if (!timManager.isLogin) {
|
|
if (!timManager.isLogin) {
|
|
|
- // 先导入当前用户和目标用户到腾讯云IM
|
|
|
|
|
|
|
+ // 先导入当前用户和目标用户到腾讯云 IM
|
|
|
await this.importUsers();
|
|
await this.importUsers();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 从后端获取 userSig
|
|
// 从后端获取 userSig
|
|
|
const userSig = await this.getUserSig();
|
|
const userSig = await this.getUserSig();
|
|
|
await timManager.login(this.userId, userSig);
|
|
await timManager.login(this.userId, userSig);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
this.isLogin = true;
|
|
this.isLogin = true;
|
|
|
console.log('✅ TIM 初始化完成');
|
|
console.log('✅ TIM 初始化完成');
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -548,26 +490,27 @@ export default {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- /**
|
|
|
|
|
- * 跳转到VIP页面
|
|
|
|
|
- */
|
|
|
|
|
- goToVipPage() {
|
|
|
|
|
- console.log('点击跳转VIP页面');
|
|
|
|
|
- // 替换为你的实际VIP页面路径(例如会员开通页面)
|
|
|
|
|
- uni.navigateTo({
|
|
|
|
|
- url: '/pages/vip/index', // 请根据项目实际路径修改
|
|
|
|
|
- success: () => {
|
|
|
|
|
- console.log('跳转VIP页面成功');
|
|
|
|
|
- },
|
|
|
|
|
- fail: (err) => {
|
|
|
|
|
- console.error('跳转VIP页面失败:', err);
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: 'VIP页面不存在',
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 跳转到VIP页面
|
|
|
|
|
+ */
|
|
|
|
|
+ goToVipPage() {
|
|
|
|
|
+ console.log('点击跳转VIP页面');
|
|
|
|
|
+ // 替换为你的实际VIP页面路径(例如会员开通页面)
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: '/pages/vip/index', // 请根据项目实际路径修改
|
|
|
|
|
+ success: () => {
|
|
|
|
|
+ console.log('跳转VIP页面成功');
|
|
|
|
|
+ },
|
|
|
|
|
+ fail: (err) => {
|
|
|
|
|
+ console.error('跳转VIP页面失败:', err);
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: 'VIP页面不存在',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
more(userid) {
|
|
more(userid) {
|
|
|
console.log('点击了更多按钮,开始跳转...', userid);
|
|
console.log('点击了更多按钮,开始跳转...', userid);
|
|
|
// 如果目标页面是普通页面,用navigateTo(保留当前页面);如果是tabbar页面,用switchTab
|
|
// 如果目标页面是普通页面,用navigateTo(保留当前页面);如果是tabbar页面,用switchTab
|
|
@@ -604,7 +547,7 @@ export default {
|
|
|
|
|
|
|
|
// 导入当前用户(确保userId是字符串)
|
|
// 导入当前用户(确保userId是字符串)
|
|
|
const currentUserRes = await uni.request({
|
|
const currentUserRes = await uni.request({
|
|
|
- url: 'http://localhost:1004/api/im/importUser',
|
|
|
|
|
|
|
+ url: 'http://localhost:8083/api/im/importUser',
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
data: {
|
|
data: {
|
|
|
userId: String(this.userId),
|
|
userId: String(this.userId),
|
|
@@ -619,7 +562,7 @@ export default {
|
|
|
|
|
|
|
|
// 导入目标用户(确保userId是字符串)
|
|
// 导入目标用户(确保userId是字符串)
|
|
|
const targetUserRes = await uni.request({
|
|
const targetUserRes = await uni.request({
|
|
|
- url: 'http://localhost:1004/api/im/importUser',
|
|
|
|
|
|
|
+ url: 'http://localhost:8083/api/im/importUser',
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
data: {
|
|
data: {
|
|
|
userId: String(this.targetUserId),
|
|
userId: String(this.targetUserId),
|
|
@@ -644,7 +587,7 @@ export default {
|
|
|
async getUserSig() {
|
|
async getUserSig() {
|
|
|
try {
|
|
try {
|
|
|
const [err, res] = await uni.request({
|
|
const [err, res] = await uni.request({
|
|
|
- url: 'http://localhost:1004/api/im/getUserSig',
|
|
|
|
|
|
|
+ url: 'http://localhost:8083/api/im/getUserSig',
|
|
|
method: 'GET',
|
|
method: 'GET',
|
|
|
data: {
|
|
data: {
|
|
|
userId: this.userId
|
|
userId: this.userId
|
|
@@ -1100,8 +1043,11 @@ export default {
|
|
|
* 发送文本消息
|
|
* 发送文本消息
|
|
|
*/
|
|
*/
|
|
|
async sendTextMessage() {
|
|
async sendTextMessage() {
|
|
|
|
|
+ // 判断是否为涉及红娘的会话:任一方ID以 m_ 开头,或来自红娘工作台
|
|
|
|
|
+ const isMatchmakerChat = this.fromMatchmaker || String(this.userId).startsWith('m_') || String(this.targetUserId).startsWith('m_');
|
|
|
|
|
|
|
|
- if (this.hasMessageLimit && this.remainingCount <= 0) {
|
|
|
|
|
|
|
+ // 仅普通用户之间的会话才做消息次数限制
|
|
|
|
|
+ if (!isMatchmakerChat && this.hasMessageLimit && this.remainingCount <= 0) {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: '今日消息发送次数已用完,开通VIP无限制',
|
|
title: '今日消息发送次数已用完,开通VIP无限制',
|
|
|
icon: 'none',
|
|
icon: 'none',
|
|
@@ -1117,11 +1063,11 @@ export default {
|
|
|
const content = this.inputText;
|
|
const content = this.inputText;
|
|
|
this.inputText = '';
|
|
this.inputText = '';
|
|
|
|
|
|
|
|
- // 1. 先进行消息内容审核(红娘聊天跳过审核)
|
|
|
|
|
- if (!this.fromMatchmaker) {
|
|
|
|
|
|
|
+ // 1. 先进行消息内容审核(只要有一方是红娘就跳过审核)
|
|
|
|
|
+ if (!isMatchmakerChat) {
|
|
|
try {
|
|
try {
|
|
|
const checkRes = await uni.request({
|
|
const checkRes = await uni.request({
|
|
|
- url: 'http://localhost:1004/api/chat/checkMessage',
|
|
|
|
|
|
|
+ url: 'http://localhost:8083/api/chat/checkMessage',
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
data: {
|
|
data: {
|
|
|
userId: String(this.userId),
|
|
userId: String(this.userId),
|
|
@@ -1227,7 +1173,8 @@ export default {
|
|
|
|
|
|
|
|
console.log('✅ 消息发送成功');
|
|
console.log('✅ 消息发送成功');
|
|
|
this.syncMessageToMySQL(message);
|
|
this.syncMessageToMySQL(message);
|
|
|
- if (!this.isVip) {
|
|
|
|
|
|
|
+ // 仅普通用户之间的会话才扣减消息次数
|
|
|
|
|
+ if (!isMatchmakerChat && !this.isVip) {
|
|
|
await this.updateMessageCount();
|
|
await this.updateMessageCount();
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -1347,7 +1294,7 @@ export default {
|
|
|
|
|
|
|
|
// 调用后端同步接口
|
|
// 调用后端同步接口
|
|
|
const res = await uni.request({
|
|
const res = await uni.request({
|
|
|
- url: 'http://localhost:1004/api/chat/syncTIMMessage',
|
|
|
|
|
|
|
+ url: 'http://localhost:8083/api/chat/syncTIMMessage',
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
data: syncData,
|
|
data: syncData,
|
|
|
header: {
|
|
header: {
|
|
@@ -2093,7 +2040,7 @@ export default {
|
|
|
|
|
|
|
|
// 使用uni.uploadFile上传到后端MinIO接口
|
|
// 使用uni.uploadFile上传到后端MinIO接口
|
|
|
const [err, res] = await uni.uploadFile({
|
|
const [err, res] = await uni.uploadFile({
|
|
|
- url: 'http://localhost:1004/api/voice/upload',
|
|
|
|
|
|
|
+ url: 'http://localhost:8083/api/voice/upload',
|
|
|
filePath: this.voiceTempPath,
|
|
filePath: this.voiceTempPath,
|
|
|
name: 'file',
|
|
name: 'file',
|
|
|
header: {
|
|
header: {
|
|
@@ -2296,12 +2243,13 @@ export default {
|
|
|
* 从后端获取VIP状态和今日剩余发送次数
|
|
* 从后端获取VIP状态和今日剩余发送次数
|
|
|
*/
|
|
*/
|
|
|
async getUserMessageLimit() {
|
|
async getUserMessageLimit() {
|
|
|
- // 用户与红娘的聊天:不做每日5条限制,直接视为无限制
|
|
|
|
|
- if (this.fromMatchmaker) {
|
|
|
|
|
|
|
+ // 只要一方是红娘(ID 以 m_ 开头),就不做每日5条限制,直接视为无限制
|
|
|
|
|
+ const isMatchmakerChat = String(this.userId).startsWith('m_') || String(this.targetUserId).startsWith('m_');
|
|
|
|
|
+ if (isMatchmakerChat || this.fromMatchmaker) {
|
|
|
this.hasMessageLimit = false;
|
|
this.hasMessageLimit = false;
|
|
|
this.isVip = true;
|
|
this.isVip = true;
|
|
|
this.remainingCount = 999;
|
|
this.remainingCount = 999;
|
|
|
- console.log('✅ 红娘聊天模式:无消息限制');
|
|
|
|
|
|
|
+ console.log('✅ 红娘聊天模式:无消息限制(跳过 getUserMessageLimit 接口)');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|