HTTPSmsSendReturnInfo.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace LYFZ.WinicSmsInterface
  7. {
  8. /// <summary>
  9. /// Http方式短信发送接口返回信息
  10. /// </summary>
  11. public class HTTPSmsSendReturnInfo : LYFZ.StandardInterface.IHTTPSmsSendReturnInfo
  12. {
  13. public HTTPSmsSendReturnInfo(string returnInfoStr)
  14. {
  15. this.SourceString = returnInfoStr;
  16. if (!returnInfoStr.ToLower().Contains("/send:"))
  17. {
  18. this.SourceString = "-1/Send:0/Consumption:.0/Tmoney:0/sid:0/访问短信服务商服务器失败【HTTPSmsSendReturnInfo错误信息:" + returnInfoStr + "】";
  19. }
  20. if (returnInfoStr != "")
  21. {
  22. string[] returnInfos = this.SourceString.Split('/');
  23. try
  24. {
  25. if (!returnInfoStr.ToLower().Contains("/send:"))
  26. {
  27. this.ReturnStatus = returnInfoStr;
  28. }
  29. else {
  30. this.ReturnStatus = SendSmsResults.GetResults(returnInfos[0]);
  31. this.ReturnCode = returnInfos[0];
  32. }
  33. }
  34. catch { this.ReturnStatus = this.SourceString; }
  35. try
  36. {
  37. this.SendCount = Convert.ToInt32(returnInfos[1].Split(':')[1]);
  38. }
  39. catch { this.ReturnStatus = this.SourceString; }
  40. try
  41. {
  42. this.Consumption = Convert.ToDecimal(returnInfos[2].Split(':')[1]);
  43. }
  44. catch { }
  45. try
  46. {
  47. this.Tmoney = Convert.ToDecimal(returnInfos[3].Split(':')[1]);
  48. }
  49. catch { }
  50. try
  51. {
  52. this.Sid = returnInfos[4];
  53. }
  54. catch { }
  55. }
  56. }
  57. private string _SourceString = "";
  58. /// <summary>
  59. /// 源字符串
  60. /// </summary>
  61. public string SourceString
  62. {
  63. get { return _SourceString; }
  64. set { _SourceString = value; }
  65. }
  66. int _SendCount = 0;
  67. /// <summary>
  68. /// 发送条数
  69. /// </summary>
  70. public int SendCount
  71. {
  72. get { return _SendCount; }
  73. set { _SendCount = value; }
  74. }
  75. decimal _Consumption=0m;
  76. /// <summary>
  77. /// 当次消费金额
  78. /// </summary>
  79. public decimal Consumption
  80. {
  81. get { return _Consumption; }
  82. set { _Consumption = value; }
  83. }
  84. decimal _Tmoney = 0m;
  85. /// <summary>
  86. /// 总体余额
  87. /// </summary>
  88. public decimal Tmoney
  89. {
  90. get { return _Tmoney; }
  91. set { _Tmoney = value; }
  92. }
  93. int _RemainingNumber = -1;
  94. /// <summary>
  95. /// 总体余额_剩余条数
  96. /// </summary>
  97. public int RemainingNumber
  98. {
  99. get { return _RemainingNumber; }
  100. set { _RemainingNumber = value; }
  101. }
  102. string _Sid = "";
  103. /// <summary>
  104. /// 短信编号
  105. /// </summary>
  106. public string Sid
  107. {
  108. get { return _Sid; }
  109. set { _Sid = value; }
  110. }
  111. string _ReturnStatus = "";
  112. /// <summary>
  113. /// 返回状态 状态码:代码说明
  114. /// </summary>
  115. public string ReturnStatus
  116. {
  117. get { return _ReturnStatus; }
  118. set { _ReturnStatus = value; }
  119. }
  120. string returnCode = "-12";
  121. /// <summary>
  122. /// 返回发送状态码 000 为发送成功,其它为失败
  123. /// </summary>
  124. public string ReturnCode
  125. {
  126. get { return returnCode; }
  127. set { returnCode = value; }
  128. }
  129. decimal _Price;
  130. /// <summary>
  131. /// 单价
  132. /// </summary>
  133. public decimal Price
  134. {
  135. get {
  136. try
  137. {
  138. this._Price = this._Consumption / _SendCount;
  139. }
  140. catch { this._Price = 0m; }
  141. return _Price; }
  142. }
  143. string _SendSuccessTel = "";
  144. /// <summary>
  145. /// 发送成功的手机号 多个以“,”号分隔
  146. /// </summary>
  147. public string SendSuccessTel
  148. {
  149. get { return _SendSuccessTel; }
  150. set { _SendSuccessTel = value; }
  151. }
  152. string _SendFaileTel = "";
  153. /// <summary>
  154. /// 发送失败的手机号 多个以“,”号分隔
  155. /// </summary>
  156. public string SendFaileTel
  157. {
  158. get { return _SendFaileTel; }
  159. set { _SendFaileTel = value; }
  160. }
  161. /// <summary>
  162. /// 短信接口服务商
  163. /// </summary>
  164. public string SMSInterface
  165. {
  166. get { return "深圳吉信通"; }
  167. }
  168. }
  169. }