mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-27 04:41:15 +08:00
add ISteamService.SetCurrentUser
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
namespace System.Application.Models.AlibabaCloud
|
||||
{
|
||||
public class SmsOptions
|
||||
public class SmsOptions : IExplicitHasValue
|
||||
{
|
||||
/// <summary>
|
||||
/// 平台分配的appkey
|
||||
@@ -28,7 +28,10 @@
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(AccessKeyId) &&
|
||||
!string.IsNullOrWhiteSpace(AccessKeySecret) &&
|
||||
!string.IsNullOrWhiteSpace(SignName);
|
||||
!string.IsNullOrWhiteSpace(SignName) &&
|
||||
Templates.Any_Nullable();
|
||||
}
|
||||
|
||||
bool IExplicitHasValue.ExplicitHasValue() => IsValid();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace System.Application.Models.NetEaseCloud
|
||||
{
|
||||
public class SmsOptions
|
||||
public class SmsOptions : IExplicitHasValue
|
||||
{
|
||||
/// <summary>
|
||||
/// 开发者平台分配的appkey
|
||||
@@ -15,12 +15,15 @@
|
||||
/// <summary>
|
||||
/// 开发者平台分配的模板标志
|
||||
/// </summary>
|
||||
public SmsOptionsTemplateId<int?>[]? Templates { get; set; }
|
||||
public SmsOptionsTemplateId<int>[]? Templates { get; set; }
|
||||
|
||||
public bool IsValid()
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(AppKey) &&
|
||||
!string.IsNullOrWhiteSpace(AppSecret);
|
||||
!string.IsNullOrWhiteSpace(AppSecret) &&
|
||||
Templates.Any_Nullable();
|
||||
}
|
||||
|
||||
bool IExplicitHasValue.ExplicitHasValue() => IsValid();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
namespace System.Application.Models._21VianetBlueCloud
|
||||
{
|
||||
public class SmsOptions : IExplicitHasValue
|
||||
{
|
||||
/// <summary>
|
||||
/// ccs account name
|
||||
/// </summary>
|
||||
public string? Account { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密钥名称
|
||||
/// </summary>
|
||||
public string? KeyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密钥
|
||||
/// </summary>
|
||||
public string? KeyValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 下发扩展码,两位纯数字
|
||||
/// </summary>
|
||||
public string ExtendCode { get; set; } = "08";
|
||||
|
||||
/// <summary>
|
||||
/// 开发者平台分配的模板标志
|
||||
/// </summary>
|
||||
public SmsOptionsTemplateId<string>[]? Templates { get; set; }
|
||||
|
||||
public bool IsValid()
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(Account) &&
|
||||
!string.IsNullOrWhiteSpace(ExtendCode) &&
|
||||
!string.IsNullOrWhiteSpace(KeyName) &&
|
||||
!string.IsNullOrWhiteSpace(KeyValue) &&
|
||||
Templates.Any_Nullable();
|
||||
}
|
||||
|
||||
bool IExplicitHasValue.ExplicitHasValue() => IsValid();
|
||||
}
|
||||
}
|
||||
@@ -29,9 +29,9 @@ namespace System.Application.Services
|
||||
/// <summary>
|
||||
/// 发送短信验证码
|
||||
/// </summary>
|
||||
/// <param name="number">收信人手机号码。</param>
|
||||
/// <param name="message">发送的短信内容。</param>
|
||||
/// <param name="type">发送短信用途。</param>
|
||||
/// <param name="number">收信人手机号码</param>
|
||||
/// <param name="message">发送的短信内容</param>
|
||||
/// <param name="type">发送短信用途</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<ISendSmsResult> SendSmsAsync(string number, string message, int type, CancellationToken cancellationToken = default);
|
||||
@@ -39,8 +39,9 @@ namespace System.Application.Services
|
||||
/// <summary>
|
||||
/// 校验短信验证码,某些平台要求校验短信也要调用他提供的接口
|
||||
/// </summary>
|
||||
/// <param name="number">收信人手机号码。</param>
|
||||
/// <param name="message">短信验证码内容。</param>
|
||||
/// <param name="number">收信人手机号码</param>
|
||||
/// <param name="message">短信验证码内容</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<ICheckSmsResult> CheckSmsAsync(string number, string message, CancellationToken cancellationToken = default);
|
||||
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Application.Models;
|
||||
using System.Application.Models.AlibabaCloud;
|
||||
using System.Application.Services.Implementation;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
@@ -13,7 +12,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Application.Services.AlibabaCloud
|
||||
namespace System.Application.Services.Implementation.AlibabaCloud
|
||||
{
|
||||
/// <summary>
|
||||
/// 短信服务提供商 - 阿里云
|
||||
+1
-2
@@ -3,7 +3,6 @@ using Newtonsoft.Json;
|
||||
using System.Application.Models;
|
||||
using System.Application.Models.Abstractions;
|
||||
using System.Application.Models.NetEaseCloud;
|
||||
using System.Application.Services.Implementation;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -36,7 +35,7 @@ http 响应:json
|
||||
500 服务器内部错误
|
||||
*/
|
||||
|
||||
namespace System.Application.Services.NetEaseCloud
|
||||
namespace System.Application.Services.Implementation.NetEaseCloud
|
||||
{
|
||||
/// <summary>
|
||||
/// 短信服务(网易云实现) 需要实现校验接口
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System.Application.Models;
|
||||
using System.Application.Models._21VianetBlueCloud;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Application.Services.Implementation._21VianetBlueCloud
|
||||
{
|
||||
/// <summary>
|
||||
/// 短信服务提供商 - 世纪互联蓝云
|
||||
/// </summary>
|
||||
public class SmsSenderProvider : AbstractSmsSender, ISmsSender
|
||||
{
|
||||
public const string Name = nameof(_21VianetBlueCloud);
|
||||
|
||||
public override string Channel => Name;
|
||||
|
||||
public override bool SupportCheck => false;
|
||||
|
||||
readonly HttpClient httpClient;
|
||||
readonly SmsOptions options;
|
||||
readonly ILogger logger;
|
||||
readonly JsonSerializer jsonSerializer = new();
|
||||
|
||||
public SmsSenderProvider(ILogger<SmsSenderProvider> logger, SmsOptions options, HttpClient httpClient)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.options = options;
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
|
||||
public override Task<ISendSmsResult> SendSmsAsync(string number, string message, int type, CancellationToken cancellationToken)
|
||||
{
|
||||
var dictionary = new Dictionary<string, object?> {
|
||||
{ "phoneNumber", new[] { number } },
|
||||
{ "extend", options.ExtendCode },
|
||||
{ "messageBody", options.ExtendCode },
|
||||
};
|
||||
|
||||
// 明天再写
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override Task<ICheckSmsResult> CheckSmsAsync(string __, string ___, CancellationToken _)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
class RequestData
|
||||
{
|
||||
/// <summary>
|
||||
/// 接收手机号
|
||||
/// </summary>
|
||||
[JsonProperty("phoneNumber")]
|
||||
public string[]? PhoneNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 下发扩展码,两位纯数字
|
||||
/// </summary>
|
||||
[JsonProperty("extend")]
|
||||
public string? ExtendCode { get; set; }
|
||||
|
||||
[JsonProperty("messageBody")]
|
||||
public MessageBody? MessageBody { get; set; }
|
||||
}
|
||||
|
||||
class MessageBody
|
||||
{
|
||||
/// <summary>
|
||||
/// 短信模板名称
|
||||
/// </summary>
|
||||
[JsonProperty("templateName")]
|
||||
public string? TemplateName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 短信模板参数,和模板中变量一一对应,没有变量则不需要
|
||||
/// </summary>
|
||||
[JsonProperty("templateParam")]
|
||||
public Dictionary<string, string>? TemplateParam { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
using System.Application.Models;
|
||||
using System.Application.Services.Implementation;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Application.Services._21VianetBlueCloud
|
||||
{
|
||||
/// <summary>
|
||||
/// 短信服务提供商 - 世纪互联蓝云
|
||||
/// </summary>
|
||||
public class SmsSenderProvider : AbstractSmsSender, ISmsSender
|
||||
{
|
||||
public const string Name = nameof(_21VianetBlueCloud);
|
||||
|
||||
public override string Channel => Name;
|
||||
|
||||
public override bool SupportCheck => throw new NotImplementedException();
|
||||
|
||||
public override Task<ISendSmsResult> SendSmsAsync(string number, string message, int type, CancellationToken cancellationToken)
|
||||
{
|
||||
// 明天再写
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override Task<ICheckSmsResult> CheckSmsAsync(string number, string message, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user