From b8358a719801935776bd201af88e57d862dfc24b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E5=90=8D=E9=94=90?= <1565842059@qq.com>
Date: Tue, 9 Jun 2026 16:17:48 +0800
Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E8=A7=A3=E5=86=B3=E6=A0=87?=
=?UTF-8?q?=E7=9A=84=E5=80=BA=E5=88=B8=E6=9C=9F=E9=99=90=E7=BC=93=E5=AD=98?=
=?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../UnderlyingModule/UnderlyingHelper.cs | 21 +++++++++++++++++++
.../underlying_managerController.cs | 1 +
2 files changed, 22 insertions(+)
diff --git a/YLErpDAL/Modules/UnderlyingModule/UnderlyingHelper.cs b/YLErpDAL/Modules/UnderlyingModule/UnderlyingHelper.cs
index be030982..52c55e39 100644
--- a/YLErpDAL/Modules/UnderlyingModule/UnderlyingHelper.cs
+++ b/YLErpDAL/Modules/UnderlyingModule/UnderlyingHelper.cs
@@ -194,6 +194,27 @@ namespace YLErp.Modules.UnderlyingModule
}
}
+ ///
+ /// 清除指定标的的保证金率缓存
+ ///
+ /// 标的代码,为空时清除全部
+ public static void ClearMarginRateCache(string underlyingCode = null)
+ {
+ try
+ {
+ if (ylCache == null) return;
+
+ var cachePattern = string.IsNullOrEmpty(underlyingCode)
+ ? "ClientMarginRate:*"
+ : $"ClientMarginRate:*:{underlyingCode}:*";
+ ylCache.BatchDelete(cachePattern);
+ }
+ catch (Exception ex)
+ {
+ LogFactory.GetLogger("UnderlyingHelper").Error($"清除保证金率缓存时发生异常: {ex.Message}", ex);
+ }
+ }
+
///
/// 获取篮子标的品种对象
///
diff --git a/YLErpWeb/Controllers/underlying_managerController.cs b/YLErpWeb/Controllers/underlying_managerController.cs
index 3c3585bc..85e08a03 100644
--- a/YLErpWeb/Controllers/underlying_managerController.cs
+++ b/YLErpWeb/Controllers/underlying_managerController.cs
@@ -477,6 +477,7 @@ namespace YLErp.Web.Controllers
model.ExJson = JsonHelper.Serialize(model.Bond);
}
var r = new UnderlyingDalService(CurUser).SaveUnderlyingData(model);
+ YLErp.Modules.UnderlyingModule.UnderlyingHelper.ClearMarginRateCache(model.UnderlyingCode);
return JsonSuccess("更新成功", r);
}