Changes: - Remove deprecated Fengling.Activity and YarpGateway.Admin projects - Add points processing services with distributed lock support - Update Vben frontend with gateway management pages - Add gateway config controller and database listener - Update routing to use header-mixed-nav layout - Add comprehensive test suites for Member services - Add YarpGateway integration tests - Update package versions in Directory.Packages.props Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
namespace Fengling.Member.Application.Services;
|
||
|
||
/// <summary>
|
||
/// 分布式锁获取结果
|
||
/// </summary>
|
||
public class LockAcquisitionResult
|
||
{
|
||
public bool Success { get; set; }
|
||
public string? LockValue { get; set; }
|
||
public string? ErrorMessage { get; set; }
|
||
|
||
public static LockAcquisitionResult Succeeded(string lockValue) => new()
|
||
{
|
||
Success = true,
|
||
LockValue = lockValue
|
||
};
|
||
|
||
public static LockAcquisitionResult Failed(string errorMessage) => new()
|
||
{
|
||
Success = false,
|
||
ErrorMessage = errorMessage
|
||
};
|
||
}
|
||
|
||
/// <summary>
|
||
/// 分布式锁接口
|
||
/// </summary>
|
||
public interface ICodeDistributedLock
|
||
{
|
||
/// <summary>
|
||
/// 获取分布式锁
|
||
/// </summary>
|
||
/// <param name="codeId">码ID</param>
|
||
/// <param name="ttl">锁过期时间,默认10秒</param>
|
||
/// <returns>获取结果</returns>
|
||
Task<LockAcquisitionResult> AcquireAsync(string codeId, TimeSpan? ttl = null);
|
||
|
||
/// <summary>
|
||
/// 释放分布式锁
|
||
/// </summary>
|
||
/// <param name="codeId">码ID</param>
|
||
/// <param name="lockValue">锁值</param>
|
||
Task ReleaseAsync(string codeId, string lockValue);
|
||
}
|