smsapi.lianlu 1.0.0

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

// Install smsapi.lianlu as a Cake Tool
#tool nuget:?package=smsapi.lianlu&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

控制器代码

[Route("api/[controller]/[action]")]
[ApiController]
public class LianluController : ControllerBase
{
    private readonly ILianluService _lianluService;
    public LianluController(IConfiguration config)
    {
        IServiceCollection services = new ServiceCollection();
        services.AddLianluSendMessageApi(option =>
        {
            option.ApiUrl = config.GetValue<string>("LianLu:ApiUrl");
            option.ApiPath = config.GetValue<string>("LianLu:ApiPath");
            option.MchId = config.GetValue<string>("LianLu:MchId");
            option.AppId = config.GetValue<string>("LianLu:AppId");
            option.AppKey = config.GetValue<string>("LianLu:AppKey");
        });
        IServiceProvider serviceProvider = services.BuildServiceProvider();

        _lianluService = serviceProvider.GetService<ILianluService>();
    }

    [HttpPost]
    public async Task<LianLuApiResponse> Test(string mobile)
    {
        var mobiles = new List<string>() { mobile };
        return await _lianluService.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 143 8/16/2024