fix: update msg seqId

This commit is contained in:
linyuchen 2024-03-09 02:34:21 +08:00
parent c3c9e74832
commit 17af156451
2 changed files with 11 additions and 13 deletions

View File

@ -118,11 +118,10 @@ class DBUtil {
this.db.put(shortIdKey, msg.msgId).then(); this.db.put(shortIdKey, msg.msgId).then();
this.db.put(longIdKey, JSON.stringify(msg)).then(); this.db.put(longIdKey, JSON.stringify(msg)).then();
try { try {
if (!(await this.db.get(seqIdKey))) { await this.db.get(seqIdKey)
this.db.put(seqIdKey, msg.msgId).then();
}
} catch (e) { } catch (e) {
// log("新的seqId", seqIdKey)
this.db.put(seqIdKey, msg.msgId).then();
} }
this.cache[shortIdKey] = this.cache[longIdKey] = msg; this.cache[shortIdKey] = this.cache[longIdKey] = msg;
if (!this.cache[seqIdKey]) { if (!this.cache[seqIdKey]) {
@ -142,7 +141,7 @@ class DBUtil {
try { try {
existMsg = await this.getMsgByLongId(msg.msgId) existMsg = await this.getMsgByLongId(msg.msgId)
} catch (e) { } catch (e) {
return existMsg = msg
} }
} }
@ -155,11 +154,10 @@ class DBUtil {
} }
this.db.put(shortIdKey, msg.msgId).then(); this.db.put(shortIdKey, msg.msgId).then();
try { try {
if (!(await this.db.get(seqIdKey))) { await this.db.get(seqIdKey)
this.db.put(seqIdKey, msg.msgId).then();
}
} catch (e) { } catch (e) {
this.db.put(seqIdKey, msg.msgId).then();
// log("更新seqId error", e.stack, seqIdKey);
} }
// log("更新消息", existMsg.msgSeq, existMsg.msgShortId, existMsg.msgId); // log("更新消息", existMsg.msgSeq, existMsg.msgShortId, existMsg.msgId);
} }
@ -197,11 +195,11 @@ class DBUtil {
if (this.cache[key]) { if (this.cache[key]) {
return this.cache[key] as FileCache return this.cache[key] as FileCache
} }
try{ try {
let data = await this.db.get(key); let data = await this.db.get(key);
return JSON.parse(data); return JSON.parse(data);
}catch (e) { } catch (e) {
} }
} }

View File

@ -106,7 +106,7 @@ export class OB11Constructor {
continue continue
} }
}catch (e) { }catch (e) {
log("获取不到引用的消息", e.stack) log("获取不到引用的消息", e.stack, element.replyElement.replayMsgSeq)
} }
} else if (element.picElement) { } else if (element.picElement) {
@ -119,7 +119,7 @@ export class OB11Constructor {
if (url){ if (url){
message_data["data"]["url"] = IMAGE_HTTP_HOST + url message_data["data"]["url"] = IMAGE_HTTP_HOST + url
} }
else if (fileMd5){ else if (fileMd5 && element.picElement.fileUuid.indexOf("_") === -1){ // fileuuid有下划线的是Linux发送的这个url是另外的格式目前尚未得知如何组装
message_data["data"]["url"] = `${IMAGE_HTTP_HOST}/gchatpic_new/0/0-0-${fileMd5.toUpperCase()}/0` message_data["data"]["url"] = `${IMAGE_HTTP_HOST}/gchatpic_new/0/0-0-${fileMd5.toUpperCase()}/0`
} }
// message_data["data"]["file_id"] = element.picElement.fileUuid // message_data["data"]["file_id"] = element.picElement.fileUuid