smsapi.cmcc.mas 1.0.1

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

// Install smsapi.cmcc.mas as a Cake Tool
#tool nuget:?package=smsapi.cmcc.mas&version=1.0.1                

中国移动云MAS业务平台对接

  1. 云MAS
  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 MasController : ControllerBase
{
    private readonly IMasService _masService;

    public MasController(IConfiguration config)
    {
        IServiceCollection services = new ServiceCollection();
        services.AddMasSendMessageApi(option =>
        {
            option.ApiUrl = config.GetValue<string>("Mas:ApiUrl");
            option.ApiPath = config.GetValue<string>("Mas:ApiPath");
            option.apId = config.GetValue<string>("Mas:ApId");
            option.ecName = config.GetValue<string>("Mas:EcName");
            option.secretKey = config.GetValue<string>("Mas:SecretKey");
            option.sign = config.GetValue<string>("Mas:Sign");
            option.addSerial = config.GetValue<string>("Mas:AddSerial");
        });
        IServiceProvider serviceProvider = services.BuildServiceProvider();
        _masService = serviceProvider.GetService<IMasService>();
    }
    [HttpPost]
    public async Task<MasApiResponse> Test(string mobile)
    {
        var mobiles = new List<string>() { mobile };
        return await _masService.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.

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.1 145 8/21/2024
1.0.0 125 8/21/2024

增加对NewtonSoft.Json依赖