Skip to content

Commit

Permalink
debug for RedPackagePayAccounts
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny-k123 committed Dec 10, 2024
1 parent cb5ad75 commit a364582
Showing 1 changed file with 11 additions and 5 deletions.
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];
}
}
}

0 comments on commit a364582

Please sign in to comment.