Exemple #1
0
        //当客户的渠道为0时,随机自动分配一个渠道编号(优先未锁定用户的),sendtype= 当为1的时候 有渠道也发送,一般是点击我的顾问时候发送,0=则是留言的时候变更渠道发送
        public static int GetFenpeiChannel(int comid, string openid, int sendtype = 1, int companyid = 0, int channleid = 0)
        {
            var            crmdata       = new B2bCrmData();
            MemberCardData carddata      = new MemberCardData();
            var            channeldata   = new MemberChannelData();//读取渠道信息
            decimal        idcard        = 0;
            decimal        channelid     = 0;
            var            userinfo_auto = carddata.GetMemberCardByOpenId(openid);;//获取微信操作账户

            if (userinfo_auto != null)
            {
                idcard    = userinfo_auto.Cardcode;;
                channelid = userinfo_auto.IssueCard;//获取渠道ID
            }

            //判断对 微信注册,网站注册渠道进行归0
            var channeltype = channeldata.GetChannelDetail(int.Parse(channelid.ToString()));

            if (channeltype != null)
            {
                if (channeltype.Issuetype == 3 || channeltype.Issuetype == 4 || channeltype.Name == "默认渠道")
                {//如果渠道时微信注册或网站注册,渠道ID归0,下面自动重新分配有效渠道
                    channelid = 0;
                }
            }


            return(int.Parse(channelid.ToString()));
        }
Exemple #2
0
        //当客户的渠道为0时,随机自动分配一个渠道编号(优先未锁定用户的),sendtype= 当为1的时候 有渠道也发送,一般是点击我的顾问时候发送,0=则是留言的时候变更渠道发送
        public static int AutoFenpeiChannel(int comid, string openid, int sendtype = 1, int companyid = 0, int channleid = 0)
        {
            var            crmdata       = new B2bCrmData();
            MemberCardData carddata      = new MemberCardData();
            var            channeldata   = new MemberChannelData();//读取渠道信息
            decimal        idcard        = 0;
            decimal        channelid     = 0;
            var            userinfo_auto = carddata.GetMemberCardByOpenId(openid);;//获取微信操作账户

            if (userinfo_auto != null)
            {
                idcard    = userinfo_auto.Cardcode;;
                channelid = userinfo_auto.IssueCard;//获取渠道ID
            }

            //判断对 微信注册,网站注册渠道进行归0
            var channeltype = channeldata.GetChannelDetail(int.Parse(channelid.ToString()));

            if (channeltype != null)
            {
                if (channeltype.Issuetype == 3 || channeltype.Issuetype == 4 || channeltype.Name == "默认渠道")
                {//如果渠道时微信注册或网站注册,渠道ID归0,下面自动重新分配有效渠道
                    channelid = 0;
                }
            }

            if (channelid == 0)
            {
                //查询在线渠道列表,
                int totalcount  = 0;                                                                                 //在线数量
                var channellist = channeldata.GetChannelListByComid(comid, companyid, 2, out totalcount, channleid); //先查询渠道列表 锁定客户为空的

                if (channellist != null)
                {
                    if (totalcount > 0)
                    {
                        //随机选择一个渠道
                        Random rand           = new Random();
                        var    channel_temp   = channellist[rand.Next(0, totalcount - 1)];
                        var    channelid_temp = channel_temp.Id;

                        //绑定渠道
                        int upchannel = new MemberCardData().upCardcodeChannel(idcard.ToString(), channelid_temp);
                        channelid = channelid_temp;
                    }
                }
                //只有变更时才发送顾问信息
                Sendweixinchient(openid, comid);
            }
            else
            {
                //点击顾问也发送
                if (sendtype == 1)
                {
                    Sendweixinchient(openid, comid);
                }
            }
            return(int.Parse(channelid.ToString()));
        }
