SendSMS.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using PMS.Plugins.Common;
  2. using QWPlatform.SystemLibrary.LogManager;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Configuration;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using ZlsoftSMS_SdkApi;
  10. namespace PMS.Plugins.SMS
  11. {
  12. public class SendSMS
  13. {
  14. /// <summary>
  15. /// 筷子家医短信
  16. /// </summary>
  17. /// <param name="sm"></param>
  18. /// <param name="msg"></param>
  19. /// <returns></returns>
  20. public static bool SendKuaiZiSMS(string phone,ref string code)
  21. {
  22. var msg = "";
  23. var KuaiZiSMSServiceURL = ConfigurationManager.AppSettings["SendingSmsUrl"].ToStringEx();
  24. var array = KuaiZiSMSServiceURL.Split('|');//【0】WEBAPI请求地址|【1】账号|【2】密码|【3】模板id|【4】签名|【5】所属站点|
  25. code = HashtableHelper.NewKey();
  26. SMSRequestClient cc = new SMSRequestClient();
  27. SystemInternalModel sim = new SystemInternalModel();
  28. sim.ServerUrl = array[0];
  29. sim.sms_account = array[1];
  30. sim.sms_password = array[2];
  31. sim.template_code = array[3];
  32. sim.sign_name = array[4];
  33. sim.phone_numbers = phone;
  34. sim.paramates = "{\"code\":\"" + code + "\"}";
  35. sim.siteid = array[5];
  36. sim.source_mode = "1";
  37. sim.org_id = "";
  38. var result = cc.SendSms20200109(sim,out msg);
  39. Logger.Instance.Info("发送短信(手机号=)"+ phone+"|返回内容=" + result);
  40. return true;
  41. }
  42. }
  43. }