fengling-member-service/src/Fengling.Member.Application/Services/ICodeDistributedLock.cs
sam 92247346dd refactor: major project restructuring and cleanup
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>
2026-02-15 10:34:07 +08:00

45 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);
}