feat(member): implement member center management module
Some checks failed
Build and Deploy TenantApi + SkuWorker / build-and-deploy (push) Failing after 1m54s
Some checks failed
Build and Deploy TenantApi + SkuWorker / build-and-deploy (push) Failing after 1m54s
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using TakeoutSaaS.Shared.Abstractions.Entities;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Membership.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 会员日配置。
|
||||
/// </summary>
|
||||
public sealed class MemberDaySetting : MultiTenantEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否启用会员日。
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 周几(1-7,对应周一到周日)。
|
||||
/// </summary>
|
||||
public int Weekday { get; set; } = 2;
|
||||
|
||||
/// <summary>
|
||||
/// 会员日额外折扣(如 9 表示 9 折)。
|
||||
/// </summary>
|
||||
public decimal ExtraDiscountRate { get; set; } = 9m;
|
||||
}
|
||||
@@ -33,6 +33,21 @@ public sealed class MemberProfile : MultiTenantEntityBase
|
||||
/// </summary>
|
||||
public long? MemberTierId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 储值余额。
|
||||
/// </summary>
|
||||
public decimal StoredBalance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 储值实充余额。
|
||||
/// </summary>
|
||||
public decimal StoredRechargeBalance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 储值赠金余额。
|
||||
/// </summary>
|
||||
public decimal StoredGiftBalance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 会员状态。
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using TakeoutSaaS.Shared.Abstractions.Entities;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Membership.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 会员标签。
|
||||
/// </summary>
|
||||
public sealed class MemberProfileTag : MultiTenantEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 会员标识。
|
||||
/// </summary>
|
||||
public long MemberProfileId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标签名。
|
||||
/// </summary>
|
||||
public string TagName { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -17,6 +17,41 @@ public sealed class MemberTier : MultiTenantEntityBase
|
||||
/// </summary>
|
||||
public int RequiredGrowth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标键。
|
||||
/// </summary>
|
||||
public string IconKey { get; set; } = "user";
|
||||
|
||||
/// <summary>
|
||||
/// 主题色。
|
||||
/// </summary>
|
||||
public string ColorHex { get; set; } = "#999999";
|
||||
|
||||
/// <summary>
|
||||
/// 升级规则类型(none/amount/count/both)。
|
||||
/// </summary>
|
||||
public string UpgradeRuleType { get; set; } = "none";
|
||||
|
||||
/// <summary>
|
||||
/// 升级累计消费门槛。
|
||||
/// </summary>
|
||||
public decimal? UpgradeAmountThreshold { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 升级消费次数门槛。
|
||||
/// </summary>
|
||||
public int? UpgradeOrderCountThreshold { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 降级观察窗口天数。
|
||||
/// </summary>
|
||||
public int DowngradeWindowDays { get; set; } = 90;
|
||||
|
||||
/// <summary>
|
||||
/// 是否默认等级。
|
||||
/// </summary>
|
||||
public bool IsDefault { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 等级权益(JSON)。
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
using TakeoutSaaS.Domain.Membership.Entities;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Membership.Repositories;
|
||||
|
||||
/// <summary>
|
||||
/// 会员聚合仓储契约。
|
||||
/// </summary>
|
||||
public interface IMemberRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询租户下会员档案。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<MemberProfile>> GetProfilesAsync(long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 按手机号集合查询会员档案。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<MemberProfile>> GetProfilesByMobilesAsync(
|
||||
long tenantId,
|
||||
IReadOnlyCollection<string> mobiles,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 按标识查询会员档案。
|
||||
/// </summary>
|
||||
Task<MemberProfile?> FindProfileByIdAsync(long tenantId, long memberId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增会员档案集合。
|
||||
/// </summary>
|
||||
Task AddProfilesAsync(IEnumerable<MemberProfile> profiles, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 更新会员档案。
|
||||
/// </summary>
|
||||
Task UpdateProfileAsync(MemberProfile profile, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 查询租户下会员等级。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<MemberTier>> GetTiersAsync(long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 按标识查询会员等级。
|
||||
/// </summary>
|
||||
Task<MemberTier?> FindTierByIdAsync(long tenantId, long tierId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增会员等级。
|
||||
/// </summary>
|
||||
Task AddTierAsync(MemberTier tier, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 更新会员等级。
|
||||
/// </summary>
|
||||
Task UpdateTierAsync(MemberTier tier, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 删除会员等级。
|
||||
/// </summary>
|
||||
Task DeleteTierAsync(MemberTier tier, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 查询租户会员日配置。
|
||||
/// </summary>
|
||||
Task<MemberDaySetting?> GetMemberDaySettingAsync(long tenantId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 新增会员日配置。
|
||||
/// </summary>
|
||||
Task AddMemberDaySettingAsync(MemberDaySetting setting, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 更新会员日配置。
|
||||
/// </summary>
|
||||
Task UpdateMemberDaySettingAsync(MemberDaySetting setting, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 查询会员标签集合。
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<MemberProfileTag>> GetProfileTagsAsync(
|
||||
long tenantId,
|
||||
long memberProfileId,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 替换会员标签集合。
|
||||
/// </summary>
|
||||
Task ReplaceProfileTagsAsync(
|
||||
long tenantId,
|
||||
long memberProfileId,
|
||||
IReadOnlyCollection<string> tags,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// 持久化变更。
|
||||
/// </summary>
|
||||
Task SaveChangesAsync(CancellationToken cancellationToken = default);
|
||||
}
|
||||
Reference in New Issue
Block a user