前端:

优化electron效果
This commit is contained in:
2026-03-07 13:40:06 +08:00
parent 333391d16f
commit e43f7d6365
52 changed files with 2929 additions and 543 deletions
@@ -1002,6 +1002,14 @@
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {},
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {},
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {},
"SixLabors.ImageSharp/3.1.12": {
"runtime": {
"lib/net6.0/SixLabors.ImageSharp.dll": {
"assemblyVersion": "3.0.0.0",
"fileVersion": "3.1.12.0"
}
}
},
"StackExchange.Redis/2.9.32": {
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "10.0.2",
@@ -1692,6 +1700,7 @@
"Newtonsoft.Json": "13.0.4",
"Pomelo.EntityFrameworkCore.MySql": "8.0.3",
"RedLock.net": "2.3.2",
"SixLabors.ImageSharp": "3.1.12",
"StackExchange.Redis": "2.9.32",
"Swashbuckle.AspNetCore": "6.6.2",
"System.IdentityModel.Tokens.Jwt": "8.14.0"
@@ -2362,6 +2371,13 @@
"path": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0",
"hashPath": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512"
},
"SixLabors.ImageSharp/3.1.12": {
"type": "package",
"serviceable": true,
"sha512": "sha512-iAg6zifihXEFS/t7fiHhZBGAdCp3FavsF4i2ZIDp0JfeYeDVzvmlbY1CNhhIKimaIzrzSi5M/NBFcWvZT2rB/A==",
"path": "sixlabors.imagesharp/3.1.12",
"hashPath": "sixlabors.imagesharp.3.1.12.nupkg.sha512"
},
"StackExchange.Redis/2.9.32": {
"type": "package",
"serviceable": true,
Binary file not shown.
Binary file not shown.
@@ -20,6 +20,7 @@
"Newtonsoft.Json": "13.0.4",
"Pomelo.EntityFrameworkCore.MySql": "8.0.3",
"RedLock.net": "2.3.2",
"SixLabors.ImageSharp": "3.1.12",
"StackExchange.Redis": "2.9.32",
"Swashbuckle.AspNetCore": "6.6.2",
"System.IdentityModel.Tokens.Jwt": "8.14.0"
@@ -870,6 +871,14 @@
}
}
},
"SixLabors.ImageSharp/3.1.12": {
"runtime": {
"lib/net6.0/SixLabors.ImageSharp.dll": {
"assemblyVersion": "3.0.0.0",
"fileVersion": "3.1.12.0"
}
}
},
"StackExchange.Redis/2.9.32": {
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "10.0.2",
@@ -1564,6 +1573,13 @@
"path": "redlock.net/2.3.2",
"hashPath": "redlock.net.2.3.2.nupkg.sha512"
},
"SixLabors.ImageSharp/3.1.12": {
"type": "package",
"serviceable": true,
"sha512": "sha512-iAg6zifihXEFS/t7fiHhZBGAdCp3FavsF4i2ZIDp0JfeYeDVzvmlbY1CNhhIKimaIzrzSi5M/NBFcWvZT2rB/A==",
"path": "sixlabors.imagesharp/3.1.12",
"hashPath": "sixlabors.imagesharp.3.1.12.nupkg.sha512"
},
"StackExchange.Redis/2.9.32": {
"type": "package",
"serviceable": true,
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -14,7 +14,7 @@
"RefreshTokenDays": 30
},
"ConnectionStrings": {
"DefaultConnection": "Server=frp-era.com;Port=26582;Database=IM;User=product;Password=12345678;",
"DefaultConnection": "Server=192.168.5.100;Port=3306;Database=IM;User=product;Password=12345678;",
"Redis": "192.168.5.100:6379"
},
"RabbitMQOptions": {
@@ -25,6 +25,6 @@
},
"FileUploadOptions": {
"DefaultStorage": "Local",
"ChunkSize": 10,
"ChunkSize": 5000000,
}
}
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("IMTest")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d42956051108811cdd7be6a07af6b11e1d7f0d15")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2ecaa28091b41de707825db3628d380b62fa727f")]
[assembly: System.Reflection.AssemblyProductAttribute("IMTest")]
[assembly: System.Reflection.AssemblyTitleAttribute("IMTest")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
fa24b386648cc4dba48ae5e3f91e5303b0dfd0971bba62bc27ca1580a5064337
ed4980dfc7aff253176b260ed9015f9a80b52e92cbf3095eff3ed06865ea6e0d
@@ -1 +1 @@
b2b545acb4173028f4d41b8d8c0aea03ecbcecb4eeabe997ca466c2e265beff6
a18d4d5688b125e6729fd465f09e267a2a7532eadaaca930389969ac369409ce
@@ -151,3 +151,4 @@ C:\Users\nanxun\Documents\IM\backend\IMTest\bin\Debug\net8.0\Microsoft.Extension
C:\Users\nanxun\Documents\IM\backend\IMTest\bin\Debug\net8.0\Microsoft.Extensions.Caching.StackExchangeRedis.dll
C:\Users\nanxun\Documents\IM\backend\IMTest\bin\Debug\net8.0\Microsoft.Extensions.Primitives.dll
C:\Users\nanxun\Documents\IM\backend\IMTest\bin\Debug\net8.0\System.Diagnostics.DiagnosticSource.dll
C:\Users\nanxun\Documents\IM\backend\IMTest\bin\Debug\net8.0\SixLabors.ImageSharp.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+12
View File
@@ -11,6 +11,7 @@ using IM_API.Models.Upload;
using IM_API.Tools;
using IM_API.VOs;
using IM_API.VOs.Conversation;
using IM_API.VOs.Group;
using IM_API.VOs.Message;
namespace IM_API.Configs
@@ -203,6 +204,17 @@ namespace IM_API.Configs
.ForMember(dest => dest.Size, opt => opt.MapFrom(src => src.FileSize));
CreateMap<ImageDto, VideoDto>();
//群成员模型
CreateMap<UserInfoDto, GroupMemberVo>()
.ForMember(dest => dest.Nickname, opt => opt.MapFrom(src => src.NickName))
.ForMember(dest => dest.Username, opt => opt.MapFrom(src => src.Username))
.ForMember(dest => dest.UserId, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.Avatar, opt => opt.MapFrom(src => src.Avatar));
CreateMap<GroupMember, GroupMemberVo>()
.ForMember(dest => dest.Created, opt => opt.MapFrom(src => src.Created))
.ForMember(dest => dest.Role, opt => opt.MapFrom(src => src.RoleEnum));
}
}
}
@@ -1,6 +1,7 @@
using IM_API.Dtos;
using IM_API.Dtos.Group;
using IM_API.Interface.Services;
using IM_API.VOs.Group;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -67,5 +68,14 @@ namespace IM_API.Controllers
var res = new BaseResponse<object?>();
return Ok(res);
}
[HttpGet]
[ProducesResponseType(typeof(BaseResponse<List<GroupMemberVo>>), StatusCodes.Status200OK)]
public async Task<IActionResult> GetGroupMembers([FromQuery]int groupId)
{
var useridStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
var members = await _groupService.GetGroupMembers(int.Parse(useridStr), groupId);
return Ok(new BaseResponse<List<GroupMemberVo>>(members));
}
}
}
@@ -1,5 +1,6 @@
using IM_API.Dtos.Group;
using IM_API.Models;
using IM_API.VOs.Group;
namespace IM_API.Interface.Services
{
@@ -51,5 +52,6 @@ namespace IM_API.Interface.Services
Task HandleGroupRequestAsync(int userid, HandleGroupRequestDto dto);
Task MakeGroupRequestAsync(int userId,int? adminUserId,int groupId);
Task MakeGroupMemberAsync(int userId, int groupId, GroupMemberRole? role);
Task<List<GroupMemberVo>> GetGroupMembers(int userId, int groupId);
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IM_API.Migrations
{
/// <inheritdoc />
public partial class uploadtaskurl : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Url",
table: "upload_tasks",
type: "longtext",
nullable: true,
collation: "utf8mb4_general_ci")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Url",
table: "upload_tasks");
}
}
}
@@ -812,6 +812,9 @@ namespace IM_API.Migrations
b.Property<int>("TotalChunks")
.HasColumnType("int");
b.Property<string>("Url")
.HasColumnType("longtext");
b.HasKey("Id")
.HasName("PRIMARY");
@@ -20,5 +20,6 @@
public string? ProviderUploadId { get; set; } // OSS/S3 UploadId
public DateTimeOffset CreatedAt { get; set; }
public string? Url { get; set; }
}
}
@@ -34,8 +34,9 @@ namespace IM_API.Services
var privateList = await (from c in _context.Conversations
join f in _context.Friends on new { c.UserId, c.TargetId }
equals new { UserId = f.UserId, TargetId = f.FriendId }
join u in _context.Users on c.TargetId equals u.Id
where c.UserId == userId && c.ChatType == ChatType.PRIVATE
select new { c, f.Avatar, f.RemarkName })
select new { c, u.Avatar, f.RemarkName })
.ToListAsync();
// 2. 获取群聊会话
+19
View File
@@ -2,13 +2,16 @@
using AutoMapper.QueryableExtensions;
using IM_API.Domain.Events;
using IM_API.Dtos.Group;
using IM_API.Dtos.User;
using IM_API.Exceptions;
using IM_API.Interface.Services;
using IM_API.Models;
using IM_API.Tools;
using IM_API.VOs.Group;
using MassTransit;
using Microsoft.EntityFrameworkCore;
using System;
using System.Linq;
namespace IM_API.Services
{
@@ -247,5 +250,21 @@ namespace IM_API.Services
});
return;
}
public async Task<List<GroupMemberVo>> GetGroupMembers(int userId, int groupId)
{
var members = await _context.GroupMembers
.Where(x => x.GroupId == groupId).ToListAsync();
if (members is null || members.Count() == 0)
return [];
var users = await _userService.GetUserInfoListAsync(members.Select(x => x.UserId).ToList());
return users.Zip(members, (u, m) =>
{
var user = _mapper.Map<GroupMemberVo>(u);
_mapper.Map(m, user);
return user;
}).ToList();
}
}
}
@@ -157,9 +157,14 @@ namespace IM_API.Services
public async Task<UploadTask> UploadSmallFileAsync(Stream stream, string fileName, string fileType, long size, string hash)
{
var request = _httpContext.HttpContext?.Request;
var baseUrl = $"{request.Scheme}://{request.Host}";
var taskOld = await _uploadTaskService.GetTaskAsync(hash);
if (taskOld is not null) return taskOld;
if (taskOld is not null) {
taskOld.Url = UrlTools.GetFullUrl(taskOld.ObjectName, ProviderName, baseUrl);
return taskOld;
}
var userId = _httpContext.HttpContext?.User.FindFirstValue(ClaimTypes.NameIdentifier);
var objectname = ObjectNameGenerator.Generate(new ObjectNameContext
@@ -184,6 +189,7 @@ namespace IM_API.Services
FileSize = size,
Id = Guid.NewGuid(),
ObjectName = objectname,
Url = UrlTools.GetFullUrl(objectname, ProviderName, baseUrl),
ProviderUploadId = Guid.NewGuid().ToString(),
Status = UploadStatus.Completed,
StorageProvider = ProviderName,
+14
View File
@@ -0,0 +1,14 @@
using IM_API.Models;
namespace IM_API.VOs.Group
{
public class GroupMemberVo
{
public int UserId { get; set; }
public string Username { get; set; }
public string Nickname { get; set; }
public string Avatar { get; set; }
public GroupMemberRole Role { get; set; }
public DateTimeOffset Created { get; set; }
}
}