public void loadinfo(string open_id)
        {
            Maticsoft.BLL.weixin            wx_bll = new BLL.weixin();
            Maticsoft.Model.weixin_userinfo wx_mod = new Model.weixin_userinfo();
            wx_mod = wx_bll.get_userinfo(open_id, wx_bll.get_accesstoken())[0];
            Maticsoft.BLL.member mem_b = new BLL.member();
            string name = mem_b.get_name(open_id);

            if (name != null && name != "空")
            {
                huanyingci.Text   = "您好," + name + "(" + wx_mod.nickname + "),欢迎进入温氏培训系统测试版";
                touxiang.ImageUrl = wx_mod.headimgurl;
            }
            else
            {
                Response.Write(@"<script>alert('无法获取您的培训信息,返回首页');window.location='m_weixin\index.aspx'</script>");
            }
        }
Beispiel #2
0
        public void loaddata1()
        {
            if (Session["userinfo"] == null)
            {
                code = Request.QueryString["code"];
                if (string.IsNullOrEmpty(code))
                {
                    Response.Write("<script>alert('请从微信端登陆系统!')</script>");
                }
                else
                {
                    Response.Write("<script>alert('感谢您进入温氏学院系统!')</script>");
                    Maticsoft.BLL.weixin             wx_bll  = new BLL.weixin();
                    Maticsoft.Model.access_web_token awt_mod = new Model.access_web_token();
                    awt_mod = wx_bll.get_web_accesstoken(code)[0];
                    if (awt_mod == null || string.IsNullOrEmpty(awt_mod.openid))
                    {
                        Response.Write("<script>alert('无法获取你的识别号!')</script>");
                    }
                    else
                    {
                        string opend_id     = awt_mod.openid;
                        string accesstonken = awt_mod.access_token;
                        Maticsoft.Model.weixin_userinfo wx_u_mod = wx_bll.get_userinfo(opend_id, accesstonken)[0];

                        if (wx_u_mod == null)
                        {
                            Response.Write("<script>alert('无法获取你的微信信息!')</script>");
                        }
                        else
                        {
                            openid.Text         = "您好," + wx_u_mod.remark + "(" + wx_u_mod.nickname + "),欢迎进入温氏学院测试系统";
                            touxiang.ImageUrl   = wx_u_mod.headimgurl;
                            Session["userinfo"] = wx_u_mod;
                            //if(string.IsNullOrEmpty(wx_u_mod.remark))
                            //{
                            //    Response.Write("<script>alert('请录入个人信息');window.location='mem_info_fill.aspx'</script>");
                            //}
                        }
                    }
                }
            }
            else
            {
                Maticsoft.Model.weixin_userinfo wx_u_mod = (Maticsoft.Model.weixin_userinfo)Session["userinfo"];
                Maticsoft.BLL.member            mem_bll  = new BLL.member();
                wx_u_mod.remark     = mem_bll.get_name(wx_u_mod.openid);
                openid.Text         = "您好," + wx_u_mod.remark + "(" + wx_u_mod.nickname + "),欢迎进入温氏学院测试系统";
                touxiang.ImageUrl   = wx_u_mod.headimgurl;
                Session["userinfo"] = wx_u_mod;
            }
            // code = Request.QueryString["code"];
            // //WebClient requestClinet1 = new WebClient();
            // //string jsonArray1 = requestClinet1.DownloadString("https://api.weixin.qq.com/sns/oauth2/access_token?appid=zheshiyigejiadeid&secret=zhendemimazaibendibaocun&code=" + code + "&grant_type=authorization_code");


            // Maticsoft.BLL.weixin wx_bll = new BLL.weixin();

            // Maticsoft.Model.access_web_token awt_mod = new Model.access_web_token();
            // awt_mod = wx_bll.get_web_accesstoken(code)[0];
            //string  opend_id=  awt_mod.openid;
            // string accesstonken=awt_mod.access_token;
            //Literal1.Text = code + "色打发士大夫大师傅个" +opend_id+"士大夫士大夫" +accesstonken;
            //Maticsoft.Model.weixin_userinfo wx_u_mod = wx_bll.get_userinfo(opend_id, accesstonken)[0];
            //openid.Text = wx_u_mod.nickname;
            //touxiang.ImageUrl = wx_u_mod.headimgurl;
        }