You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.2 KiB
C#

using Lagrange.Core.Message;
using Lagrange.Core.Message.Entity;
using RoBot.Start.LogConfig;
using RoBot.Start.Service.Impl;
namespace RoBot.Start.Cmd
{
/// <summary>
/// 保存或更新物品价格
/// </summary>
public class InertOrUpdateGoodsInfoCmd
{
public static async Task<bool> Execute(MessageChain chain)
{
try
{
foreach (var item in chain)
{
if (item is TextEntity)
{
TextEntity txe = item as TextEntity;
if (string.IsNullOrWhiteSpace(txe.Text) is false)
{
if (txe.Text.Contains("不鼓励不保障"))
{
GoodsService.AnalysisGoodsText(txe.Text);
}
}
}
}
}
catch (Exception ex)
{
Logs.Write($@"{DateTime.Now:yyyy-MM-dd HH:mm:ss} 保存或更新物品价格 发生异常,异常信息:{ex.Message},异常堆栈:{ex.StackTrace}");
}
return await Task.FromResult(true);
}
}
}