Răsfoiți Sursa

fix: 消息可能一直发送中的bug

xsx 5 luni în urmă
părinte
comite
fe83940be0
2 a modificat fișierele cu 12 adăugiri și 0 ștergeri
  1. 8 0
      im-uniapp/store/chatStore.js
  2. 4 0
      im-web/src/store/chatStore.js

+ 8 - 0
im-uniapp/store/chatStore.js

@@ -523,6 +523,14 @@ export default defineStore('chatStore', {
 			if (msgInfo.tmpId) {
 				for (let idx = chat.messages.length - 1; idx >= 0; idx--) {
 					let m = chat.messages[idx];
+					// 这里只查询临时消息,跳过正常消息
+          if (m.id) {
+            continue;
+          }
+					// 这里只查询临时消息,跳过有id的正常消息
+					if (m.id) {
+						contine;
+					}
 					if (m.tmpId && msgInfo.tmpId == m.tmpId) {
 						return m;
 					}

+ 4 - 0
im-web/src/store/chatStore.js

@@ -551,6 +551,10 @@ export default defineStore('chatStore', {
 			if (msgInfo.tmpId) {
 				for (let idx = chat.messages.length - 1; idx >= 0; idx--) {
 					let m = chat.messages[idx];
+					// 这里只查询临时消息,跳过正常消息
+					if (m.id) {
+						continue;
+					}
 					if (m.tmpId && msgInfo.tmpId == m.tmpId) {
 						return m;
 					}