Esempio n. 1
0
        public int isrightwxset = 1;  //微信接口设置信息是否正确
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            MasterId = Request["MasterId"].ConvertTo <int>(0);
            come     = Request["come"].ConvertTo <string>("");
            B2b_company_manageuser manageruser = B2bCompanyManagerUserData.GetUser(MasterId);

            if (manageruser != null)
            {
                MasterId = manageruser.Id;

                MasterName  = manageruser.Employeename;
                CompanyName = B2bCompanyData.GetCompanyByUid(manageruser.Id).Com_name;
                Tel         = manageruser.Tel;
                Viewtel     = manageruser.Viewtel;
                comid       = manageruser.Com_id;
                B2bCrmData crmdata  = new B2bCrmData();
                var        crmmodel = crmdata.GetB2bCrmByPhone(manageruser.Com_id, Tel);
                if (crmmodel != null)
                {
                    if (crmmodel.Weixin != "")
                    {
                        zaixianzhuangtai = "我在线上";
                        guwenweixin      = crmmodel.Weixin;
                    }
                    else
                    {
                        zaixianzhuangtai = "未在线";
                    }
                }

                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    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));
                    }
                }



                ChannelCompanyId = manageruser.Channelcompanyid;
                ChannelCompany   = new MemberChannelcompanyData().GetCompanyById(manageruser.Channelcompanyid.ToString().ConvertTo <int>(0));

                if (ChannelCompany != null)
                {
                    ChannelCompanyName = ChannelCompany.Companyname;
                }

                //获取渠道ID
                MemberChannelData channeldata = new MemberChannelData();
                var channelmodel = channeldata.GetPhoneComIdChannelDetail(Tel, comid);
                if (channelmodel != null)
                {
                    channelid = channelmodel.Id;
                }



                Channelsource = manageruser.Channelsource;
                CreateUserId  = manageruser.Createuserid;
                EmployeState  = manageruser.Employeestate;
                Job           = manageruser.Job;
                Selfbrief     = manageruser.Selfbrief;
                if (Selfbrief != "" && Selfbrief != null)
                {
                    if (Selfbrief.Length > 21)
                    {
                        Selfbrief = Selfbrief.Substring(0, 21) + "...";
                    }
                }


                //Headimg=manageruser.Headimg;
                Headimgurl   = FileSerivce.GetImgUrl(manageruser.Headimg);
                Workingyears = manageruser.Workingyears;
                Workdays     = manageruser.Workdays;

                WorkdaysView = crmdata.WorkDay(Workdays);//判断是否在工作日内,1为在,0为不在



                Workdaystime           = manageruser.Workdaystime;
                Workendtime            = manageruser.Workendtime;
                Fixphone               = manageruser.Fixphone;
                Email                  = manageruser.Email;
                Homepage               = manageruser.Homepage;
                Weibopage              = manageruser.Weibopage;
                QQ                     = manageruser.QQ;
                Weixin                 = manageruser.Weixin;
                Selfhomepage_qrcordurl = manageruser.Selfhomepage_qrcordurl;

                //获取公司信息(微信连接地址)
                cominfo = B2bCompanyData.GetAllComMsg(comid);
                if (cominfo != null)
                {
                    linkguanzhu = cominfo.B2bcompanyinfo.Wxfocus_url;
                    author      = cominfo.B2bcompanyinfo.Wxfocus_author;
                }

                //导航
                var imagedata  = new B2bCompanyMenuData();
                int totalcount = 0;

                List <B2b_company_menu> list = imagedata.GetconsultantList(manageruser.Com_id, 1, 10, out totalcount);
                if (list != null)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        var imageurl = FileSerivce.GetImgUrl(list[i].Imgurl);



                        if (firstmenuid == 0)
                        {
                            firstdaohang = list[i].Linktype;
                            firstmenuid  = list[i].Id;
                            isoutpro     = list[i].Outdata;
                        }
                        if (daohang_html == "")
                        {
                            daohang_html += "<li class=\"curr\" menu-id=\"" + list[i].Id + "\"  data-id=\"" + list[i].Linktype + "\"  data-isoutpro=\"" + list[i].Outdata + "\"><!--<img src=\"" + imageurl + "\" height=\"60px\">--><span>" + list[i].Name + "</span></li>";
                        }
                        else
                        {
                            daohang_html += "<li class=\"\" menu-id=\"" + list[i].Id + "\"  data-id=\"" + list[i].Linktype + "\"   data-isoutpro=\"" + list[i].Outdata + "\"><!--<img src=\"" + imageurl + "\" height=\"60px\">--><span>" + list[i].Name + "</span></li>";
                        }
                        //daohang_Imgurl_address = FileSerivce.GetImgUrl(list.Imgurl);
                        //daohang_Imgurl = list.Imgurl;
                        ///daohang_Linkurl = list.Linkurl;
                        //daohang_Name = list.Name;
                        //daohang_Fonticon = list.Fonticon;
                    }
                }
            }
            ;


            //获取微信平台端code
            string weixincode = Request["code"].ConvertTo <string>("");

            if (weixincode != "")
            {
                int questtype = 2;//1=微信授权验证
                DealUserinfo1("", weixincode, comid, questtype);
            }
            else
            {
                string openid     = Request["openid"].ConvertTo <string>("");
                string weixinpass = Request["weixinpass"].ConvertTo <string>("");
                int    questtype  = 1;                               //1=一次性密码验证
                DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的)
            }



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


            #region  微信语音播放接口会用到
            string url = Request.Url.ToString();

            //根据传入参数openid、comid 得到 access_token、jsapi_ticket、noncestr、timestamp、 url(当前网页的URL,不包含#及其后面部分)
            WeiXinBasic basic = new WeiXinBasicData().GetWxBasicByComId(comid);
            if (basic != null)
            {
                appId     = basic.AppId;
                timestamp = new WeixinVoiceUtil().CreatenTimestamp();
                nonceStr  = new WeixinVoiceUtil().CreatenNonce_str();

                WXAccessToken maccesstoken = new WeixinVoiceUtil().GetAccessToken(comid, basic.AppId, basic.AppSecret);
                if (maccesstoken != null)
                {
                    string jsapi_ticket = new WeixinVoiceUtil().GetTickect(maccesstoken.ACCESS_TOKEN, comid);
                    if (jsapi_ticket == "")
                    {
                        isrightwxset = 0;
                    }
                    else
                    {
                        string beforesha1_signature = "";
                        signature = new WeixinVoiceUtil().GetSignature(jsapi_ticket, nonceStr, timestamp, url, out beforesha1_signature);
                    }
                }
                else
                {
                    isrightwxset = 0;
                }
            }
            else
            {
                isrightwxset = 0;
            }
            #endregion
        }