From 2da5ba3f033df0f34aa7b4fdd6725743d66a2b66 Mon Sep 17 00:00:00 2001 From: SanaeFox <36219542+Hoshinonyaruko@users.noreply.github.com> Date: Sun, 24 Mar 2024 19:47:30 +0800 Subject: [PATCH] Beta351 (#359) * beta338 * beta319 * beta340 * beta341 * actionfix * beta342 * beta342 * beta342 * beta344 * beta345 * beta346 * beta347 * beta348 * beta349 * beta350 * beta351 --- images/upload_api.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/images/upload_api.go b/images/upload_api.go index 8287f3fc..35608fa3 100644 --- a/images/upload_api.go +++ b/images/upload_api.go @@ -12,6 +12,7 @@ import ( "net/http" "net/url" "regexp" + "strconv" "strings" "sync" @@ -94,10 +95,12 @@ func UploadBase64ImageToServer(msgid string, base64Image string, groupID string, } if config.GetImgUpApiVtv2() && groupID != "" { - if msgid == "" { - msgid = echo.GetLazyMessagesId(groupID) - } + if isNumeric(groupID) { + //用转换前的群号获取msgid + if msgid == "" { + msgid = echo.GetLazyMessagesId(groupID) + } // 检查groupID是否为纯数字构成 RetrieveRowByIDv2是通用逻辑,也可以将userid还原为32位数originaluserid // 但没有私信权限,故没有测试 originalGroupID, err := idmap.RetrieveRowByIDv2(groupID) @@ -109,6 +112,18 @@ func UploadBase64ImageToServer(msgid string, base64Image string, groupID string, // 用originalGroupID更新groupID groupID = originalGroupID + } else { + // 映射str的GroupID到int + GroupID64, err := idmap.StoreIDv2(groupID) + if err != nil { + log.Printf("failed to convert ChannelID to int: %v", err) + return picURL, 0, 0, 0, nil + } + groupIDTemp := strconv.FormatInt(GroupID64, 10) + //用数字的群号获取msgid + if msgid == "" { + msgid = echo.GetLazyMessagesId(groupIDTemp) + } } var richMediaMessage *dto.RichMediaMessage if !config.GetUploadPicV2Base64() {