diff --git a/RoBot.Core/Utils.cs b/RoBot.Core/Utils.cs
index 92148ab..bab69d5 100644
--- a/RoBot.Core/Utils.cs
+++ b/RoBot.Core/Utils.cs
@@ -37,6 +37,30 @@
return value * multiplier;
}
+ ///
+ /// 计算手续费
+ ///
+ ///
+ ///
+ public static decimal CalculateFee(decimal amount)
+ {
+ decimal rate = 0;
+
+ if (amount < 500_0000) // 0 ~ 499w
+ rate = 0.05m; // 5%
+ else if (amount < 1000_0000) // 500 ~ 999w
+ rate = 0.10m; // 10%
+ else if (amount < 1500_0000) // 1000 ~ 1499w
+ rate = 0.15m; // 15%
+ else if (amount < 2000_0000) // 1500 ~ 1999w
+ rate = 0.20m; // 20%
+ else // 2000w以上
+ rate = 0.30m; // 30%
+
+ return amount * rate;
+ }
+
+
}
}
diff --git a/XiaoXiaoRoBot/Cmd/QueryGoodsUpShopPriceCmd.cs b/XiaoXiaoRoBot/Cmd/QueryGoodsUpShopPriceCmd.cs
index 916277d..6397107 100644
--- a/XiaoXiaoRoBot/Cmd/QueryGoodsUpShopPriceCmd.cs
+++ b/XiaoXiaoRoBot/Cmd/QueryGoodsUpShopPriceCmd.cs
@@ -84,22 +84,29 @@ namespace RoBot.Start.Cmd
string msg = "";
decimal totalPrice = 0;
+ decimal fee = 0;
// 打印结果
foreach (var item in results)
{
var current = RedisHelper.Client.HGet(RedisPrefix.GoodsKey, item.Name);
if (current is not null)
{
+ int num = item.Num.Value > 10 ? 10 : item.Num.Value;
decimal nicePrice = current.Price - 100000;
- totalPrice += Convert.ToDecimal(nicePrice * item.Num);
- msg += $"确认坊市上架{item.Name} {(int)current.Price - 100000} {item.Num}\n";
+ totalPrice += Convert.ToDecimal(nicePrice * num);
+
+ fee += Math.Round(Utils.CalculateFee(nicePrice) * num, 0);
+
+ msg += $"确认坊市上架{item.Name} {(int)current.Price - 100000} {num}\n";
}
}
if (string.IsNullOrWhiteSpace(msg) is false)
{
msg += "\r\n";
msg += "使用前请先@小小查看坊市药材,过完一遍以获取最新价格\r\n当前价格为坊市价格-10w\r\n";
- msg += $"总价值约:{Utils.FormatNumberToChineseUnit(totalPrice)}";
+ msg += $"总价值约:{Utils.FormatNumberToChineseUnit(totalPrice)}\r\n";
+ msg += $"手续费约:{Utils.FormatNumberToChineseUnit(fee)}\r\n";
+ msg += $"到账约:{Utils.FormatNumberToChineseUnit(totalPrice - fee)}";
var systemConfig = GlobalConfig.ConfigSetting;
var bot = GlobalConfig.BotContext;
await bot.SendMsg((uint)systemConfig.GroupQQ, msg);