Exemple #3
0
        public string Servermobile = ""; //服务专员手机


        protected void Page_Load(object sender, EventArgs e)
        {
            openid     = Request["openid"];
            weixinpass = Request["weixinpass"];

            //如果SESSION有值,进行赋值
            if (openid != "" && Session["Openid"] != null)
            {
                openid = Session["Openid"].ToString();
            }



            //获得商户ID
            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();
            B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);

            if (companyinfo != null)
            {
                comid             = companyinfo.Com_id;
                Session["Com_id"] = comid;
            }


            //已登录直接跳转
            if (Session["AccountId"] != null)
            {
                AccountId = Int32.Parse(Session["AccountId"].ToString());
                B2bCrmData dateuser1 = new B2bCrmData();
                B2b_crm    modeluser = dateuser1.Readuser(AccountId, comid);

                if (modeluser != null)
                {
                    AccountWeixin = modeluser.Weixin;
                    AccountEmail  = modeluser.Email;
                    Accountphone  = modeluser.Phone;
                    AccountName   = modeluser.Name;
                    AccountCard   = modeluser.Idcard.ToString();
                    Servercard    = modeluser.Servercard;
                    Integral      = modeluser.Integral;
                    Imprest       = modeluser.Imprest;
                }

                //服务专员信息,服务专员ID
                if (Servercard != 0)
                {
                    MemberChannelData channeldate  = new MemberChannelData();
                    Member_Channel    channelmode2 = channeldate.GetChannelDetail(Int32.Parse(Servercard.ToString()));
                    if (channelmode2 != null)
                    {
                        Servername   = channelmode2.Name;
                        Servermobile = channelmode2.Mobile;
                    }
                }
            }
        }
