|
|
@@ -16,6 +16,15 @@ namespace molilian.core
|
|
|
{
|
|
|
public partial class TkPoolCore
|
|
|
{
|
|
|
+ private static string _end_point;
|
|
|
+ static TkPoolCore()
|
|
|
+ {
|
|
|
+ _end_point = Environment.GetEnvironmentVariable("EndPoint");
|
|
|
+#if DEBUG
|
|
|
+ _end_point = "zz";
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
private static readonly object _lockObj = new();
|
|
|
private static IEnumerable<TkPoolDTO> _cached;
|
|
|
private static Dictionary<string, decimal> _incomeAmt = new();
|
|
|
@@ -23,11 +32,7 @@ namespace molilian.core
|
|
|
{
|
|
|
var list = List();
|
|
|
if (!list.Any()) return null;
|
|
|
-#if DEBUG
|
|
|
- return list.Where(e => e.id == 7).OrderBy(l => Guid.NewGuid()).FirstOrDefault();
|
|
|
-#else
|
|
|
return list.Where(IsNotExceedDailyIncomeLimit).OrderBy(l => Guid.NewGuid()).FirstOrDefault();
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
internal static void SaveIncomeAmt(string accountName, decimal income_amt)
|
|
|
@@ -58,6 +63,10 @@ namespace molilian.core
|
|
|
}
|
|
|
private static bool IsNotExceedDailyIncomeLimit(TkPoolDTO item)
|
|
|
{
|
|
|
+ if (!string.IsNullOrEmpty(_end_point) && !string.IsNullOrEmpty(item.end_point))
|
|
|
+ {
|
|
|
+ if (item.end_point != _end_point) return false;
|
|
|
+ }
|
|
|
if (item.daily_income_limit == 0) return true;
|
|
|
decimal income_amt = GetIncomeAmt(item.name);
|
|
|
return income_amt < item.daily_income_limit;
|