//给顾问,客户,绑定人发送通知, sentype=1 给绑定顾问,=2给客户 =3给教练 public static void SendWxkefumsg(int orderid, int sentype, string msg, int comid) { WeiXinBasic basic = new WeiXinBasicData().GetWxBasicByComId(comid); string openid = ""; WxMessageLogData messagelogdata = new WxMessageLogData(); B2bOrderData orderdate = new B2bOrderData(); var orderinfo = orderdate.GetOrderById(orderid); if (orderinfo == null) { return; } //会员 MemberCardData carddata = new MemberCardData(); var userdata = new B2bCrmData(); if (sentype == 2) { var userinfo = userdata.Readuser(orderinfo.U_id, orderinfo.Comid); if (userinfo == null) { return; } openid = userinfo.Weixin; if (openid != "") { //微信客服 文本消息 string data = SendWxMsg(comid, openid, 1, "", msg, "", basic.Weixinno); } } if (sentype == 1) { var b2bprodata = new B2bComProData(); var proinfo = b2bprodata.GetProById(orderinfo.Pro_id.ToString(), orderinfo.Speciid, orderinfo.channelcoachid); if (proinfo == null) { return; } if (proinfo.bookpro_bindphone != "") { //var channeldata = new MemberChannelData(); //var channelinfo = channeldata.GetPhoneComIdChannelDetail(proinfo.bookpro_bindphone,comid); //直接通过 手机查询用户 var userinfo_binding = userdata.GetSjKeHu(proinfo.bookpro_bindphone, orderinfo.Comid); if (userinfo_binding == null) { return; } openid = userinfo_binding.Weixin; if (openid != "") { //微信 文本消息 string data_binding = SendWxMsg(comid, openid, 1, "", msg, "", basic.Weixinno); } } } //给教练 if (sentype == 3) { var b2bprodata = new B2bComProData(); var proinfo = b2bprodata.GetProById(orderinfo.Pro_id.ToString(), orderinfo.Speciid, orderinfo.channelcoachid); if (proinfo == null) { return; } if (orderinfo.channelcoachid != 0) { var channeldata = new MemberChannelData(); var channelinfo = MemberChannelData.GetChannelinfo(orderinfo.channelcoachid); if (channelinfo != null) { //直接通过 手机查询用户 var userinfo_binding = userdata.GetSjKeHu(channelinfo.Mobile, orderinfo.Comid); if (userinfo_binding == null) { return; } openid = userinfo_binding.Weixin; if (openid != "") { //微信 文本消息 string data_binding = SendWxMsg(comid, openid, 1, "", msg, "", basic.Weixinno); } } } } }