-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb5ad75
commit a364582
Showing
1 changed file
with
11 additions
and
5 deletions.
There are no files selected for viewing
16 changes: 11 additions & 5 deletions
16
src/CAServer.ContractEventHandler.Core/Application/PayRedPackageAccount.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using Newtonsoft.Json; | ||
|
||
namespace CAServer.ContractEventHandler.Core.Application; | ||
|
||
public class PayRedPackageAccount | ||
{ | ||
public List<string> RedPackagePayAccounts { get; set; } | ||
|
||
private static readonly object _lockObject = new object(); | ||
public string getOneAccountRandom() | ||
{ | ||
Debug.Assert(RedPackagePayAccounts.IsNullOrEmpty(), | ||
"we can not find pay red package from account"); | ||
Random rd = new Random(); | ||
int path = rd.Next(); | ||
return RedPackagePayAccounts[path % RedPackagePayAccounts.Count]; | ||
lock (_lockObject) | ||
{ | ||
Console.WriteLine($"RedPackagePayAccounts {JsonConvert.SerializeObject(RedPackagePayAccounts)}"); | ||
Debug.Assert(RedPackagePayAccounts.IsNullOrEmpty(), | ||
"we can not find pay red package from account"); | ||
Random rd = new Random(); | ||
int path = rd.Next(); | ||
return RedPackagePayAccounts[path % RedPackagePayAccounts.Count]; | ||
} | ||
} | ||
} |