smsapi.cmcc.mas
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package smsapi.cmcc.mas --version 1.0.0
NuGet\Install-Package smsapi.cmcc.mas -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.cmcc.mas" Version="1.0.0" />
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.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: smsapi.cmcc.mas, 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.cmcc.mas as a Cake Addin #addin nuget:?package=smsapi.cmcc.mas&version=1.0.0 // Install smsapi.cmcc.mas as a Cake Tool #tool nuget:?package=smsapi.cmcc.mas&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
中国移动云MAS业务平台对接
- 云MAS
- 类库框架选择的是.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(推荐)
- 在需要的控制器中,构造添加服务,并配置参数
- 在发送方法中调用Send方法
- 参照上面的代码段
方式2
- 接在program.cs中添加服务引用,并配置参数
- 在业务代码构造函数注入服务
- 在业务代码中调用发送方法
- 将上面代码段移植到
Program.cs
的中Main方法中
Product | Versions 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.