Master.CanYinWu.Utility/AliYunNoteHelper.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using AlibabaCloud.OpenApiClient.Models;
using AlibabaCloud.SDK.Dysmsapi20170525;
using AlibabaCloud.SDK.Dysmsapi20170525.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Master.CanYinWu.Utility
{
/// <summary>
/// 阿里云发短息
/// </summary>
public class AliYunNoteHelper
{
/**
* 使用AK&SK初始化账号Client
* @param accessKeyId
* @param accessKeySecret
* @return Client
* @throws Exception
*/
public static Client CreateClient(string accessKeyId, string accessKeySecret)
{
Config config = new Config
{
// 您的 AccessKey ID
AccessKeyId = accessKeyId,
// 您的 AccessKey Secret
AccessKeySecret = accessKeySecret,
};
// 访问的域名
config.Endpoint = "dysmsapi.aliyuncs.com";
return new Client(config);
}
/// <summary>
/// 发送短信
/// </summary>
/// <param name="phone"></param>
/// <returns></returns>
public static bool SendNote(string phone, string name)
{
Client client = CreateClient("test", "test");
SendSmsRequest sendSmsRequest = new SendSmsRequest
{
SignName = "test",
TemplateCode = "test",
PhoneNumbers = phone,
TemplateParam = "{\"name\":\"" + name + "\"}",
};
AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();
SendSmsResponse resp = client.SendSms(sendSmsRequest); //SendSmsWithOptions(sendSmsRequest, runtime);
if (resp.Body.Code == "OK")
{
return true;
}
else
后面还有 7 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
