OEM 分级

佣金价格设置 数据库存放修改
This commit is contained in:
chfei committed 2026-11-17 19:10:29 +08:00
1 parent ea0cbd6b92
commit 2de3d0dc92
24 files changed
+1224 -10

No files matched your search

@@ -90,4 +90,10 @@ public class OEMEntity
/// </summary>
[Column(Name = "total_withdraw_amount")]
public long TotalWithdrawAmount { get; set; }
/// <summary>
/// 父级OEMid
/// </summary>
[Column(Name = "parent_oem_id")]
public string ParentOemId { get; set; }
}
@@ -0,0 +1,59 @@
using FreeSql.DataAnnotations;
using Store.Contracts.User.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Store.Contracts.User.Entitys;
[Table(Name = "wxxd.oem_markup_rule")]
public class OEMMarkupRuleEntity
{
/// <summary>
/// 自增主键
/// </summary>
[Column(Name = "id", IsPrimary = true, IsIdentity = true)]
public long Id { get; set; }
/// <summary>
/// 设置者(上级),也是该笔加价的收益方
/// </summary>
[Column(Name = "setter_oem_id")]
public string SetterOemId { get; set; }
/// <summary>
/// 目标类型 1=下级OEM 2=用户
/// </summary>
[Column(Name = "target_type", MapType = typeof(sbyte))]
public OEMMarkupTargetType TargetType { get; set; }
/// <summary>
/// 目标ID:type=1 是oem_id, type=2 是user_name
/// </summary>
[Column(Name = "target_id")]
public string TargetId { get; set; }
/// <summary>
/// 交易类型
/// 20 快递
/// 26 退货快递
/// 16 礼物单
/// 55 同步物流
/// </summary>
[Column(Name = "payment_type", MapType = typeof(sbyte))]
public UserPaymentTypes PaymentType { get; set; }
/// <summary>
/// 加价金额,单位:分
/// </summary>
[Column(Name = "markup")]
public int Markup { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[Column(Name = "updated_at")]
public DateTime UpdatedAt { get; set; }
}
@@ -0,0 +1,8 @@
namespace Store.Contracts.User.Enums;
/// <summary>OEM 加价规则的目标类型。</summary>
public enum OEMMarkupTargetType : sbyte
{
OEM = 1,
User = 2,
}
@@ -11,6 +11,16 @@ namespace Store.Contracts.User.Interfaces;
public interface IUserService
{
/// <summary>交易类型默认地板价,单位:分。</summary>
int GetDefaultFloorPrice(UserPaymentTypes paymentType);
/// <summary>设置直属主用户加价,单位:分,不允许传入子账号。</summary>
void SetUserMarkup(string setterOemId, string userName, UserPaymentTypes paymentType, int markup);
/// <summary>设置直属下级OEM加价,单位:分。</summary>
void SetOEMMarkup(string setterOemId, string oemId, UserPaymentTypes paymentType, int markup);
/// <summary>地板价加上A对B的加价、B对用户的加价,缺失规则按0计算,单位:分。</summary>
int GetUserFinalPrice(string userName, UserPaymentTypes paymentType);
/// <summary>批量查询四种最终价格,返回用户名到消费类型、价格(分)的映射。</summary>
Dictionary<string, Dictionary<UserPaymentTypes, int>> GetUserFinalPrices(IEnumerable<UserEntity> users);
bool CanAfford(string userName, UserPaymentTypes type, decimal consumeAmount);
OEMEntity GetOEMByOemId(string oemId, bool isCache = true);
OEMEntity GetOEMByUserName(string userName, bool isCache = true);