feat: add referral qrcode generation provider

This commit is contained in:
xiong
2026-07-26 20:45:14 +08:00
parent 4279795d46
commit 7c1fe7688b
11 changed files with 490 additions and 8 deletions

View File

@@ -29,6 +29,19 @@ public sealed record ReferralQrcodeCommand(
string? QrcodeUrl,
JsonElement? Metadata);
public sealed record ReferralQrcodeGenerateRequest(
Guid TenantId,
Guid UserId,
string RefCode,
string Provider,
string Page,
string Scene);
public sealed record ReferralQrcodeGenerateResult(
string QrcodeUrl,
string Provider,
JsonElement Metadata);
public sealed record ReferralStatsQuery(Guid? ReferrerUserId = null, int? Limit = null);
public sealed record ReferralConversionQuery(Guid? ReferrerUserId = null, DateOnly? StartDate = null, DateOnly? EndDate = null, int? Days = null, int? Limit = null);
@@ -188,6 +201,13 @@ public interface IReferralService
CancellationToken cancellationToken = default);
}
public interface IReferralQrcodeGenerator
{
Task<ReferralQrcodeGenerateResult> GenerateAsync(
ReferralQrcodeGenerateRequest request,
CancellationToken cancellationToken = default);
}
public sealed class ReferralException(string message, string code) : Exception(message)
{
public string Code { get; } = code;

View File

@@ -19,6 +19,10 @@ public interface IObjectStorageService
ObjectStorageDownloadSignRequest request,
CancellationToken cancellationToken = default);
Task<ObjectStorageWriteResult> WriteObjectAsync(
ObjectStorageWriteRequest request,
CancellationToken cancellationToken = default);
Task<ObjectStorageMetadata> HeadObjectAsync(
ObjectStorageHeadRequest request,
CancellationToken cancellationToken = default);

View File

@@ -46,6 +46,18 @@ public sealed record ObjectStorageHeadRequest(
long? DeclaredFileSizeBytes = null,
string? DeclaredChecksumSha256 = null);
public sealed record ObjectStorageWriteRequest(
Guid TenantId,
string Provider,
string Bucket,
string ObjectKey,
string MimeType,
Stream Content,
long? FileSizeBytes,
string? ChecksumSha256 = null,
IReadOnlyDictionary<string, string>? Metadata = null,
bool Upsert = true);
public sealed record ObjectStorageSignedUrl(
string Provider,
string? Bucket,
@@ -70,6 +82,18 @@ public sealed record ObjectStorageMetadata(
IReadOnlyDictionary<string, string> RawHeaders,
string VerificationSource);
public sealed record ObjectStorageWriteResult(
string Provider,
string Bucket,
string ObjectKey,
Uri? PublicUrl,
long? SizeBytes,
string? MimeType,
string? ChecksumSha256,
string? ETag,
IReadOnlyDictionary<string, string> RawHeaders,
string VerificationSource);
public class ObjectStorageException(string message, string code) : InvalidOperationException(message)
{
public string Code { get; } = code;