[성현모] Web.Operation CPMeta 기능 추가
This commit is contained in:
68
Projects/WebClient/Web.Operation/Services/CPMetaService.cs
Normal file
68
Projects/WebClient/Web.Operation/Services/CPMetaService.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using SystemX.Core.Communication;
|
||||
using SystemX.Core.Services;
|
||||
using Web.Operation.Packet;
|
||||
using WebClient.Library.Config;
|
||||
|
||||
namespace Web.Operation.Services
|
||||
{
|
||||
public class CPMetaService
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
private readonly ConfigService<WebClientConfig>? _configService;
|
||||
|
||||
private string ApiHost = string.Empty;
|
||||
|
||||
public CPMetaService(IServiceProvider serviceProvider, IServiceScopeFactory scopeFactory, ConfigService<WebClientConfig> configService)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
_configService = configService;
|
||||
|
||||
ApiHost = _configService.GetConfig()?.Api.Find(x => x.Id == 1)?.Host;
|
||||
}
|
||||
|
||||
public async Task<Response_GetWbmsMeta> GetWbmsMeta(DateOnly? startDate, DateOnly? endDate, string host)
|
||||
{
|
||||
string requestUrl = $"https://{host}/CPMeta/GetWbmsMeta?";
|
||||
requestUrl += $"startDate={startDate}&";
|
||||
requestUrl += $"endDate={endDate}&";
|
||||
requestUrl += $"ShardID=1";
|
||||
|
||||
Http http = new Http();
|
||||
var res = await http.GetJsonAsync<Response_GetWbmsMeta>($"{requestUrl}");
|
||||
|
||||
LogXnet.WriteLine($"{res.ToJson()}", LogXLabel.HTTP);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<Response_GetWbmsMeta> GetWbmsMetaByProductID(string productId, string host)
|
||||
{
|
||||
string requestUrl = $"https://{host}/CPMeta/GetWbmsMetaByProductID?";
|
||||
requestUrl += $"ProductID={productId}&";
|
||||
requestUrl += $"ShardID=1";
|
||||
|
||||
Http http = new Http();
|
||||
var res = await http.GetJsonAsync<Response_GetWbmsMeta>($"{requestUrl}");
|
||||
|
||||
LogXnet.WriteLine($"{res.ToJson()}", LogXLabel.HTTP);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<Response_GetWbmsMeta> GetWbmsMetaByMacAddress(string macAddress, string host)
|
||||
{
|
||||
string requestUrl = $"https://{host}/CPMeta/GetWbmsMetaByMacAddress?";
|
||||
requestUrl += $"MacAddress={macAddress}&";
|
||||
requestUrl += $"ShardID=1";
|
||||
|
||||
Http http = new Http();
|
||||
var res = await http.GetJsonAsync<Response_GetWbmsMeta>($"{requestUrl}");
|
||||
|
||||
LogXnet.WriteLine($"{res.ToJson()}", LogXLabel.HTTP);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user