Exemple #4
0
        public string errlog = "";//错误日志
        protected void Page_Load(object sender, EventArgs e)
        {
            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();

            try
            {
                //根据域名读取商户ID,如果没有绑定域名直接跳转后台
                if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
                {
                    //先通过正则表达式获取COMid
                    comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                    if (comid == 0)
                    {
                        comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                    }
                }
                else
                {
                    B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                    if (companyinfo != null)
                    {
                        comid = companyinfo.Com_id;
                    }
                }
            }
            catch
            {
                errlog += "1,";
            }
            //获取微信平台端code
            string weixincode = Request["code"].ConvertTo <string>("");

            string openid     = Request["openid"].ConvertTo <string>("");
            string weixinpass = Request["weixinpass"].ConvertTo <string>("");

            GetMemberCard(openid, weixincode, weixinpass, comid);//登陆或得到会员信息



            var channeldata = new MemberChannelData();//读取渠道信息
            //判断对 微信注册,网站注册渠道进行归0
            var channeltype = channeldata.GetChannelDetail(int.Parse(channelid.ToString()));

            if (channeltype != null)
            {
                if (channeltype.Issuetype == 3 || channeltype.Issuetype == 4)
                {//如果渠道时微信注册或网站注册,渠道ID归0,下面自动重新分配有效渠道
                    channelid = 0;
                }
            }


            //创建新的微信一次性密码
            var new_weixinpass = new B2bCrmData().WeixinGetPass(openid, comid);

            if (channelid > 0)
            {
                //获得渠道发行信息
                MemberChannelData channeldate  = new MemberChannelData();
                Member_Channel    channelmodel = channeldate.GetChannelDetail(channelid);

                if (channelmodel != null)
                {
                    //channelid = channelmodel.Id;
                    //channelphone = channelmodel.Mobile;
                    //RebateConsume = channelmodel.RebateConsume;
                    //RebateOpen = channelmodel.RebateOpen;
                    //Opencardnum = channelmodel.Opencardnum;
                    //Firstdealnum = channelmodel.Firstdealnum;
                    //Summoney = channelmodel.Summoney;

                    //根据渠道电话得到渠道对应的员工信息
                    B2b_company_manageuser userrr = new B2bCompanyManagerUserData().GetCompanyUserByPhone(channelmodel.Mobile, comid);
                    if (userrr != null)
                    {
                        Response.Redirect("http://shop" + comid + ".etown.cn/h5/people.aspx?MasterId=" + userrr.Id);
                    }
                }


                Response.Redirect("http://shop" + comid + ".etown.cn/h5/peoplelist.aspx");
            }
            else
            {
                Response.Redirect("http://shop" + comid + ".etown.cn/h5/peoplelist.aspx");
            }
        }
        public void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            id = Request["id"].ConvertTo <int>(0);
            string md5 = Request["md5"].ConvertTo <string>("");

            string Returnmd5 = EncryptionHelper.ToMD5(id.ToString() + "lixh1210", "UTF-8");


            var orderdata = new B2bOrderData();
            var orderinfo = orderdata.GetOrderById(id);

            if (orderinfo != null)
            {
                u_name = orderinfo.U_name;

                //判断登陆状态
                //if (Session["AccountId"] != null)
                //{
                //先判断Session
                //int AccountId = int.Parse(Session["AccountId"].ToString());

                if (Returnmd5 == md5)
                { //必须符合加密的才能打开
                    yuyuetime = orderinfo.U_traveldate.ToString("yyyy-MM-dd hh:mm:ss");
                    var prodata = new B2bComProData();
                    var proinfo = prodata.GetProById(orderinfo.Pro_id.ToString(), orderinfo.Speciid, orderinfo.channelcoachid);
                    if (proinfo != null)
                    {
                        Pro_name = proinfo.Pro_name;

                        var channelcoachid = orderinfo.channelcoachid;


                        var channeldata = new MemberChannelData();
                        var channelinfo = channeldata.GetChannelDetail(orderinfo.channelcoachid);

                        if (channelinfo != null)
                        {
                            bindiname = channelinfo.Name;
                            bindphone = channelinfo.Mobile;
                        }

                        var managedata = new B2bCompanyManagerUserData();
                        var manageinfo = managedata.GetCompanyUserByPhone(bindphone, proinfo.Com_id);
                        if (manageinfo != null)
                        {
                            bindimg = FileSerivce.GetImgUrl(manageinfo.Headimg);
                        }
                    }
                }
                //}
            }



            uid = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

            key = Request["key"].ConvertTo <string>("");

            if (key != "")
            {
                biaoti = key;
            }

            proclass = Request["class"].ConvertTo <int>(0);
            price    = Request["price"].ConvertTo <int>(0);



            if (proclass != 0)
            {
                var prodata = new B2bComProData();
                var result  = prodata.Proclassbyid(proclass);
                if (result != null)
                {
                    biaoti = result.Classname;
                }
            }

            //获取随机用户ID
            if (Request.Cookies["temp_userid"] != null)
            {
                userid = Request.Cookies["temp_userid"].Value;
            }
            else
            {
                userid = Domain_def.HuoQu_Temp_UserId();
                //Response.Cookies("userid").val();

                HttpCookie cookie = new HttpCookie("temp_userid");     //实例化HttpCookie类并添加值
                cookie.Value   = userid;
                cookie.Expires = DateTime.Now.AddDays(365);
                Response.Cookies.Add(cookie);
            }

            buyuid  = Request["buyuid"].ConvertTo <int>(0);
            tocomid = Request["tocomid"].ConvertTo <int>(0);


            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
            }
            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var domaincomid = B2bCompanyData.GetComId(RequestUrl);
                if (domaincomid != null)
                {
                    comid = domaincomid.Com_id;
                }
            }



            if (comid != 0)
            {
                //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中
                B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(comid);
                //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "b");
                if (model != null)
                {
                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "c");
                    //商家微信支付的所有参数都存在
                    if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                    {
                        //appId = model.Wx_appid;
                        //appsecret = model.Wx_appkey;
                        //appkey = model.Wx_paysignkey;
                        //mchid = model.Wx_partnerid;
                        //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "d");
                        issetfinancepaytype = true;
                    }
                }


                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                        weixinname     = commodel.B2bcompanyinfo.Weixinname;
                        Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                    }

                    title = commodel.Com_name;
                }


                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                }

                //获取微信平台端code
                string weixincode = Request["code"].ConvertTo <string>("");
                //获取微信号和一次性密码
                openid = Request["openid"].ConvertTo <string>("");
                string weixinpass = Request["weixinpass"].ConvertTo <string>("");

                //获得会员信息
                GetCrmInfo(weixincode, openid, weixinpass);
            }


            //获取BANNER,及logo
            if (comid != 0)
            {
                //根据公司id得到 直销设置
                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0));
                }
            }



            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
