YunPian.NetCore 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package YunPian.NetCore --version 1.0.0                
NuGet\Install-Package YunPian.NetCore -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YunPian.NetCore" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YunPian.NetCore --version 1.0.0                
#r "nuget: YunPian.NetCore, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install YunPian.NetCore as a Cake Addin
#addin nuget:?package=YunPian.NetCore&version=1.0.0

// Install YunPian.NetCore as a Cake Tool
#tool nuget:?package=YunPian.NetCore&version=1.0.0                

YunPian.NetCore

Build Status

基于云片网短信服务SDK的.NetCore版本实现

快速开始

appsettings.json

{
    "YunPianApiKey":"你的云片ApiKey",
}
Startup.cs

public void ConfigureServices (IServiceCollection services) {  
    //添加 YunPian 服务
    services.AddYunPianService (options =>  
        options.ApiKey = Configuration["YunPianApiKey"];  
    );
}
AccountController

public readonly ISmsService _smsService;

// 通过构造函数依赖注入的方式获取服务实例
public AccountController (ISmsService smsService) {
    _smsService = smsService;
}

[HttpGet ("send-verifycode/{mobile}")]
public async Task<IActionResult> SendVerifyCode ([FromRoute] string mobile) {
    var message = $"【云片网】您的验证码是123456。如非本人操作,请忽略本短信";
    // 发送单条短信
    var result = await _smsService.SingleSendAsync (message, mobile);
    return result;
}

源码说明

  • 工程源码

  • YunPian 云片源码工程 namespace=YunPian

    • Services 云片服务接口源码
    • Models 模型对象定义
    • Handlers 响应结果处理方法
    • YunPianExtensions IServiceCollection 扩展方法
    • YunPianOptions 客户端配置数据
    • YunPianFields 云片网接口字段

环境要求

Windows

  • 需要.NET 2.0 及以上.
  • 需要 Visual Studio 2010及以上.

Linux/Mac

  • 需要 Mono 3.12 及以上.

参考文档

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on YunPian.NetCore:

Package Downloads
Aiwins.Rocket.Sms.Yunpian

Package Description

ZhileTime.Hope.Sms.Yunpian

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.3 25,908 2/15/2020
3.1.2 522 2/15/2020
3.1.1 531 2/15/2020
1.0.2 2,362 11/17/2018
1.0.1 675 11/15/2018
1.0.0 673 11/15/2018
0.0.1 691 11/14/2018