/// <summary> /// 发送微信支付成功的信息推送 /// </summary> /// <param name="wxopenid"></param> /// <returns></returns> public void SendCustomerServiceLazy(ReceiveMsgBase msg) { ParameterizedThreadStart parStart = new ParameterizedThreadStart(SendCustomerService); Thread oThread = new Thread(parStart); oThread.Start(msg); }
public ReplayMsgBase GetServiceResult(ReceiveMsgBase sender) { //todo 暂时没用这个功能 int sendtype = 0;// ConvertUtils.ConvertToInt(ConfigurationManager.AppSettings["IsPostMsgCustomerService"]); switch (sendtype) { case 0: //无反馈 return(null); break; //case 1: #region update by xxb 2017/07/17 因需要对接外部的udesk客服回复,所以撤销此自动回复 // //反馈固定语句 // Replytext text = new Replytext(); // text.FromUserName = sender.ToUserName; // text.ToUserName = sender.FromUserName; // text.CreateTime = sender.CreateTime; // string config = ConvertUtils.ConvertToString(ConfigurationManager.AppSettings["CustomerServiceMsg"]); // if (!string.IsNullOrWhiteSpace(config)) // { // text.Content = HttpUtility.HtmlEncode(string.Format(config.Replace("[", "<").Replace("]", ">"), sender.FromUserName)); // return text; // } // else // { // return null; // } // break; case 2: //反馈转接微信自带多客服 ReplayMsgBase result = new ReplayMsgBase(); result.FromUserName = sender.ToUserName; result.ToUserName = sender.FromUserName; result.CreateTime = sender.CreateTime; result.MsgType = "transfer_customer_service"; return(result); break; case 3: //反馈转借麦信多客服 SendCustomerServiceLazy(sender); return(null); default: break; } return(null); }
/// <summary> /// 消息转发多客服 /// </summary> /// <param name="msg"></param> /// <param name="sendKey"></param> private void SendCustomerService(Object obj) { string result = string.Empty; string date = string.Empty; string strUrl = string.Empty; try { ReceiveMsgBase msg = obj as ReceiveMsgBase; if (msg == null) { return; } if (msg is LinkMsg) { LinkMsg link = msg as LinkMsg; link.Title = "<![CDATA[" + link.Title + "]]>"; link.Description = "<![CDATA[" + link.Description + "]]>"; link.Url = "<![CDATA[" + link.Url + "]]>"; } else if (msg is LocationMsg) { LocationMsg link = msg as LocationMsg; link.Location_X = "<![CDATA[" + link.Location_X + "]]>"; link.Location_Y = "<![CDATA[" + link.Location_Y + "]]>"; link.Scale = "<![CDATA[" + link.Scale + "]]>"; link.Label = "<![CDATA[" + link.Label + "]]>"; } else if (msg is PicMsg) { PicMsg link = msg as PicMsg; link.PicUrl = "<![CDATA[" + link.PicUrl + "]]>"; link.MediaId = "<![CDATA[" + link.MediaId + "]]>"; } else if (msg is TextMsg) { TextMsg link = msg as TextMsg; link.Content = "<![CDATA[" + link.Content + "]]>"; } else if (msg is VideoMsg) { VideoMsg link = msg as VideoMsg; link.ThumbMediaId = "<![CDATA[" + link.ThumbMediaId + "]]>"; link.MediaId = "<![CDATA[" + link.MediaId + "]]>"; } else if (msg is VoiceMsg) { VoiceMsg link = msg as VoiceMsg; link.MediaId = "<![CDATA[" + link.MediaId + "]]>"; link.Format = "<![CDATA[" + link.Format + "]]>"; link.Recognition = "<![CDATA[" + link.Recognition + "]]>"; } //try //{ // DataTable dt = DalMemberCommon.GetMemberInfoByWeiXinOpenId(msg.FromUserName); // if (dt != null && dt.Rows.Count > 0) // { date = msg.ToXml(); strUrl = @"http://dkf.ozner.net/service/wxcustomer.aspx"; } catch (Exception ex) { string errorinfo = "错误堆栈:" + ex.StackTrace; if (obj != null) { string addition = ""; string baseName = obj.GetType().Name; if (obj is ReceiveMsgBase) { ReceiveMsgBase rmb = obj as ReceiveMsgBase; Type type = rmb.GetType(); if (rmb is LinkMsg) { LinkMsg link = rmb as LinkMsg; addition = link.Title + "|" + link.Description + "|" + link.Url; } else if (rmb is LocationMsg) { LocationMsg link = rmb as LocationMsg; addition = link.Location_X + "|" + link.Location_Y + "|" + link.Scale + "|" + link.Label; } else if (rmb is PicMsg) { PicMsg link = rmb as PicMsg; addition = link.PicUrl + "|" + link.MediaId; } else if (rmb is TextMsg) { TextMsg link = rmb as TextMsg; addition = link.Content; } else if (rmb is VideoMsg) { VideoMsg link = rmb as VideoMsg; addition = link.MediaId + "|" + link.ThumbMediaId; } else if (rmb is VoiceMsg) { VoiceMsg link = rmb as VoiceMsg; addition = link.MediaId + "|" + link.Format + "|" + link.Recognition; } } errorinfo = "类型:" + obj.GetType().Name + " 额外信息:" + addition + " 错误信息:" + errorinfo; } //LogBase.LogHzLkt.LogExErr("HzLktSite", "OznerMall", "SendCustomerService", errorinfo, ELogExLevel.Higher, errorinfo); } try { result = WebClientHelper.CallPost(strUrl, date, Encoding.UTF8); } catch (Exception ex) { //LogBase.LogHzLkt.LogExErr(ex, ELogExLevel.Middle); } }