Exemple #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WxMaterialData Wx     = new WxMaterialData();
            WxMaterial     wmater = Wx.logGetidinfo(" SalePromoteTypeid !=4 order by operatime  desc ");

            int totalcount = 0;


            if (wmater != null)
            {
                Listtime = wmater.Operatime.ToString("yyyy-MM-dd");
            }


            ////判断如果是否为手机访问
            //if (detectmobilebrowser.HttpUserAgent(Request.ServerVariables["HTTP_USER_AGENT"]))
            //{
            //    if (Request["brow"]=="PC")//如果接收到传递PC访问则只PC版
            //    {
            //         Cookie.WriteCookie("Mobile_Brow_Set", "PC");
            //    }
            //
            //    //查看COOKIE 是否设定是否设定为PC
            //    if (Cookie.GetCookie("Mobile_Brow_Set") == "PC")
            //    {
            //    }
            //    else
            //    {
            //          Response.Redirect("/M/Default.aspx?brow=MO");
            //    }
            //}

            if (Session["AccountId"] != null)
            {
                //账户信息
                AccountId   = Int32.Parse(Session["AccountId"].ToString());
                AccountName = Session["AccountName"].ToString();
                AccountCard = Session["AccountCard"].ToString();
                RequestUrl  = Request.ServerVariables["SERVER_NAME"].ToLower();

                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }

                if (comid != 101)
                {
                    Response.Redirect("/ui/shangjiaui/ProductList.aspx");
                }


                //会员信息
                B2bCrmData dateuser  = new B2bCrmData();
                B2b_crm    modeluser = dateuser.Readuser(AccountId, comid);

                if (modeluser != null)
                {
                    AccountWeixin = modeluser.Weixin;
                    AccountEmail  = modeluser.Email;
                    Accountphone  = modeluser.Phone;
                    Servercard    = modeluser.Servercard;
                    Imprest       = modeluser.Imprest;
                    Integral      = modeluser.Integral;
                    //密码
                    AccountPass = modeluser.Password1;
                    //微信关注
                    weixin = modeluser.Weixin == "" ? "未关注" : "已关注";
                }

                //渠道
                MemberChannelData channeldate = new MemberChannelData();

                //渠道信息
                Member_Channel channelmodel = channeldate.GetSelfChannelDetailByCardNo(AccountCard);
                if (channelmodel != null)
                {
                    channeltype = 1;
                    channelid   = channelmodel.Id;

                    RebateConsume = channelmodel.RebateConsume;
                    RebateOpen    = channelmodel.RebateOpen;
                    Opencardnum   = channelmodel.Opencardnum;
                    Firstdealnum  = channelmodel.Firstdealnum;
                    Summoney      = channelmodel.Summoney;
                }


                //服务专员信息,服务专员ID
                if (Servercard != 0)
                {
                    Member_Channel channelmode2 = channeldate.GetChannelDetail(Int32.Parse(Servercard.ToString()));
                    if (channelmode2 != null)
                    {
                        Servername   = channelmode2.Name;
                        Servermobile = channelmode2.Mobile;
                    }
                }

                //菜单项new WxSalePromoteTypeData()
                List <WxSalePromoteType> menulist = new WxSalePromoteTypeData().GetAllWxMaterialType(comid, out totalcount);

                if (comid == 101)
                {
                    List <WxSalePromoteType> list = new List <WxSalePromoteType>();
                    int[] i = { 0, 1, 2, 5, 12 };
                    foreach (int s in i)
                    {
                        WxSalePromoteType wxmaterial = new WxSalePromoteType();

                        wxmaterial.Id       = menulist[s].Id;
                        wxmaterial.Typename = menulist[s].Typename;
                        list.Add(wxmaterial);
                    }

                    menu.DataSource = list;
                    menu.DataBind();
                }
                else
                {
                    menu.DataSource = menulist;
                    menu.DataBind();
                }
            }
            else
            {
                Response.Redirect("/V/card.aspx");
            }
        }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["AccountId"] != null)
            {
                WxMaterialData Wx     = new WxMaterialData();
                WxMaterial     wmater = Wx.logGetidinfo(" SalePromoteTypeid !=4 order by operatime  desc ");

                int totalcount = 0;


                if (wmater != null)
                {
                    Listtime = wmater.Operatime.ToString("yyyy-MM-dd");
                }

                //账户信息
                AccountId   = Int32.Parse(Session["AccountId"].ToString());
                AccountName = Session["AccountName"].ToString();
                AccountCard = Session["AccountCard"].ToString();
                RequestUrl  = Request.ServerVariables["SERVER_NAME"].ToLower();

                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }

                //会员信息
                B2bCrmData dateuser  = new B2bCrmData();
                B2b_crm    modeluser = dateuser.Readuser(AccountId, comid);

                if (modeluser != null)
                {
                    AccountWeixin = modeluser.Weixin;
                    AccountEmail  = modeluser.Email;
                    Accountphone  = modeluser.Phone;
                    Servercard    = modeluser.Servercard;
                    Imprest       = modeluser.Imprest;
                    Integral      = modeluser.Integral;
                    //密码
                    AccountPass = modeluser.Password1;
                    //微信关注
                    weixin = modeluser.Weixin == "" ? "未关注" : "已关注";
                }

                //渠道
                MemberChannelData channeldate = new MemberChannelData();

                //渠道信息
                Member_Channel channelmodel = channeldate.GetSelfChannelDetailByCardNo(AccountCard);
                if (channelmodel != null)
                {
                    channeltype = 1;
                    channelid   = channelmodel.Id;

                    RebateConsume = channelmodel.RebateConsume;
                    RebateOpen    = channelmodel.RebateOpen;
                    Opencardnum   = channelmodel.Opencardnum;
                    Firstdealnum  = channelmodel.Firstdealnum;
                    Summoney      = channelmodel.Summoney;
                }


                //服务专员信息,服务专员ID
                if (Servercard != 0)
                {
                    Member_Channel channelmode2 = channeldate.GetChannelDetail(Int32.Parse(Servercard.ToString()));
                    if (channelmode2 != null)
                    {
                        Servername   = channelmode2.Name;
                        Servermobile = channelmode2.Mobile;
                    }
                }

                ////菜单项new WxSalePromoteTypeData()
                //List<WxSalePromoteType> menulist = new WxSalePromoteTypeData().GetAllWxMaterialType(comid, out totalcount);

                //菜单项new WxSalePromoteTypeData()
                List <WxSalePromoteType> menulist = new WxSalePromoteTypeData().GetRecommendWxMaterialType(comid, out totalcount);

                if (comid == 101)
                {
                    List <WxSalePromoteType> list = new List <WxSalePromoteType>();
                    int[] i = { 0, 1, 2, 5, 12 };
                    foreach (int s in i)
                    {
                        WxSalePromoteType wxmaterial = new WxSalePromoteType();

                        wxmaterial.Id       = menulist[s].Id;
                        wxmaterial.Typename = menulist[s].Typename;
                        list.Add(wxmaterial);
                    }

                    menu.DataSource = list;
                    menu.DataBind();
                }
                else
                {
                    menu.DataSource = menulist;
                    menu.DataBind();
                }

                //得到微信会员卡说明和使用门店说明
                int ttcount = 0;
                mcMaterilList = new MemberShipCardMaterialData().GetMCMateralListByComId(comid, out ttcount);
            }
            else
            {
                Response.Redirect("/byts/login.aspx");
            }
        }
