public static int GetMember_sms(string phone, string name, string card, string password, decimal money, string key, int comid, int sendnum) { string msg = ""; string content = ""; using (var helper = new SqlHelper()) { B2b_crm surplus = null; if (card != "") { surplus = new B2bCrmData().GetB2bCrmByCardcode(decimal.Parse(card)); } var pro = new SendSmsHelper(helper).member_sms(phone, name, card, password, money, key); if (pro != null) { if (pro.Remark.ToString() != "" || pro.Remark.ToString() != null) { content = pro.Remark.ToString(); if (sendnum > 1) { content = "R" + (sendnum - 1).ToString() + pro.Remark.ToString(); } content = content.Replace("$name$", name); content = content.Replace("$phone$", phone); content = content.Replace("$card$", card); content = content.Replace("$pass$", password); content = content.Replace("$money$", System.Math.Abs(money).ToString()); if (surplus != null) { content = content.Replace("$Ysurplus$", surplus.Imprest.ToString()); content = content.Replace("$Xsurplus$", surplus.Integral.ToString()); } } } } try { var backContent = SendSms(phone, content, comid, out msg); return(backContent); } catch (Exception ex) { msg = "短信发送错误" + ex.Message; return(-9); } }
//#region 碟信接口发送短信webserver ///// <summary> /////发送碟信接口 ///// </summary> ///// <param name="mobile">手机</param> ///// <param name="Content">发送内容</param> ///// <returns>获取返回值</returns> //public static int WebServerSendSms(string mobile, string Content, out string msg) //{ // string smsurl = "http://115.28.14.21/"; // string CorpID = "wlc"; // string Pwd = "lixh1210"; // string Cell = ""; // string SendTime = ""; // var backContent = string.Empty; // LinkWSSoapClient WSS = new LinkWSSoapClient(); // try // { // int R = WSS.Send(CorpID, Pwd, mobile, Content, Cell, SendTime); // if (R == 0) // { // msg = ("发送成功!"); // } // else if (R == -1) // { // msg = ("帐号未注册!"); // } // else if (R == -2) // { // msg = ("其他错误!"); // } // else if (R == -3) // { // msg = ("密码错误!"); // } // else if (R == -4) // { // msg = ("手机号码格式不对!"); // } // else if (R == -5) // { // msg = ("余额不足!"); // } // else if (R == -6) // { // msg = ("定时发送时间不是有效时间格式!"); // } // else { // msg = "未知错误"; // } // return R; // } // catch (System.Net.WebException WebExcp) // { // msg = ("网络错误,无法连接到服务器!"); // return 9; // } //} //#endregion #region 发送短信公用 public static int Member_smsBal(Smsmodel model) { string msg = ""; string content = ""; using (var helper = new SqlHelper()) { B2b_crm surplus = null; if (model.Card != "" && model.Card != null) { surplus = new B2bCrmData().GetB2bCrmByCardcode(decimal.Parse(model.Card)); } var pro = new SendSmsHelper(helper).member_sms(model.Phone, model.Name, model.Card, model.Password, model.Money, model.Key); if (pro != null) { if (pro.Remark.ToString() != "" || pro.Remark.ToString() != null) { content = pro.Remark.ToString(); content = content.Replace("$comName$", model.ComName); content = content.Replace("$phone$", model.Phone); content = content.Replace("$name$", model.Name); content = content.Replace("$card$", model.Card); content = content.Replace("$password$", model.Password); content = content.Replace("$money$", System.Math.Abs(model.Money).ToString()); content = content.Replace("$num$", model.Num.ToString()); content = content.Replace("$old$", model.Old); content = content.Replace("$starttime$", model.Starttime.ToString("yyyy-MM-dd")); content = content.Replace("$endtime$", model.Endtime.ToString("yyyy-MM-dd")); content = content.Replace("$code$", model.Code); content = content.Replace("$customtext$", model.Customtext); content = content.Replace("$key$", model.Key); content = content.Replace("$title$", model.Title); content = content.Replace("$num1$", model.Num1.ToString()); if (surplus != null) { content = content.Replace("$imprest$", System.Math.Abs(model.Imprest).ToString()); content = content.Replace("$integral$", System.Math.Abs(model.Integral).ToString()); } } } } try { if (model.Key == "预订酒店短信")//不用支付,直接发送预订短信 { var backContent = SendSms(model.Phone, content, model.Comid, out msg); return(backContent); } else if (model.Key == "微信酒店预订服务商通知短信")//服务商通知短信 { var backContent = SendSms(model.RecerceSMSPhone, content, model.Comid, out msg); return(backContent); } else { var backContent = SendSms(model.Phone, content, model.Comid, out msg); return(backContent); } } catch (Exception ex) { msg = "短信发送错误" + ex.Message; return(-9); } }