SendSmsResults.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. /// 反代码说明
  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. /// <summary>
  27. /// 根据返回代码 获取错误信息
  28. /// </summary>
  29. /// <param name="code"></param>
  30. /// <returns></returns>
  31. public static string GetResults(string code)
  32. {
  33. string resultStr = code;
  34. if (resultStr.IndexOf(".") != -1)
  35. {
  36. decimal outMoeny = 0m;
  37. if (!decimal.TryParse(resultStr, out outMoeny))
  38. {
  39. resultStr = "未知错误";
  40. }
  41. else {
  42. return outMoeny.ToString("n2");
  43. }
  44. }
  45. else
  46. {
  47. switch (code)
  48. {
  49. case "000": resultStr = "成功"; break;
  50. case "-01": resultStr = "当前账号余额不足!"; break;
  51. case "-02": resultStr = "当前用户ID错误!"; break;
  52. case "-03": resultStr = "当前密码错误!"; break;
  53. case "-04": resultStr = "参数不够或参数内容的类型错误!"; break;
  54. case "-05": resultStr = "手机号码格式不对!"; break;
  55. case "-06": resultStr = "短信内容编码不对!"; break;
  56. case "-07": resultStr = "短信内容含有敏感字符!"; break;
  57. case "-08": resultStr = "无接收数据!"; break;
  58. case "-09": resultStr = "系统维护中!"; break;
  59. case "-10": resultStr = "手机号码数量超长!"; break;
  60. case "-11": resultStr = "短信内容超长!(70个字符)!"; break;
  61. case "-12": resultStr = "其它错误!"; break;
  62. case "-13": resultStr = "文件传输错误!"; break;
  63. case "-1": resultStr = "服务器网络错误,无法找到接口服务器"; break;
  64. default: resultStr = "成功"; break;
  65. }
  66. }
  67. return resultStr;
  68. }
  69. }
  70. }