Exemple #8
0
        //给客户发送顾问的信息
        public static void Sendweixinchient(string openid, int comid)
        {
            WeiXinBasic basic = new WeiXinBasicData().GetWxBasicByComId(comid);


            string company     = "";
            string channelname = "";
            string name        = "";

            WxMessageLogData messagelogdata = new WxMessageLogData();
            //var messageinfo = messagelogdata.GetWxMessageLogSendTime(comid, openid);//查询2小时内是否给渠道发送过消息

            //if (messageinfo == 0)
            //{

            //会员
            MemberCardData carddata = new MemberCardData();
            var            userdata = new B2bCrmData();

            var userinfo = userdata.GetB2bCrm(openid, comid);

            if (userinfo != null)
            {
                name = userinfo.Name;
            }

            var cardinfo = carddata.GetMemberCardByOpenId(openid);

            if (cardinfo != null)
            {
                //获取渠道
                var channeldata = new MemberChannelData();
                var channelinfo = channeldata.GetChannelDetail(int.Parse(cardinfo.IssueCard.ToString()));
                if (channelinfo != null)
                {
                    channelname = channelinfo.Name; //渠道名称

                    if (channelinfo.Companyid == 0) //内部渠道
                    {
                        B2bCompanyData comdata = new B2bCompanyData();
                        var            cominfo = comdata.GetCompanyBasicById(comid);
                        if (cominfo != null)
                        {
                            company = cominfo.Com_name;
                        }
                    }
                    else
                    { //外部合作单位,调取合作单位名称
                        var channelcompanydata = new MemberChannelcompanyData();
                        var channelcominfo     = channelcompanydata.GetChannelCompany(channelinfo.Companyid.ToString());
                        if (channelcominfo != null)
                        {
                            company = channelcominfo.Companyname;
                        }
                    }
                }
            }


            if (channelname != "" && channelname != "默认渠道" && channelname != "微信注册" && channelname != "网站注册")
            {
                //微信客服 文本消息
                string data = SendWxMsg(comid, openid, 1, "", name + "你好,我是您的服务顾问" + company + "的 " + channelname + "  ,\n请直接在微信上给我语音或文字留言,我会在手机微信上看到留言并很快回复。您不信? 现在就试试…", "", basic.Weixinno);

                //微信模板消息
                new Weixin_tmplmsgManage().WxTmplMsg_SubscribeActReward(comid, openid, name + "你好,我是您的服务顾问" + company + "的 " + channelname + "  , \\n请直接在微信上给我语音或文字留言,我会在手机微信上看到留言并很快回复。您不信? 现在就试试…\\n", "向《我的服务顾问:" + channelname + "》微信咨询", DateTime.Now.ToString(), "");
                WxMessageLog messagelog = new WxMessageLog();
                messagelog.Comid  = comid;
                messagelog.Weixin = openid;
                var messageedit = messagelogdata.EditWxMessageLog(messagelog);//插入日志

                //顾问录入的 问候语音
                int isreplymediasuc = 0;//发送语音消息状态:0失败;1成功

                WXAccessToken m_accesstoken = WeiXinManage.GetAccessToken(basic.Comid, basic.AppId, basic.AppSecret);
                //根据用户微信得到其顾问微信,然后根据微信和标记得到最新的一条保存路径(注:已经上传过语音的即mediaid!="")
                Wxmedia_updownlog udlog = new Wxmedia_updownlogData().GetWxmedia_updownlog(openid, (int)Clientuptypemark.DownGreetVoice, basic.Comid);
                if (udlog == null)
                {
                    isreplymediasuc = 0;
                }
                else
                {
                    string media_id = new WxUploadDownManage().UploadMultimedia(m_accesstoken.ACCESS_TOKEN, "voice", udlog.savepath);
                    if (media_id != "")
                    {
                        Wxmedia_updownlog uplog = new Wxmedia_updownlog
                        {
                            id               = 0,
                            mediaid          = media_id,
                            mediatype        = "voice",
                            savepath         = udlog.savepath,
                            created_at       = ConvertDateTimeInt(DateTime.Now).ToString(),
                            createtime       = DateTime.Now,
                            opertype         = "up",
                            operweixin       = openid,
                            clientuptypemark = (int)Clientuptypemark.DownGreetVoice,//上传多媒体信息
                            comid            = basic.Comid,
                            relativepath     = udlog.relativepath,
                            txtcontent       = "",
                            isfinish         = 1
                        };
                        int uplogresult = new Wxmedia_updownlogData().Edituploadlog(uplog);
                        if (uplogresult == 0)
                        {
                            isreplymediasuc = 0;
                        }
                        else
                        {
                            //resxml = "<xml><ToUserName><![CDATA[" + requestXML.FromUserName + "]]></ToUserName><FromUserName><![CDATA[" + requestXML.ToUserName + "]]></FromUserName><CreateTime>" + ConvertDateTimeInt(DateTime.Now) + "</CreateTime><MsgType><![CDATA[voice]]></MsgType><Voice><MediaId><![CDATA[" + media_id + "]]></MediaId></Voice></xml>";
                            isreplymediasuc = 1;
                            SendWxMsg(comid, openid, 2, "", "", media_id, basic.Weixinno);
                        }
                    }
                    else
                    {
                        isreplymediasuc = 0;
                    }
                }

                ////如果发送语音失败,则发送客服消息
                //if (isreplymediasuc == 0)
                //{
                //}
            }
            //}
        }