/// <summary> /// 互亿无线群发 /// </summary> /// <param name="request"></param> /// <returns></returns> internal static Result MassSMSMessage(DataContract.Request request) { string url = WebConfigurationManager.AppSettings["MassSMSURL"].ToString(); var para = request.GetParameters <SendSmsReqPara>(); SMSSendBLL bll = new SMSSendBLL(new JIT.Utility.BasicUserInfo()); var entity = new SMSSendEntity() { MobileNO = para.MobileNO, Sign = para.Sign, SMSContent = para.SMSContent, Account = "cf_znxx", Password = "******" }; //调用短信接口直接发送 var result = GetResult(entity.GetSMS().Send2(SendType.Get, url));//GetSMS确定了是用的HuYiSMS if (result.IsSuccess) { entity.Status = 1; entity.SendCount = (entity.SendCount ?? 0) + 1; entity.Mtmsgid = result.SMSID; entity.RegularlySendTime = DateTime.Now; // Loggers.Debug(new DebugLogInfo() { Message = "【发送成功】{0}【手机号】:{1}{0}【内容】:{2}{0}【返回码】:{3}".Fmt(Environment.NewLine, entity.MobileNO, entity.SMSContent, result.ToJSON()) }); } else { entity.SendCount = (entity.SendCount ?? 0) + 1; //Loggers.Debug(new DebugLogInfo() { Message = "【发送失败】{0}【手机号】:{1}{0}【内容】:{2}{0}【错误信息】:{3}".Fmt(Environment.NewLine, entity.MobileNO, entity.SMSContent, result.ToJSON()) }); } return(result); }
/// <summary> /// 阿里大鱼 /// </summary> /// <param name="pSign"></param> /// <param name="pSMSContent"></param> /// <param name="pMobileNO"></param> /// <param name="pSmsTemplateCode"></param> /// <returns></returns> private static AlibabaAliqinFcSmsNumSendResponse AlidatySendMessage(string pSign, string pSMSContent, string pMobileNO, string pSmsTemplateCode) { string appKey = WebConfigurationManager.AppSettings["AlidayuAppKey"].ToString(); string secret = WebConfigurationManager.AppSettings["AlidayuSecret"].ToString(); string url = WebConfigurationManager.AppSettings["AlidayuURL"].ToString(); //短信发送日志 SMSSendBLL bll = new SMSSendBLL(new JIT.Utility.BasicUserInfo()); ITopClient client = new DefaultTopClient(url, appKey, secret); AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest(); req.SmsType = "normal"; req.SmsFreeSignName = pSign; //签名 req.SmsParam = pSMSContent; req.RecNum = pMobileNO; //手机号 req.SmsTemplateCode = pSmsTemplateCode; AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req); string[] temp = pMobileNO.Split(','); foreach (var i in temp) { var entity = new SMSSendEntity() { MobileNO = i, Sign = pSign, }; if (rsp.Result != null) { entity.Status = 1; entity.SendCount = (entity.SendCount ?? 0) + 1; entity.RegularlySendTime = DateTime.Now; var debug = new DebugLogInfo() { Message = "【发送成功】{0}【手机号】:{1}{0}【内容】:{2}{0}【返回码】:{3}".Fmt(Environment.NewLine, entity.MobileNO, rsp.Result.Msg, rsp.Result.ErrCode) }; Loggers.Debug(debug); } else { entity.SendCount = (entity.SendCount ?? 0) + 1; rsp.Result = new BizResult() { ErrCode = rsp.ErrCode, Msg = rsp.SubErrMsg, Success = false, }; var debug = new DebugLogInfo() { Message = "【发送失败】{0}【手机号】:{1}{0}【内容】:{2}{0}【错误信息】:{3}".Fmt(Environment.NewLine, entity.MobileNO, rsp.SubErrCode, rsp.ErrCode) }; Loggers.Debug(debug); } //保存数据库 bll.Create(entity); } return(rsp); }
/// <summary> /// 互亿无线 /// </summary> /// <param name="request"></param> /// <returns></returns> internal static Result SendMessage(DataContract.Request request) { string url = WebConfigurationManager.AppSettings["SMSSendURL"].ToString(); var para = request.GetParameters <SendSmsReqPara>(); SMSSendBLL bll = new SMSSendBLL(new JIT.Utility.BasicUserInfo()); SMSCustomerBLL smsCustomerBll = new SMSCustomerBLL(new JIT.Utility.BasicUserInfo()); var smsCustomer = smsCustomerBll.GetByID(null, para.Sign); var entity = new SMSSendEntity() { MobileNO = para.MobileNO, Sign = para.Sign, SMSContent = para.SMSContent, Account = smsCustomer.Account, Password = smsCustomer.Password }; //调用短信接口直接发送 var result = GetResult(entity.GetSMS().Send2(JIT.Utility.SMS.Base.SendType.Get, url));//GetSMS确定了是用的HuYiSMS if (result.IsSuccess) { entity.Status = 1; entity.SendCount = (entity.SendCount ?? 0) + 1; entity.Mtmsgid = result.SMSID; entity.RegularlySendTime = DateTime.Now; Loggers.Debug(new DebugLogInfo() { Message = "【发送成功】{0}【手机号】:{1}{0}【内容】:{2}{0}【返回码】:{3}".Fmt(Environment.NewLine, entity.MobileNO, entity.SMSContent, result.ToJSON()) }); } else { entity.SendCount = (entity.SendCount ?? 0) + 1; Loggers.Debug(new DebugLogInfo() { Message = "【发送失败】{0}【手机号】:{1}{0}【内容】:{2}{0}【错误信息】:{3}".Fmt(Environment.NewLine, entity.MobileNO, entity.SMSContent, result.ToJSON()) }); } //保存数据库 bll.Create(entity); return(result); }