private SmsResult SendVerifycodeToShopUser(string mobile, string msg, DateTime?sendTime, string sign = "", string type = "积分门店使用验证短信") { var user = Hyt.BLL.CRM.CrCustomerBo.Instance.GetCrCustomer(mobile); if (user == null || user.IsReceiveShortMessage == (int)Hyt.Model.WorkflowStatus.CustomerStatus.是否接收短信.否) { return new SmsResult { RowCount = 0, Status = SmsResultStatus.Failue } } ; var result = new SmsResult(); if (!string.IsNullOrEmpty(mobile) && !string.IsNullOrEmpty(msg)) { using (var service = new Hyt.Infrastructure.Communication.ServiceProxy <Grand.Service.EC.Core.SMS.Contract.ISMSService>()) { var response = service.Channel.SendMessage(type, mobile, msg, sign); if (response.IsError) { result.Status = SmsResultStatus.Failue; } else { result.Status = SmsResultStatus.Success; } } //result = SmsProviderFactory.CreateProvider().Send(mobile, msg, sendTime, sign); //SaveToDb(mobile, msg, result); } return(result); }
/// <summary> /// 发送一条短信,发送给后台管理员,判断管理员手机是否存在 /// 先调用网关发送短信,然后将短信记录到数据库,如果发送失败,则由后台进程重发。 /// </summary> /// <param name="mobile"></param> /// <param name="msg"></param> /// <param name="sendTime"></param> /// <param name="sign"></param> /// <param name="type"></param> /// <returns></returns> private SmsResult SendToSyUser(string mobile, string msg, DateTime?sendTime, string sign = "", string type = "发送管理员密码短信") { var userList = Hyt.BLL.Sys.SyUserBo.Instance.GetUserListWithoutSysNoList(new int[] { -1 }); var user = userList.FirstOrDefault(u => u.MobilePhoneNumber == mobile); var result = new SmsResult { RowCount = 0, Status = SmsResultStatus.Failue }; if (user == null || user.Status == (int)Hyt.Model.WorkflowStatus.SystemStatus.系统用户状态.禁用) { return(result); } if (!string.IsNullOrEmpty(mobile) && !string.IsNullOrEmpty(msg)) { using (var service = new Hyt.Infrastructure.Communication.ServiceProxy <Grand.Service.EC.Core.SMS.Contract.ISMSService>()) { var response = service.Channel.SendMessage(type, mobile, msg, sign); if (response.IsError) { result.Status = SmsResultStatus.Failue; } else { result.Status = SmsResultStatus.Success; } } } return(result); }
/// <summary> /// 发送模板消息 /// </summary> /// <param name="data">消息内容</param> /// <returns></returns> /// <remarks>2016-4-8 杨浩 创建</remarks> public Result SendTemplateMessage(int dealerSysNo, string data) { var result = new Result() { Status = true }; lock (writeFile) { try { using (var service = new Hyt.Infrastructure.Communication.ServiceProxy <Hyt.Service.Contract.WeiXin.IWebChatService>()) { result = service.Channel.SendTemplateMessage(dealerSysNo, data); WriteLog("检测有无重复发送信息(Status):" + result.Status + ",Message:" + result.Message); } } catch (Exception ex) { result.Status = false; result.Message = ex.Message; } } return(result); }
/// <summary> /// 删除所有Web站点本地缓存 /// </summary> /// <remarks>2016-12-26 杨浩 创建</remarks> public void DelAllWebSiteCache(int dealerSysNo = -1) { try { using (var service = new Hyt.Infrastructure.Communication.ServiceProxy <Hyt.Service.Contract.B2CApp.IProduct>()) { var response = service.Channel.ResetProductCache(dealerSysNo); } } catch {} }
/// <summary> /// 删除微信授权码 /// </summary> /// <param name="dealerSysNo">经销商编号</param> /// <remarks> /// 2016-1-14 杨浩 创建 /// 2016-2-26 杨浩 将微信授权码转入Memcached /// </remarks> public static void AccessToken(int dealerSysNo) { using (var service = new Hyt.Infrastructure.Communication.ServiceProxy <Hyt.Service.Contract.WeiXin.IWebChatService>()) { string key = string.Format(KeyConstant.WeixinAccessToken_, dealerSysNo); var result = service.Channel.RemoveCache(key); key = string.Format(KeyConstant.WeixinJsTicket_, dealerSysNo); service.Channel.RemoveCache(key); } CacheManager.RemoveCache(CacheKeys.Items.WeixinAccessToken_, dealerSysNo.ToString()); CacheManager.RemoveCache(CacheKeys.Items.WeixinJsTicket_, dealerSysNo.ToString()); }
/// <summary> /// 发送模板消息 /// </summary> /// <param name="data">消息内容</param> /// <returns></returns> /// <remarks>2016-4-8 杨浩 创建</remarks> public Result SendTemplateMessage(string data) { var result = new Result() { Status = true }; try { using (var service = new Hyt.Infrastructure.Communication.ServiceProxy <Hyt.Service.Contract.WeiXin.IWebChatService>()) { result = service.Channel.SendTemplateMessage(0, data); } } catch (Exception ex) { result.Status = false; result.Message = ex.Message; } return(result); }