diff --git a/XiaoXiaoRoBot/Cmd/LingTianCmd.cs b/XiaoXiaoRoBot/Cmd/LingTianCmd.cs
new file mode 100644
index 0000000..7eb5995
--- /dev/null
+++ b/XiaoXiaoRoBot/Cmd/LingTianCmd.cs
@@ -0,0 +1,108 @@
+using System.Text.RegularExpressions;
+using Lagrange.Core.Common.Interface.Api;
+using Lagrange.Core.Message;
+using Lagrange.Core.Message.Entity;
+using RoBot.Core;
+using RoBot.Core.ConstValue;
+using RoBot.Core.Helper;
+using RoBot.Start.Global;
+using RoBot.Start.LogConfig;
+using RoBot.Start.Service.Dto;
+
+namespace RoBot.Start.Cmd
+{
+ ///
+ /// 灵田结算查价格
+ ///
+ public class LingTianCmd
+ {
+ public static async Task Execute(MessageChain chain)
+ {
+ try
+ {
+ var textEntities = chain.Where(o => o is TextEntity).ToList();
+ List convertList = textEntities.Cast().ToList().Where(o => o.Text.Contains("道友本次采集成果") || o.Text.Contains("道友成功收获药材")).ToList();
+ foreach (var item in convertList)
+ {
+ List goods = new();
+ if (item.Text.Contains("道友本次采集成果"))
+ {
+ goods = await NewCmd(item.Text);
+ }
+ else if (item.Text.Contains("道友成功收获药材"))
+ {
+ goods = await OldCmd(item.Text);
+ }
+ if (goods.Count > 0)
+ {
+ var systemConfig = GlobalConfig.ConfigSetting;
+ var bot = GlobalConfig.BotContext;
+
+ string msg = "";
+ decimal totalPrice = 0;
+ decimal fee = 0;
+ // 打印结果
+ foreach (var good in goods)
+ {
+ var current = RedisHelper.Client.HGet(RedisPrefix.GoodsKey, good.Name);
+ if (current is not null)
+ {
+ int num = good.Num.Value > 10 ? 10 : good.Num.Value;
+ decimal nicePrice = current.Price - 100000;
+ totalPrice += Convert.ToDecimal(nicePrice * num);
+
+ fee += Math.Round(Utils.CalculateFee(nicePrice) * num, 0);
+ }
+ }
+ if (totalPrice > 0)
+ {
+ msg = $"恭喜道友成功收取{goods.Sum(o => o.Num)}株药材\r\n";
+ msg += $"总价值约:{Utils.FormatNumberToChineseUnit(totalPrice)}\r\n";
+ msg += $"手续费约:{Utils.FormatNumberToChineseUnit(fee)}\r\n";
+ msg += $"到账约:{Utils.FormatNumberToChineseUnit(totalPrice - fee)}";
+
+ var groupMessageChain = MessageBuilder.Group((uint)systemConfig.GroupQQ).Forward(chain).Text(msg);
+ await bot.SendMessage(groupMessageChain.Build());
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Logs.Write($@"{DateTime.Now:yyyy-MM-dd HH:mm:ss} 灵田结算查价格 发生异常,异常信息:{ex.Message},异常堆栈:{ex.StackTrace}");
+
+ }
+ return await Task.FromResult(true);
+ }
+
+ private static async Task> OldCmd(string message)
+ {
+ List goodsInfos = new();
+ var result = new List<(string Name, int Count)>();
+ var regex = new Regex(@"道友成功收获药材:(.+?) (\d+) 个!");
+
+ foreach (Match match in regex.Matches(message))
+ {
+ string name = match.Groups[1].Value;
+ int count = int.Parse(match.Groups[2].Value);
+ goodsInfos.Add(new() { Name = name, Num = count });
+ }
+ return await Task.FromResult(goodsInfos);
+ }
+
+ private static async Task> NewCmd(string message)
+ {
+ List goodsInfos = new();
+ var result = new List<(string Name, int Count)>();
+ var regex = new Regex(@"收获药材:(.+?) (\d+) 个!");
+
+ foreach (Match match in regex.Matches(message))
+ {
+ string name = match.Groups[1].Value;
+ int count = int.Parse(match.Groups[2].Value);
+ goodsInfos.Add(new() { Name = name, Num = count });
+ }
+ return await Task.FromResult(goodsInfos);
+ }
+ }
+}
diff --git a/XiaoXiaoRoBot/Program.cs b/XiaoXiaoRoBot/Program.cs
index 435a468..26ac5cc 100644
--- a/XiaoXiaoRoBot/Program.cs
+++ b/XiaoXiaoRoBot/Program.cs
@@ -98,6 +98,9 @@ async Task HandleGroupMessage(MessageChain chain)
// 查看物品信息命令 价格/数据更新时间
await QueryGoodsInfoPriceCmd.Execute(chain);
+ // 灵田结算价格
+ await LingTianCmd.Execute(chain);
+
return true;
}