Skip to content

Commit

Permalink
Merge 6920880 into 921da78
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoshinonyaruko authored Jun 28, 2024
2 parents 921da78 + 6920880 commit f74c61a
Show file tree
Hide file tree
Showing 12 changed files with 289 additions and 35 deletions.
4 changes: 2 additions & 2 deletions Processor/ProcessC2CMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (p *Processors) ProcessC2CMessage(data *dto.WSC2CMessageData) error {
//1,idmap还原真实userid,
//发信息使用的是userid

messageID64, err := idmap.StoreIDv2(data.ID)
messageID64, err := idmap.StoreCachev2(data.ID)
if err != nil {
log.Fatalf("Error storing ID: %v", err)
}
Expand Down Expand Up @@ -205,7 +205,7 @@ func (p *Processors) ProcessC2CMessage(data *dto.WSC2CMessageData) error {
//框架内指令
p.HandleFrameworkCommand(messageText, data, "group_private")
//映射str的messageID到int
messageID64, err := idmap.StoreIDv2(data.ID)
messageID64, err := idmap.StoreCachev2(data.ID)
if err != nil {
mylog.Printf("Error storing ID: %v", err)
return nil
Expand Down
4 changes: 2 additions & 2 deletions Processor/ProcessChannelDirectMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (p *Processors) ProcessChannelDirectMessage(data *dto.WSDirectMessageData)
//3,通过idmap用channelid获取guildid,
//发信息使用的是guildid
//todo 优化数据库读写次数
messageID64, err := idmap.StoreIDv2(data.ID)
messageID64, err := idmap.StoreCachev2(data.ID)
if err != nil {
log.Fatalf("Error storing ID: %v", err)
}
Expand Down Expand Up @@ -344,7 +344,7 @@ func (p *Processors) ProcessChannelDirectMessage(data *dto.WSDirectMessageData)

//userid := int(userid64)
//映射str的messageID到int
messageID64, err := idmap.StoreIDv2(data.ID)
messageID64, err := idmap.StoreCachev2(data.ID)
if err != nil {
mylog.Printf("Error storing ID: %v", err)
return nil
Expand Down
2 changes: 1 addition & 1 deletion Processor/ProcessGroupMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (p *Processors) ProcessGroupMessage(data *dto.WSGroupATMessageData) error {
//框架内指令
p.HandleFrameworkCommand(messageText, data, "group")
//映射str的messageID到int
messageID64, err := idmap.StoreIDv2(data.ID)
messageID64, err := idmap.StoreCachev2(data.ID)
if err != nil {
mylog.Printf("Error storing ID: %v", err)
return nil
Expand Down
2 changes: 1 addition & 1 deletion Processor/ProcessGuildATMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (p *Processors) ProcessGuildATMessage(data *dto.WSATMessageData) error {
echostr := fmt.Sprintf("%s_%d_%d", AppIDString, s, currentTimeMillis)

//映射str的messageID到int
messageID64, err := idmap.StoreIDv2(data.ID)
messageID64, err := idmap.StoreCachev2(data.ID)
if err != nil {
mylog.Printf("Error storing ID: %v", err)
return nil
Expand Down
2 changes: 1 addition & 1 deletion Processor/ProcessGuildNormalMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (p *Processors) ProcessGuildNormalMessage(data *dto.WSMessageData) error {
// 构造echostr,包括AppID,原始的s变量和当前时间戳
echostr := fmt.Sprintf("%s_%d_%d", AppIDString, s, currentTimeMillis)
//映射str的messageID到int
messageID64, err := idmap.StoreIDv2(data.ID)
messageID64, err := idmap.StoreCachev2(data.ID)
if err != nil {
mylog.Printf("Error storing ID: %v", err)
return nil
Expand Down
2 changes: 1 addition & 1 deletion Processor/ProcessThreadMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ func (p *Processors) ProcessThreadMessage(data *dto.WSThreadData) error {
// 构造echostr,包括AppID,原始的s变量和当前时间戳
echostr := fmt.Sprintf("%s_%d_%d", AppIDString, s, currentTimeMillis)
//映射str的messageID到int
messageID64, err := idmap.StoreIDv2(data.ID)
messageID64, err := idmap.StoreCachev2(data.ID)
if err != nil {
mylog.Printf("Error storing ID: %v", err)
return nil
Expand Down
2 changes: 1 addition & 1 deletion handlers/delete_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func init() {
func DeleteMsg(client callapi.Client, api openapi.OpenAPI, apiv2 openapi.OpenAPI, message callapi.ActionMessage) (string, error) {

//还原msgid
RealMsgID, err := idmap.RetrieveRowByIDv2(message.Params.MessageID.(string))
RealMsgID, err := idmap.RetrieveRowByCachev2(message.Params.MessageID.(string))
if err != nil {
mylog.Printf("error retrieving real RChannelID: %v", err)
}
Expand Down
8 changes: 4 additions & 4 deletions handlers/message_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func SendResponse(client callapi.Client, err error, message *callapi.ActionMessa
// 设置响应值
response := ServerResponse{}
if resp != nil {
messageID64, mapErr = idmap.StoreIDv2(resp.Message.ID)
messageID64, mapErr = idmap.StoreCachev2(resp.Message.ID)
if mapErr != nil {
mylog.Printf("Error storing ID: %v", mapErr)
return "", nil
Expand Down Expand Up @@ -246,7 +246,7 @@ func SendGuildResponse(client callapi.Client, err error, message *callapi.Action
// 设置响应值
response := ServerResponse{}
if resp != nil {
messageID64, mapErr = idmap.StoreIDv2(resp.ID)
messageID64, mapErr = idmap.StoreCachev2(resp.ID)
if mapErr != nil {
mylog.Printf("Error storing ID: %v", mapErr)
return "", nil
Expand Down Expand Up @@ -304,7 +304,7 @@ func SendC2CResponse(client callapi.Client, err error, message *callapi.ActionMe
// 设置响应值
response := ServerResponse{}
if resp != nil {
messageID64, mapErr = idmap.StoreIDv2(resp.Message.ID)
messageID64, mapErr = idmap.StoreCachev2(resp.Message.ID)
if mapErr != nil {
mylog.Printf("Error storing ID: %v", mapErr)
return "", nil
Expand Down Expand Up @@ -361,7 +361,7 @@ func SendGuildPrivateResponse(client callapi.Client, err error, message *callapi
// 设置响应值
response := ServerResponse{}
if resp != nil {
messageID64, mapErr = idmap.StoreIDv2(resp.ID)
messageID64, mapErr = idmap.StoreCachev2(resp.ID)
if mapErr != nil {
mylog.Printf("Error storing ID: %v", mapErr)
return "", nil
Expand Down
2 changes: 1 addition & 1 deletion handlers/send_group_msg_raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func HandleSendGroupMsgRaw(client callapi.Client, api openapi.OpenAPI, apiv2 ope

if isNumeric(messageID) && messageID != "0" {
// 当messageID是字符串形式的数字时,执行转换
RealMsgID, err := idmap.RetrieveRowByIDv2(messageID)
RealMsgID, err := idmap.RetrieveRowByCachev2(messageID)
if err != nil {
mylog.Printf("error retrieving real MessageID: %v", err)
} else {
Expand Down
Loading

0 comments on commit f74c61a

Please sign in to comment.