using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using XYY.Data.Model.Standard.Tracking._17; using XYY.TaskTrack.Standard; namespace XYY.WindowsService.ReshMQ.Works { public interface I17TrackingSub : IBaseConsumer { } public class _17TrackingSub : I17TrackingSub { private readonly ILogger<_17TrackingSub> _logger; public _17TrackingSub(ILogger<_17TrackingSub> logger) { _logger = logger; } public async Task Consume(Data.Model.Standard.Tracking._17._17TrackingWebhook message) { XYY.WinodwsService.ReshMQ.Client.Api api = new XYY.WinodwsService.ReshMQ.Client.Api(new System.Net.Http.HttpClient()); //17转换 var postRequest = message.Copy(); var result = await api.PostAsync(postRequest); if (result.Success) { //写入数据库 var insertDB = await api.PostAsync(result.Data); if (!insertDB.Success) { _logger.LogError("执行失败" + insertDB.Error + "@Request", result.Data); } } else { _logger.LogError("执行失败" + result.Error + "@Request", message); } } } }