From da940af0977e16391f219f27110e9aca24e1efb6 Mon Sep 17 00:00:00 2001 From: zhaozhenjing Date: Mon, 13 Oct 2025 17:09:08 +0800 Subject: [PATCH] =?UTF-8?q?[MODIFY]=E5=A2=9E=E5=8A=A0=E5=BE=85=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E7=9F=AD=E4=BF=A1=E9=80=9A=E7=9F=A5=E3=80=81=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E5=AE=8C=E6=88=90=E7=9F=AD=E4=BF=A1=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Impl/Admins/SMSService.cs | 144 +++++++++++------- .../Business/AppBusinessApplicationService.cs | 22 ++- .../Impl/Business/AppManagementService.cs | 26 +++- .../Interfaces/Admins/SMS/ISMSService.cs | 14 +- .../ATS.NonCustodial.Admin.Api/Dockerfile | 2 +- .../configs/appsettings.json | 27 +++- .../AdminServerCollectionExtension.cs | 1 + .../Configurations/AdminUiOptions.cs | 5 +- .../Enums/MessageAlertTypeEnum.cs | 34 +++++ .../Options/SmsConfiguration.cs | 27 ++++ 10 files changed, 232 insertions(+), 70 deletions(-) create mode 100644 src/5.shared/ATS.NonCustodial.Domain.Shared/Enums/MessageAlertTypeEnum.cs create mode 100644 src/5.shared/ATS.NonCustodial.Shared/Configurations/Options/SmsConfiguration.cs diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Admins/SMSService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Admins/SMSService.cs index 069b5e4..06d741e 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Admins/SMSService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Admins/SMSService.cs @@ -1,47 +1,19 @@ using ATS.NonCustodial.Application.Base; -using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.Auth; -using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.Auth.Input; -using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.Auth.Output; using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.SMS; -using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.User; -using ATS.NonCustodial.Application.Contracts.Interfaces.Logs.LoginLog.Input; using ATS.NonCustodial.Domain.Entities.Admins; -using ATS.NonCustodial.Domain.Entities.Business; -using ATS.NonCustodial.Domain.Entities.Business.EarlyWarning; using ATS.NonCustodial.Domain.Shared.Enums; using ATS.NonCustodial.Domain.Shared.OrmRepositories.Basic.EfCore; using ATS.NonCustodial.DynamicApi; using ATS.NonCustodial.DynamicApi.Attributes; -using ATS.NonCustodial.Shared.Captcha.Dto; -using ATS.NonCustodial.Shared.Common.Attributes; -using ATS.NonCustodial.Shared.Common.Auth; -using ATS.NonCustodial.Shared.Common.Constants; -using ATS.NonCustodial.Shared.Common.Dtos; -using ATS.NonCustodial.Shared.Common.Enums; using ATS.NonCustodial.Shared.Common.UnifiedResults; using ATS.NonCustodial.Shared.Configurations.Options; -using ATS.NonCustodial.Shared.Extensions; -using ATS.NonCustodial.Shared.Helpers; -using ATS.NonCustodial.Shared.Helpers.Core.Hash; -using ATS.NonCustodial.Shared.Helpers.Http; -using ATS.NonCustodial.Shared.Tools.Captcha; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using NPOI.SS.Formula.Functions; -using NPOI.Util; -using StackExchange.Profiling; -using System.Diagnostics; -using System.Security.Claims; using TencentCloud.Common; using TencentCloud.Common.Profile; using TencentCloud.Sms.V20210111; using TencentCloud.Sms.V20210111.Models; -using static System.Runtime.InteropServices.JavaScript.JSType; namespace ATS.NonCustodial.Application.Impl.Admins { @@ -92,29 +64,86 @@ namespace ATS.NonCustodial.Application.Impl.Admins }; // 发送短信 - var sendResult = SendSMS(phone, code); + var sendResult = SendSMS(phone, new string[] { code, "5" }, "2524683"); addSMS.result = sendResult; var sms = await _appSMSRepository.InsertAsync(addSMS); return ResultOutput.Ok(true); } - /// - /// 给指定电话发送短信 - /// - /// - /// - /// - /// - public async Task SendMessageSMS(string phone, string msg = "", string type = "CheckCode") + /// + /// 用于触发给指定人员发送短信 + /// + /// 短信通知类型 + /// 监管人姓名 + /// 需要通知的电话 + /// 发送的日期 + /// 触发的消息内容(小于等于6个字) + /// + /// 被监管人姓名 + /// + public async Task SendMessageSMS(MessageAlertTypeEnum alert, string supervisor, string phone,DateTime? dateTime, string msg = "", string ipAddress = "",string supervisedPerson = "") { // 检查是否可以发送(一分钟内只能发送一次) if (!await CanSendCodeAsync(phone)) { return ResultOutput.NotOk("请求过于频繁,请稍后再试"); } + // 创建短信记录 + var addSMS = new AppSMS + { + phone = phone, + sendTime = DateTime.Now, + expiresTime = DateTime.Now.AddMinutes(5), // 5分钟有效期 + ipAddress = ipAddress + }; + string[] sendMessage; + string templateId = string.Empty; + string year , month , day ; + if(dateTime.HasValue) + { + year = dateTime.Value.Year.ToString(); + month = dateTime.Value.Month.ToString(); + day = dateTime.Value.Day.ToString(); + } + else + { + year=DateTime.Now.Year.ToString(); + month = DateTime.Now.Month.ToString(); + day = DateTime.Now.Day.ToString(); + } + if (alert == MessageAlertTypeEnum.Alert) + { + //[预警处理提醒] {1}您好,您于{2}年{3}月{4}日触发的{5}预警需及时处理,请尽快核查并修正相关事项。 + sendMessage = new string[] { supervisedPerson, year, month, day, msg }; + templateId = "2534751"; + addSMS.type = "Alert"; + } + else if (alert == MessageAlertTypeEnum.Approved) + { + //[审批完成通知] {1}您好,您于{2}年{3}月{4}日提交的{5}申请已完成审批,请及时登录系统查看处理结果。 + sendMessage = new string[] { supervisedPerson, year, month, day, msg }; + templateId = "2535130"; + addSMS.type = "Approved"; + } + else if (alert == MessageAlertTypeEnum.ReviewNotification) + { + //[待审批提醒] {1}您好,{2}于{3}年{4}月{5}日提交的{6}申请待您审批,请及时处理。 + sendMessage = new string[] { supervisor, supervisedPerson, year, month, day, msg }; + templateId = "2535127"; + addSMS.type = "ReviewNotification"; + } + else + { + //[监管预警通知] {1}您好,被监管人{2}于{3}年{4}月{5}日已触发{6}预警,请尽快核查处理。 + sendMessage = new string[] { supervisor, supervisedPerson, year, month, day, msg }; + templateId = "2535150"; + addSMS.type = "RegulatoryAlert"; + } // 发送短信 - var sendResult = SendSMS(phone, msg); - + var sendResult = SendSMS(phone, sendMessage, templateId); + addSMS.result = sendResult; + //发送记录入库 + var sms = await _appSMSRepository.InsertAsync(addSMS); return ResultOutput.Ok(true); } @@ -181,15 +210,24 @@ namespace ATS.NonCustodial.Application.Impl.Admins /// /// 发送短信 + ///【审批完成通知】 + //{0}您好,您于{1}提交的{2}申请已完成审批,请及时登录系统查看处理结果。 + //【预警处理提醒】 + //{0}您好,您于{1}触发的{2}预警需及时处理,请尽快核查并修正相关事项。 + //【监管预警通知】 + //{0}您好,被监管人{1}已触发{2}预警,请尽快核查处理。 + //【待审批提醒】 + //{0}您好,{1}于{2}提交的{3}申请待您审批,请及时处理。 /// - /// - /// - /// + /// 手机号 + /// 消息列表 + /// 模版编号 /// - private string SendSMS(string phone, string msg, int expires = 5) + private string SendSMS(string phone, string[] messages, string templateId) { try { + var smsConfig = LazyGetRequiredService(); // 密钥信息从环境变量读取,需要提前在环境变量中设置 TENCENTCLOUD_SECRET_ID 和 TENCENTCLOUD_SECRET_KEY // 使用环境变量方式可以避免密钥硬编码在代码中,提高安全性 // 生产环境建议使用更安全的密钥管理方案,如密钥管理系统(KMS)、容器密钥注入等 @@ -197,8 +235,8 @@ namespace ATS.NonCustodial.Application.Impl.Admins // 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取 Credential cred = new Credential { - SecretId = "AKID52ovuoUzINL7g2A4mGYdHhtsfGdmhQv8", - SecretKey = "96qPlxzta3JL9j5D7oHWXN6f9D9sOiog" + SecretId = smsConfig.SecretId,// "AKID52ovuoUzINL7g2A4mGYdHhtsfGdmhQv8", + SecretKey = smsConfig.SecretKey// "96qPlxzta3JL9j5D7oHWXN6f9D9sOiog" }; // 使用临时密钥示例 /* @@ -212,11 +250,13 @@ namespace ATS.NonCustodial.Application.Impl.Admins ClientProfile clientProfile = new ClientProfile(); // 实例化一个http选项,可选的,没有特殊需求可以跳过 HttpProfile httpProfile = new HttpProfile(); - httpProfile.Endpoint = ("sms.tencentcloudapi.com"); + //"sms.tencentcloudapi.com" + httpProfile.Endpoint = (smsConfig.Endpoint); clientProfile.HttpProfile = httpProfile; // 实例化要请求产品的client对象,clientProfile是可选的 - SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile); + //Region = "ap-guangzhou" + SmsClient client = new SmsClient(cred, smsConfig.Region , clientProfile); // 实例化一个请求对象,每个接口都会对应一个request对象 SendSmsRequest req = new SendSmsRequest(); @@ -228,22 +268,22 @@ namespace ATS.NonCustodial.Application.Impl.Admins * 腾讯云短信小助手: https://cloud.tencent.com/document/product/382/3773#.E6.8A.80.E6.9C.AF.E4.BA.A4.E6.B5.81 */ /* 短信应用ID: 短信SdkAppId在 [短信控制台] 添加应用后生成的实际SdkAppId,示例如1400006666 */ // 应用 ID 可前往 [短信控制台](https://console.cloud.tencent.com/smsv2/app-manage) 查看 - req.SmsSdkAppId = "1401039888"; + req.SmsSdkAppId = smsConfig.SmsSdkAppId;// "1401039888"; /* 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名 */ // 签名信息可前往 [国内短信](https://console.cloud.tencent.com/smsv2/csms-sign) 或 [国际/港澳台短信](https://console.cloud.tencent.com/smsv2/isms-sign) 的签名管理查看 - req.SignName = "成都阿凯思信息技术"; + req.SignName = smsConfig.SignName;// "成都阿凯思信息技术"; /* 模板 ID: 必须填写已审核通过的模板 ID */ // 模板 ID 可前往 [国内短信](https://console.cloud.tencent.com/smsv2/csms-template) 或 [国际/港澳台短信](https://console.cloud.tencent.com/smsv2/isms-template) 的正文模板管理查看 - req.TemplateId = "2524683"; + req.TemplateId = templateId;// "2524683"; /* 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空 */ - req.TemplateParamSet = new string[] { msg, expires.ToString() }; + req.TemplateParamSet = messages;// new string[] { msg, expires.ToString() }; /* 下发手机号码,采用 E.164 标准,+[国家或地区码][手机号] * 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号*/ - req.PhoneNumberSet = new string[] { "+86" + phone }; + req.PhoneNumberSet = new string[] { smsConfig.PhoneNumberSet + phone }; /* 用户的 session 内容(无需要可忽略): 可以携带用户侧 ID 等上下文信息,server 会原样返回 */ req.SessionContext = ""; diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppBusinessApplicationService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppBusinessApplicationService.cs index a3f441d..a9cd1ff 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppBusinessApplicationService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppBusinessApplicationService.cs @@ -1,15 +1,19 @@ using ATS.NonCustodial.Application.Base; using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.AppDictionaries; +using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.SMS; using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.User; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusinessApplications; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusinessApplications.Input; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusinessApplications.Output; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppCaseManagements.AppCaseManagement; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.Apps.Output; +using ATS.NonCustodial.Application.Impl.Admins; using ATS.NonCustodial.Application.Impl.Business.IM; +using ATS.NonCustodial.Domain.Entities.Admins; using ATS.NonCustodial.Domain.Entities.Business; using ATS.NonCustodial.Domain.Entities.Business.CaseManagements; using ATS.NonCustodial.Domain.Shared.AggRootEntities.Dtos; +using ATS.NonCustodial.Domain.Shared.Enums; using ATS.NonCustodial.Domain.Shared.OrmRepositories.Basic.EfCore; using ATS.NonCustodial.DynamicApi; using ATS.NonCustodial.DynamicApi.Attributes; @@ -42,7 +46,8 @@ namespace ATS.NonCustodial.Application.Impl.Business private readonly IEfRepository _appBusinessApplicationViewStatisticsRepository; private readonly IAppCaseManagementService _appCaseManagementService; private readonly IHubContext _hubContext; - + private readonly IEfRepository _appUserRepository; + private readonly ISMSService _smsService; /// /// /// @@ -65,7 +70,8 @@ namespace ATS.NonCustodial.Application.Impl.Business IEfRepository appCaseSupervisorRepository, IEfRepository appCaseSupervisedPersonRepository, IUserService userService, - IEfRepository appSupervisedPersonRealTimeLocationRepository) + IEfRepository appUserRepository, + IEfRepository appSupervisedPersonRealTimeLocationRepository, ISMSService smsService) : base( appCaseManagementRepository, appCaseSupervisorRepository, @@ -78,6 +84,8 @@ namespace ATS.NonCustodial.Application.Impl.Business _appBusinessApplicationViewStatisticsRepository = appBusinessApplicationViewStatisticsRepository; _appCaseManagementService = appCaseManagementService; _hubContext = hubContext; + _appUserRepository = appUserRepository; + _smsService = smsService; } #endregion Identity @@ -290,6 +298,16 @@ namespace ATS.NonCustodial.Application.Impl.Business await _appBusinessApplicationRepository.UpdateAsync(dataList); + foreach (var item in dataList) + { + var user = await _appUserRepository.AsQueryable(false, true).Where(w => w.Id == item.SupervisedPersonId).ToListAsync(); + //发短信给被监管人,提醒查看处理结果 + //[审批完成通知] {1}您好,您于{2}年{3}月{4}日提交的{5}申请已完成审批,请及时登录系统查看处理结果。 + await _smsService.SendMessageSMS(MessageAlertTypeEnum.Approved, "", user.FirstOrDefault().Phone, item.CreatedTime, item.ApplicationTypeName, "", item.SupervisedPersonName); + } + + + //返回结果 return ResultOutput.Ok(); } diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppManagementService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppManagementService.cs index 7a2e234..02e2d7d 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppManagementService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppManagementService.cs @@ -25,6 +25,7 @@ using ATS.NonCustodial.Application.Contracts.Interfaces.Business.PunchRecordServ using ATS.NonCustodial.Application.Contracts.Interfaces.Business.PunchRecordServices.Input; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.PunchRecordServices.Output; using ATS.NonCustodial.Application.Impl.Admins; +using ATS.NonCustodial.Application.Impl.Business.CaseManagements; using ATS.NonCustodial.Application.Impl.Business.IM; using ATS.NonCustodial.Domain.Entities.Admins; using ATS.NonCustodial.Domain.Entities.Business; @@ -842,8 +843,21 @@ namespace ATS.NonCustodial.Application.Impl.Business [HttpPost] public async Task AddAppBusinessAsync(AppBusinessApplicationCreateOrModifyInput input) { - //测试发短信流程 - // await _smsService.SendMessageSMS("13461916012","您有一条申请待处理,请及时处理"); + //根据案件找监管人,找到多个,均发送消息提醒 + var currentUserCase = await base.GetCurrentSupervisePersonProcessingCase(User.Id); + + var supervisorList = await _appSupervisorRepository + .AsQueryable(false, true) + .Where(w => w.CaseId == currentUserCase.CaseId) + .ToListAsync(); + var applicationType = await base.GetDictionariesOutput("application_type", "df"); + + foreach (var supervisor in supervisorList) + { + var user = await _appUserRepository.AsQueryable(false, true).Where(w => w.Id == supervisor.SupervisorId).ToListAsync(); + //发短信给监管人,提醒处理审批 + await _smsService.SendMessageSMS(MessageAlertTypeEnum.ReviewNotification, user.FirstOrDefault().UserName, user.FirstOrDefault().Phone, DateTime.Now, applicationType.Name, "", currentUserCase.SupervisedPersonName); + } return await _appBusinessApplicationService.CreateOrModify(input); } @@ -993,9 +1007,11 @@ namespace ATS.NonCustodial.Application.Impl.Business [AllowAnonymous] public async Task SubmitBindingApplication(SubmitBindingApplicationInput input) { - // bool checkCode = await _smsService.CheckCodeAsync(input.phone, input.checkCode, "CheckCode"); - // if (!checkCode) return ResultOutput.NotOk("无效验证码"); - + if (!string.IsNullOrEmpty(input.phone)) + { + bool checkCode = await _smsService.CheckCodeAsync(input.phone, input.checkCode, "CheckCode"); + if (!checkCode) return ResultOutput.NotOk("无效验证码"); + } //[1]校验当前账户是否是第一次绑定 //if (!await _appSupervisedPersonRepository.AnyAsync(w => w.IdCard == input.IdCard && !w.IsBound)) return ResultOutput.NotOk("当前身份没有被监管,请检查身份证是否输入正确"); if (!await _appSupervisedPersonRepository.AnyAsync(w => w.IdCard == input.IdCard)) return ResultOutput.NotOk("当前身份没有被监管,请检查身份证是否输入正确"); diff --git a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/SMS/ISMSService.cs b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/SMS/ISMSService.cs index 7b3e39f..515def1 100644 --- a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/SMS/ISMSService.cs +++ b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/SMS/ISMSService.cs @@ -25,13 +25,17 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Admins.SMS /// Task CheckCodeAsync(string phoneNumber, string code, string type = "default"); /// - /// 给指定电话发送短信 + /// 用于触发给指定人员发送短信 /// - /// - /// - /// + /// 短信通知类型 + /// 监管人姓名 + /// 需要通知的电话 + /// 发送的日期 + /// 触发的消息内容(小于等于6个字) + /// + /// 被监管人姓名 /// - Task SendMessageSMS(string phone, string msg = "", string type = "CheckCode"); + Task SendMessageSMS(MessageAlertTypeEnum alert, string supervisor, string phone, DateTime? dateTime, string msg = "", string ipAddress = "", string supervisedPerson = ""); /// /// 发送前校验 diff --git a/src/4.apps/ATS.NonCustodial.Admin.Api/Dockerfile b/src/4.apps/ATS.NonCustodial.Admin.Api/Dockerfile index e3a7170..6b0d974 100644 --- a/src/4.apps/ATS.NonCustodial.Admin.Api/Dockerfile +++ b/src/4.apps/ATS.NonCustodial.Admin.Api/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build ENV TZ Asia/Shanghai diff --git a/src/4.apps/ATS.NonCustodial.Admin.Api/configs/appsettings.json b/src/4.apps/ATS.NonCustodial.Admin.Api/configs/appsettings.json index 4fd2dfe..8f159a3 100644 --- a/src/4.apps/ATS.NonCustodial.Admin.Api/configs/appsettings.json +++ b/src/4.apps/ATS.NonCustodial.Admin.Api/configs/appsettings.json @@ -22,8 +22,8 @@ /* 数据库连接 Server=连接数据库的ip database=数据库名 pwd=数据库密码 port=数据库端口*/ //"AdminAuditLogDbConnection": "Server=192.168.0.78;database=fjy1;uid=root;pwd=jiacai;pooling=true;CharSet=utf8;port=3306;SslMode=none;Allow User Variables=True;AllowPublicKeyRetrieval=True;", //"AdminDbConnection": "Server=192.168.0.78;database=fjy1;uid=root;pwd=jiacai;pooling=true;CharSet=utf8;port=3306;SslMode=none;Allow User Variables=True;AllowPublicKeyRetrieval=True;", - "AdminAuditLogDbConnection": "Server=localhost;database=fjy_sl;uid=root;pwd=sa@admin;pooling=true;CharSet=utf8;port=3306;SslMode=none;Allow User Variables=True;AllowPublicKeyRetrieval=True;", - "AdminDbConnection": "Server=localhost;database=fjy_sl;uid=root;pwd=sa@admin;pooling=true;CharSet=utf8;port=3306;SslMode=none;Allow User Variables=True;AllowPublicKeyRetrieval=True;" + "AdminAuditLogDbConnection": "Server=localhost;database=fsl_cs;uid=root;pwd=sa@admin;pooling=true;CharSet=utf8;port=3306;SslMode=none;Allow User Variables=True;AllowPublicKeyRetrieval=True;", + "AdminDbConnection": "Server=localhost;database=fsl_cs;uid=root;pwd=sa@admin;pooling=true;CharSet=utf8;port=3306;SslMode=none;Allow User Variables=True;AllowPublicKeyRetrieval=True;" //"AdminAuditLogDbConnection": "Server=soft.scakskj.com;database=fjy;uid=root;pwd=sa@123456;pooling=true;CharSet=utf8;port=5324;SslMode=none;Allow User Variables=True;AllowPublicKeyRetrieval=True;", // "AdminDbConnection": "Server=soft.scakskj.com;database=fjy;uid=root;pwd=sa@123456;pooling=true;CharSet=utf8;port=5324;SslMode=none;Allow User Variables=True;AllowPublicKeyRetrieval=True;" @@ -201,12 +201,12 @@ //Swagger文档 "SwaggerConfiguration": { //启用 - "Enable": true, + "Enable": false, //地址 /* Url:["http://localhost:api端口号"] */ "Url": "http://localhost:8006", "Footer": "\"Copyright 2022-ATS.NonCustodial.Admin\"", - "EnableMiniProfiler": true + "EnableMiniProfiler": false }, //日志配置 @@ -254,5 +254,24 @@ "AppKey": "SeXpmo90df9INDBVejixG", "MasterSecret": "0jrX4Yc54V6ehBCRhtSQQ3", "AppSecret": "uCqaQ6Ts8ZAiQhsMm3Yfx2" + }, + //短信平台推送 + "SmsConfiguration": { + // 请参见:https://cloud.tencent.com/document/product/1278/85305 + // 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取 + "SecretId": "AKID52ovuoUzINL7g2A4mGYdHhtsfGdmhQv8", + "SecretKey": "96qPlxzta3JL9j5D7oHWXN6f9D9sOiog", + //默认腾讯云 + "Endpoint": "sms.tencentcloudapi.com", + //Region name, such as "ap-guangzhou" + "Region": "ap-guangzhou", + //短信应用ID: 短信SdkAppId在 [短信控制台] 添加应用后生成的实际SdkAppId,示例如1400006666 + "SmsSdkAppId": "1401039888", + //短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名 + "SignName": "成都阿凯思信息技术", + // 下发手机号码,采用 E.164 标准,+[国家或地区码][手机号] + //示例如:+8613711112222, 其中前面有一个+号 , + //86为国家码,13711112222为手机号,最多不要超过200个手机号 + "PhoneNumberSet": "+86" } } \ No newline at end of file diff --git a/src/5.shared/ATS.NonCustodial.AdminUi/Configurations/AdminServerCollectionExtension.cs b/src/5.shared/ATS.NonCustodial.AdminUi/Configurations/AdminServerCollectionExtension.cs index 9772712..232b3d1 100644 --- a/src/5.shared/ATS.NonCustodial.AdminUi/Configurations/AdminServerCollectionExtension.cs +++ b/src/5.shared/ATS.NonCustodial.AdminUi/Configurations/AdminServerCollectionExtension.cs @@ -94,6 +94,7 @@ namespace ATS.NonCustodial.AdminUi.Configurations //个推 services.AddSingleton(adminUiOptions.TweetsConfigConfiguration); + services.AddSingleton(adminUiOptions.SmsConfiguration); #region 身份认证授权 diff --git a/src/5.shared/ATS.NonCustodial.AdminUi/Configurations/AdminUiOptions.cs b/src/5.shared/ATS.NonCustodial.AdminUi/Configurations/AdminUiOptions.cs index e6350c1..fb4ee44 100644 --- a/src/5.shared/ATS.NonCustodial.AdminUi/Configurations/AdminUiOptions.cs +++ b/src/5.shared/ATS.NonCustodial.AdminUi/Configurations/AdminUiOptions.cs @@ -60,7 +60,7 @@ namespace ATS.NonCustodial.AdminUi.Configurations /// TweetsConfigConfiguration /// public TweetsConfigConfiguration TweetsConfigConfiguration { get; set; } = new TweetsConfigConfiguration(); - + public SmsConfiguration SmsConfiguration { get; set; } = new SmsConfiguration(); /// /// TenantConfiguration /// @@ -143,6 +143,7 @@ namespace ATS.NonCustodial.AdminUi.Configurations configuration.GetSection(nameof(RabbitMqOptions)).Bind(RabbitMqOptions); configuration.GetSection(nameof(SdQuartzCronConfiguration)).Bind(SdQuartzCronConfiguration); configuration.GetSection(nameof(TweetsConfigConfiguration)).Bind(TweetsConfigConfiguration); + configuration.GetSection(nameof(SmsConfiguration)).Bind(SmsConfiguration); //注册options services.AddSingleton(VarifyCodeConfiguration); @@ -150,6 +151,8 @@ namespace ATS.NonCustodial.AdminUi.Configurations services.AddSingleton(UploadConfigConfiguration); //services.AddSingleton(TweetsConfigConfiguration); services.AddSingleton(AuditLoggingConfiguration); + services.AddSingleton(SmsConfiguration); + services.AddSingleton(ConnectionStringsConfiguration); } } diff --git a/src/5.shared/ATS.NonCustodial.Domain.Shared/Enums/MessageAlertTypeEnum.cs b/src/5.shared/ATS.NonCustodial.Domain.Shared/Enums/MessageAlertTypeEnum.cs new file mode 100644 index 0000000..fe68456 --- /dev/null +++ b/src/5.shared/ATS.NonCustodial.Domain.Shared/Enums/MessageAlertTypeEnum.cs @@ -0,0 +1,34 @@ +using System.ComponentModel; + +namespace ATS.NonCustodial.Domain.Shared.Enums +{ + /// + /// 短信通知类型 + /// + public enum MessageAlertTypeEnum + { + /// + /// 审批完成通知 + /// + [Description("审批完成")] + Approved = 0, + + /// + /// 监管预警通知(用于通知监管人) + /// + [Description("监管预警")] + RegulatoryAlert = 1, + + /// + /// 审批提醒通知 + /// + [Description("审批提醒")] + ReviewNotification = 2, + /// + /// 预警处理通知(用于通知被监管人) + /// + [Description("预警处理")] + Alert = 3 + } + +} diff --git a/src/5.shared/ATS.NonCustodial.Shared/Configurations/Options/SmsConfiguration.cs b/src/5.shared/ATS.NonCustodial.Shared/Configurations/Options/SmsConfiguration.cs new file mode 100644 index 0000000..3a3b08d --- /dev/null +++ b/src/5.shared/ATS.NonCustodial.Shared/Configurations/Options/SmsConfiguration.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ATS.NonCustodial.Shared.Configurations.Options +{ + public class SmsConfiguration + { + public string SecretId { get; set; } + + public string SecretKey { get; set; } + + public string Endpoint { get; set; } + + public string Region { get; set; } + + public string SmsSdkAppId { get; set; } + /// + /// 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名 + /// + public string SignName { get; set; } + + public string PhoneNumberSet { get; set; } + } +}