No description, website, or topics provided.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Wilddog
WilddogTest
.gitignore
README.md
wilddog-sms-csharp.sln

README.md

wilddog-sms

Wilddog SMS SDK for .Net platform

Getting started

环境依赖:

  1. .net > 4.6.0
  2. Newtonsoft.Json >= 10.0.3

安装:

PM> Install-Package Wilddog.SMS

OR

Visual Studio中通过nuget搜索Wilddog.SMS

初始化

using Wilddog.Sms;
using Wilddog.Sms.Http;

Client client = new Client("YOUR_APP_ID", "YOUR_SMS_KEY");

发送验证码短信

使用野狗生成验证码

SubmitResponse submitRsps = client.SendCode("PHONE_NUMBER", "TEMPLATE_ID");
if (submitRsps.Success)
{
    Console.WriteLine(submitRsps.ToString());
}
else
{
    Console.WriteLine(submitRsps.WilddogError.ToString());
}

使用自生成验证码

IList Params = new ArrayList();
Params.Add("123456");
SubmitResponse submitRsps = client.SendCode("PHONE_NUMBER", "TEMPLATE_ID", Params);
if (submitRsps.Success)
{
    Console.WriteLine(submitRsps.ToString());
}
else
{
    Console.WriteLine(submitRsps.WilddogError.ToString());
}

校验验证码

CheckCodeResponse checkCodeRsps = client.CheckCode("PHONE_NUMBER", code);
if (checkCodeRsps.Success)
{
    Console.WriteLine(checkCodeRsps.ToString());
}
else
{
    Console.WriteLine(checkCodeRsps.WilddogError.ToString());
}

发送通知短信

IList Params = new ArrayList();
Params.Add("PARAM1");
IList mobiles = new ArrayList();
mobiles.Add("PHONE_NUMBER");
SubmitResponse submitRsps = client.SendNotify(mobiles, "TEMPLATE_ID", Params);
if (submitRsps.Success)
{
    Console.WriteLine(submitRsps.ToString());
}
else
{
    Console.WriteLine(submitRsps.WilddogError.ToString());
}

查询发送状态

V1

StatusResponse statusRsps = client.QueryStatus(rrid);
if (statusRsps.Success)
{
    Console.WriteLine(statusRsps.ToString());
}
else
{
    Console.WriteLine(statusRsps.WilddogError.ToString());
}

V2

StatusResponse statusRsps = client.QueryStatus();
if (statusRsps.Success)
{
    Console.WriteLine(statusRsps.ToString());
}
else
{
    Console.WriteLine(statusRsps.WilddogError.ToString());
}

查询账户余额

BalanceResponse balanceResp = client.QueryBalance();
if (balanceResp.Success)
{
    Console.WriteLine(balanceResp.ToString());
}
else
{
    Console.WriteLine(balanceResp.WilddogError.ToString());
}