-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
41 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,44 @@ | ||
import { ChatType, Peer, RawMessage, SendMessageElement } from '@/core/qqnt/entities'; | ||
import BaseAction from '../BaseAction'; | ||
import { ActionName } from '../types'; | ||
import { NTQQMsgApi } from '@/core/qqnt/apis'; | ||
import { getFriend, getUidByUin } from '@/common/data'; | ||
|
||
interface Payload{ | ||
message_id: number | ||
interface Payload { | ||
uin: string, | ||
} | ||
|
||
export default class GoCQHTTPMarkMsgAsRead extends BaseAction<Payload, null>{ | ||
actionName = ActionName.GoCQHTTP_MarkMsgAsRead; | ||
|
||
class MarkMsgAsRead extends BaseAction<Payload, null> { | ||
ReqChatType = 0; | ||
protected async _handle(payload: Payload): Promise<null> { | ||
let uid: string | undefined = payload.uin; | ||
if (this.ReqChatType != ChatType.group) { | ||
uid = getUidByUin(payload.uin.toString()) | ||
if (!uid) { | ||
throw `记录${payload.uin}不存在`; | ||
} | ||
let friend = await getFriend(uid); | ||
this.ReqChatType = friend ? ChatType.friend : ChatType.temp;//重写 | ||
} | ||
|
||
|
||
|
||
// 获取UID 组装Peer | ||
// GuildId: string 留空 | ||
let ReqPeer: Peer = { chatType: this.ReqChatType, peerUid: uid, guildId: "" }; | ||
// 调用API | ||
let ret = await NTQQMsgApi.setMsgRead(ReqPeer); | ||
if (ret.result != 0) { | ||
throw ('设置已读失败'); | ||
} | ||
return null; | ||
} | ||
} | ||
export class MarkPrivateMsgAsRead extends MarkMsgAsRead { | ||
actionName = ActionName.MarkPrivateMsgAsRead; | ||
ReqChatType = ChatType.friend; | ||
} | ||
export class MarkGroupMsgAsRead extends MarkMsgAsRead { | ||
actionName = ActionName.MarkGroupMsgAsRead; | ||
ReqChatType = ChatType.group; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const version = '1.0.3'; | ||
export const version = '1.1.2'; |