diff --git a/ds-wms-service/DS.Module.Core/Helpers/RequestHelper.cs b/ds-wms-service/DS.Module.Core/Helpers/RequestHelper.cs
index 5acbb30a..e9a8512e 100644
--- a/ds-wms-service/DS.Module.Core/Helpers/RequestHelper.cs
+++ b/ds-wms-service/DS.Module.Core/Helpers/RequestHelper.cs
@@ -1,5 +1,9 @@
using System.Net;
+using System.Net.Http.Headers;
+using System.Net.Http;
using System.Text;
+using DS.Module.Core.Extensions;
+using System.Security.Policy;
namespace DS.Module.Core.Helpers;
@@ -7,7 +11,7 @@ namespace DS.Module.Core.Helpers;
/// 请求帮助类
///
public class RequestHelper
-{
+{
public static string Post(string postData, string Url,int timeout = 60000)
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Url);
@@ -72,7 +76,45 @@ public class RequestHelper
return result;
}
+ ///
+ /// http post请求
+ ///
+ /// 地址
+ /// 入参
+ ///
+ /// 头信息
+ ///
+ ///
+ /// , string token ="", Dictionary headers = null
+ public static async Task PostAsyncNoHeaders(string url, string parameter)
+ {
+ using (var client = new HttpClient())
+ {
+ //var data = new StringContent("param1=value1¶m2=value2", Encoding.UTF8, "application/x-www-form-urlencoded");
+ var data = new StringContent(parameter, Encoding.UTF8, "application/x-www-form-urlencoded");
+ //_logger.LogWarning($"data:{data.ToJsonString()};parameter:{parameter}");
+ // 添加header参数
+ //client.DefaultRequestHeaders.Add("Authorization", "Bearer your_token_here");
+ //foreach (var header in headers)
+ //{
+ // client.DefaultRequestHeaders.Add(header.Key, header.Value);
+ //}
+ //_logger.LogWarning($"header:{client.DefaultRequestHeaders.ToJsonString()}");
+
+ try
+ {
+ var response = await client.PostAsync(url, data);
+ response.EnsureSuccessStatusCode();
+ var responseBody = await response.Content.ReadAsStringAsync();
+ return responseBody;
+ }
+ catch (HttpRequestException e)
+ {
+ throw new Exception(e.Message);
+ }
+ }
+ }
///
/// http异步请求
///
diff --git a/ds-wms-service/DS.Module.EmailModule/DS.Module.EmailModule.csproj b/ds-wms-service/DS.Module.EmailModule/DS.Module.EmailModule.csproj
new file mode 100644
index 00000000..b3971ede
--- /dev/null
+++ b/ds-wms-service/DS.Module.EmailModule/DS.Module.EmailModule.csproj
@@ -0,0 +1,14 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
diff --git a/ds-wms-service/DS.Module.EmailModule/DjyEmailSendReq.cs b/ds-wms-service/DS.Module.EmailModule/DjyEmailSendReq.cs
new file mode 100644
index 00000000..fe8e3cd7
--- /dev/null
+++ b/ds-wms-service/DS.Module.EmailModule/DjyEmailSendReq.cs
@@ -0,0 +1,124 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.Module.EmailModule
+{
+ ///
+ /// 大简云邮箱接口请求
+ ///
+ public class DjyEmailSendReq
+ {
+ ///
+ /// 接收邮箱
+ ///
+ public string SendTo { get; set; }
+ ///
+ /// 抄送
+ ///
+ public string CCTo { get; set; }
+ ///
+ /// 邮件标题
+ ///
+ public string Title { get; set; }
+ ///
+ /// 邮件正文
+ ///
+ public string Body { get; set; }
+ ///
+ /// 邮件显示的发送人 不设置则显示发送的邮箱
+ ///
+ public string ShowName { get; set; }
+ ///
+ /// 发送邮箱配置(发件邮箱)
+ ///
+ public string SmtpConfig { get; set; }
+ ///
+ /// 附件列表
+ ///
+ public List Attaches { get; set; }
+ ///
+ /// 自定义发送的邮箱账号 发件邮箱的账号,使用自定义邮箱发送邮件时,必须指定
+ ///
+ public string Account { get; set; }
+ ///
+ /// 自定义发送的邮箱密码 发件邮箱的密码,使用自定义邮箱发送邮件时,必须指定
+ ///
+ public string Password { get; set; }
+ ///
+ /// 自定义发送的邮箱服务器 发件邮箱的服务器地址,使用自定义邮箱发送邮件时,必须指定
+ ///
+ public string Server { get; set; }
+ ///
+ /// 自定义发送的发件端口 发件邮箱的端口,使用自定义邮箱发送邮件时,必须指定
+ ///
+ public int Port { get; set; }
+ ///
+ /// 自定义发送是否使用ssl 发件邮箱的是否使用SSL,使用自定义邮箱发送邮件时,必须指定
+ ///
+ public bool UseSSL { get; set; }
+ }
+
+ ///
+ /// 附件信息
+ ///
+ public class Attaches {
+
+ ///
+ /// 附件名称 在邮件中显示的附件名称
+ ///
+ public string AttachName { get; set; } = string.Empty;
+
+ ///
+ /// 附件内容 以base64编码的字符串
+ ///
+ public string AttachContent { get; set; } = string.Empty;
+ }
+ ///
+ /// SmtpConfig选项枚举
+ ///
+ public enum SmtpConfigEnum {
+
+ ///
+ /// dongshengcangdan@h8j.top
+ ///
+ CANGDAN,
+ ///
+ /// inv@mail.myshipping.net
+ ///
+ INVOICE,
+ ///
+ /// noreplay@mail.myshipping.net
+ ///
+ NOREPLAY,
+ ///
+ /// service@mail.myshipping.net
+ ///
+ SERVICE,
+ ///
+ /// spot@mail.myshipping.net
+ ///
+ SPOT,
+ }
+
+ ///
+ /// 大简云邮箱接口返回
+ ///
+ public class DjyEmailSendRes {
+
+ ///
+ /// 是否成功
+ ///
+ public bool Success { get; set; }
+ ///
+ /// 说明文本
+ ///
+ public string Message { get; set; }
+ ///
+ /// 代号
+ ///
+ public string Code { get; set; }
+ }
+}
diff --git a/ds-wms-service/DS.Module.EmailModule/EmailModuleInstall.cs b/ds-wms-service/DS.Module.EmailModule/EmailModuleInstall.cs
new file mode 100644
index 00000000..f185170c
--- /dev/null
+++ b/ds-wms-service/DS.Module.EmailModule/EmailModuleInstall.cs
@@ -0,0 +1,27 @@
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.Module.EmailModule
+{
+ ///
+ /// 注入Email服务
+ ///
+ public static class EmailModuleInstall
+ {
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void AddEmailModuleInstall(this IServiceCollection services)
+ {
+ if (services == null) throw new ArgumentNullException(nameof(services));
+
+ services.AddScoped();
+ }
+ }
+}
diff --git a/ds-wms-service/DS.Module.EmailModule/EmailService.cs b/ds-wms-service/DS.Module.EmailModule/EmailService.cs
new file mode 100644
index 00000000..4023992e
--- /dev/null
+++ b/ds-wms-service/DS.Module.EmailModule/EmailService.cs
@@ -0,0 +1,40 @@
+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;
+ ///
+ /// 构造函数
+ ///
+ ///
+ public EmailService(IServiceProvider serviceProvider)
+ {
+ _serviceProvider = serviceProvider;
+ db = _serviceProvider.GetRequiredService();
+ }
+ public async Task SendEmailByDjy(DjyEmailSendReq req)
+ {
+ var url = db.Queryable