SendSmsResults.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace LYFZ.WeinaSmsInterface
  7. {
  8. /// <summary>
  9. /// 反代码说明
  10. /// </summary>
  11. public class SendSmsResults
  12. {
  13. /// <summary>
  14. /// 短信发送状态
  15. /// </summary>
  16. public enum SendStatus
  17. {
  18. 发送成功,
  19. 发送失败,
  20. 等待发送,
  21. 忽略发送,
  22. 手动重发中
  23. }
  24. public SendSmsResults()
  25. { }
  26. public static string GetReturnValue(string name, string sourceString)
  27. {
  28. string[] userInfos = sourceString.Split('&');
  29. string value = "-1";
  30. try
  31. {
  32. for (int i = 0; i < userInfos.Length; i++)
  33. {
  34. if (userInfos[i].Split('=')[0].Trim().ToLower() == name.Trim().ToLower())
  35. {
  36. value = userInfos[i].Split('=')[1];
  37. break;
  38. }
  39. }
  40. }
  41. catch { }
  42. return value;
  43. }
  44. /// <summary>
  45. /// 根据返回代码 获取错误信息
  46. /// </summary>
  47. /// <param name="code"></param>
  48. /// <returns></returns>
  49. public static string GetResults(string code)
  50. {
  51. string resultStr = "";
  52. switch (code)
  53. {
  54. case "0": resultStr = "成功"; break;
  55. case "6001": resultStr = "该企业用户无效"; break;
  56. case "6002": resultStr = "该企业用户名无效"; break;//
  57. case "6008": resultStr = "无效的手机号码"; break;
  58. case "6009": resultStr = "手机号码是黑名单"; break;
  59. case "6010": resultStr = "企业用户验证失败"; break;//
  60. case "6011": resultStr = "短信内容超过了最大长度限制"; break;
  61. case "6012": resultStr = "该企业用户设置了ip限制"; break;
  62. case "6013": resultStr = "该企业用户余额不足"; break;//
  63. case "6014": resultStr = "发送短信内容不能为空"; break;
  64. case "6015": resultStr = "发送内容中含非法字符"; break;
  65. case "6019": resultStr = "此接口已经停止使用"; break;
  66. case "6021": resultStr = "扩展号码未备案"; break;
  67. case "6023": resultStr = "发送手机号码超过太长,已超过70个号码"; break;
  68. case "6024": resultStr = "定制时间不正确"; break;
  69. case "6025": resultStr = "扩展号码太长"; break;
  70. case "6030": resultStr = "此帐号是营销版帐号,无法使用"; break;
  71. case "6080": resultStr = "提交异常,请联系服务商解决"; break;
  72. case "6085": resultStr = "内容为空"; break;
  73. case "-1": resultStr = "服务器网络错误,无法找到接口服务器"; break;
  74. default: resultStr = "未知错误"; break;
  75. }
  76. return resultStr;
  77. }
  78. }
  79. }