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.

41 lines
1.3 KiB
C#

4 months ago
using DS.Module.Core;
using DS.Module.Core.Helpers;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft;
using Newtonsoft.Json;
using DS.Module.Core.Extensions;
namespace DS.Module.EmailModule
{
public class EmailService : IEmailService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly string emailServiceUrl;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="serviceProvider"></param>
public EmailService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
}
public async Task<DataResult> SendEmailByDjy(DjyEmailSendReq req)
{
var url = db.Queryable<object>().AS("sys_config").Where("Code=@Code", new { Code = "" }).Select("Value").First()?.ToString();
if (url.IsNull())
return await Task.FromResult(DataResult.Failed("未配置"));
var res =await RequestHelper.PostAsyncNoHeaders(url, JsonConvert.SerializeObject(req));
throw new NotImplementedException();
}
}
}