/// <summary> /// 通知短信网关 /// </summary> public static void SendMessage(string PhoneNum, string Message, string SPID) { string ErrMsg = ""; string Result = "-19999"; try { UnifyInterfaceProxy obj = new UnifyInterfaceProxy(); string UnifyInterUrl = ConfigurationManager.AppSettings["UnifyInterUrl"]; obj.Url = UnifyInterUrl; Result = obj.insertSendDatas(PhoneNum, Message, SPID); XmlDocument xmlD = new XmlDocument(); xmlD.LoadXml(Result); ErrMsg = xmlD.GetElementsByTagName("errorDescription")[0].InnerText; Result = xmlD.GetElementsByTagName("result")[0].InnerText; //如果失败则记入表 } catch (Exception ex) { string df = ex.Message; } finally { string IsWriteLog = ConfigurationManager.AppSettings["IsWriteLog"]; try { if (IsWriteLog == "0") { CommonBizRules.WriteDataLog("35000000", "", "", int.Parse(Result), ErrMsg, PhoneNum, "SendMessage"); } } catch { } } }
/// <summary> /// 通知短信网关 /// Author Lihongtu /// </summary> /// <param name="PhoneNum"></param> /// <param name="Message"></param> /// <param name="SPID"></param> public static void SendMessageV2(string PhoneNum, string Message, string SPID) { string ErrMsg = ""; string Result = "-19999"; try { SmsClient sc = new SmsClient(); sc.sendSingleSms("02120906193", PhoneNum, Message); Result = "0"; ErrMsg = "发送成功"; } catch (Exception e) { ErrMsg = e.ToString(); } finally { string IsWriteLog = ConfigurationManager.AppSettings["IsWriteLog"]; try { if (IsWriteLog == "0") { CommonBizRules.WriteDataLog("35000000", "", "", int.Parse(Result), ErrMsg, PhoneNum, "SendMessage"); } } catch { } } }