From 0b9300e0ed8270b08bdb13adcc5dfbcbd20f0cbf Mon Sep 17 00:00:00 2001 From: Linwenxuan <116782992+Linwenxuan05@users.noreply.github.com> Date: Fri, 13 Oct 2023 15:57:45 +0800 Subject: [PATCH] Remove unnecessary uploading logic --- .../Logic/Implementation/MessagingLogic.cs | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/Lagrange.Core/Internal/Context/Logic/Implementation/MessagingLogic.cs b/Lagrange.Core/Internal/Context/Logic/Implementation/MessagingLogic.cs index 682fda681..5aef41183 100644 --- a/Lagrange.Core/Internal/Context/Logic/Implementation/MessagingLogic.cs +++ b/Lagrange.Core/Internal/Context/Logic/Implementation/MessagingLogic.cs @@ -149,53 +149,6 @@ private async Task ResolveChainUid(MessageChain chain) } break; } - case ImageEntity image: - { - if (!chain.IsGroup) - { - string uid = await Collection.Business.CachingLogic.ResolveUid(chain.GroupUin, chain.FriendUin) ?? throw new Exception($"Failed to resolve Uid for Uin {chain.FriendUin}"); - var @event = ImageUploadEvent.Create(image.ImageStream, uid); - var results = await Collection.Business.SendEvent(@event); - if (results.Count != 0) - { - var ticketResult = (ImageUploadEvent)results[0]; - if (!ticketResult.IsExist) - { - bool hwSuccess = await Collection.Highway.UploadSrcByStreamAsync(1, Collection.Keystore.Uin, image.ImageStream, ticketResult.Ticket, @event.FileMd5.UnHex()); - if (!hwSuccess) - { - Collection.Log.LogFatal(Tag, "Failed to upload image to highway"); - continue; - } - } - - image.ImageStream = @event.Stream; - image.Path = ticketResult.ServerPath; - } - } - else - { - var @event = ImageGroupUploadEvent.Create(image.ImageStream, chain.GroupUin ?? throw new Exception()); - var results = await Collection.Business.SendEvent(@event); - if (results.Count != 0) - { - var ticketResult = (ImageGroupUploadEvent)results[0]; - if (!ticketResult.IsExist) - { - bool hwSuccess = await Collection.Highway.UploadSrcByStreamAsync(2, Collection.Keystore.Uin, image.ImageStream, ticketResult.Ticket, @event.FileMd5.UnHex()); - if (!hwSuccess) - { - Collection.Log.LogFatal(Tag, "Failed to upload image to highway"); - continue; - } - } - - image.ImageStream = @event.Stream; - image.FileId = ticketResult.FileId; - } - } - break; - } } } }