From 63abdeec58f5b2380a0114b69b9b8c33f3c2c2c4 Mon Sep 17 00:00:00 2001 From: lxw Date: Wed, 5 Jun 2024 16:41:48 +0800 Subject: [PATCH] xian chang ceshi xuqiu --- Service/Charger/ChargerService.cs | 5 +++-- Service/Charger/Client/ClientMgr.cs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Service/Charger/ChargerService.cs b/Service/Charger/ChargerService.cs index 358a509..4a132e7 100644 --- a/Service/Charger/ChargerService.cs +++ b/Service/Charger/ChargerService.cs @@ -1,4 +1,5 @@ -using Entity.DbModel.Station; +using System.Collections.Concurrent; +using Entity.DbModel.Station; using Entity.Dto.Resp; using HybirdFrameworkCore.Autofac.Attribute; using HybirdFrameworkCore.Entity; @@ -81,7 +82,7 @@ public class ChargerService /// public Result DistributeElecPriceForCharge(int version) { - Dictionary chargerClients = ClientMgr.Dictionary; + ConcurrentDictionary chargerClients = ClientMgr.Dictionary; if (chargerClients.Values.Count <= 0) { return Result.Fail(); diff --git a/Service/Charger/Client/ClientMgr.cs b/Service/Charger/Client/ClientMgr.cs index 416e5cd..2db3e51 100644 --- a/Service/Charger/Client/ClientMgr.cs +++ b/Service/Charger/Client/ClientMgr.cs @@ -1,4 +1,5 @@ -using Autofac; +using System.Collections.Concurrent; +using Autofac; using Common.Const; using DotNetty.Transport.Channels; using Entity.DbModel.Station; @@ -19,7 +20,7 @@ public static class ClientMgr { private static readonly ILog Log = LogManager.GetLogger(typeof(ClientMgr)); - public static readonly Dictionary Dictionary = new(); + public static readonly ConcurrentDictionary Dictionary = new(); private static bool AutoChargeWorking { get; set; }