smsapi.zhutong 1.0.0

dotnet add package smsapi.zhutong --version 1.0.0                
NuGet\Install-Package smsapi.zhutong -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="smsapi.zhutong" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add smsapi.zhutong --version 1.0.0                
#r "nuget: smsapi.zhutong, 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 smsapi.zhutong as a Cake Addin
#addin nuget:?package=smsapi.zhutong&version=1.0.0

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

上海助通短信对接

  1. 助通官网
  2. 类库框架选择的是.NetStandard2.1,理论上支持.Net5、6、7、8、9

仓库地址

github

https://github.com/chusj/SendMessage

gitee(国内)

https://gitee.com/chusj/send-message

调用代码

[ApiController]
[Route("api/[controller]/[action]")]
public class ZhutongController : ControllerBase
{
    private readonly IZhutongService _zhutongService;
    public ZhutongController(IConfiguration config)
    {
        IServiceCollection services = new ServiceCollection();
        services.AddZhutongSendMessageApi(option =>
        {
            option.ApiUrl = config.GetValue<string>("ZhuTong:ApiUrl");
            option.ApiPath = config.GetValue<string>("ZhuTong:ApiPath");
            option.UserName = config.GetValue<string>("ZhuTong:UserName");
            option.Password = config.GetValue<string>("ZhuTong:Password");
        });
        IServiceProvider serviceProvider = services.BuildServiceProvider();

        _zhutongService = serviceProvider.GetService<IZhutongService>();
    }

    [HttpPost]
    public async Task<ZhuTongApiResponse> Test(string mobile)
    {
        var mobiles = new List<string>() { mobile };
        return await _zhutongService.Send(mobiles, "您好,今天您的生日,祝您生日快乐。 温馨提醒:为了您的健康请定期进行健康体检。【公司名称】");
    }
}

调用方式

方式1(推荐)

  1. 在需要的控制器中,构造添加服务,并配置参数
  2. 在发送方法中调用Send方法
  3. 参照上面的代码段

方式2

  1. 接在program.cs中添加服务引用,并配置参数
  2. 在业务代码构造函数注入服务
  3. 在业务代码中调用发送方法
  4. 将上面代码段移植到 Program.cs的中Main方法中
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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 145 8/16/2024