コード例 #1
0
        public ActionResult GxFreelanceWxLogin()
        {
            GetUserInfoDal getuserinfodal = new GetUserInfoDal();
            string         openid         = CookieHelper.GetCookieValue("openid");
            string         user_id        = getuserinfodal.GetUserID(openid);
            string         user_name      = getuserinfodal.GetUserName(user_id);
            string         membership     = getuserinfodal.GetMemberType(user_id);

            if (membership == "个人会员")
            {
                if (user_name == "")//信息未完善
                {
                    //System.Web.HttpContext.Current.Response.Write("<script language=javascript>alert(\"请先完善会员信息\")" + "</script>");
                    return(View("GxFreelanceWxPersonal"));
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                System.Web.HttpContext.Current.Response.Write("<script language=javascript>alert(\"企业会员,无法注册\");window.location.href = \"GxFreelanceWxClassification\" ;</script>");
                //System.Web.HttpContext.Current.Response.Redirect("~/Home/GxFreelanceWxClassification");
                //return View("GxFreelanceWxClassification");
                return(View());
            }
        }
コード例 #2
0
        public ActionResult GxfaWxIndex(string openid)
        {
            /////获取openid
            if (openid == null)
            {
                ////openid = "oXx_Mw7JSzz218WpGTprNfSaHC7k";//鹏伟峰
                openid = "oXx_Mw-hx0yNF3wIELsf_RP6cJoA";//我的
                string user_id    = getuserinfodal.GetUserID(openid);
                string membership = getuserinfodal.GetMemberType(user_id);
                string username   = getuserinfodal.GetUserName(user_id, membership);
                CookieHelper.ClearCookie("openid");
                CookieHelper.SetCookie("openid", openid);
                Session["user_id"]   = user_id;
                Session["user_name"] = username;
                string url1 = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;//获取当前url端木雲 2018/3/26 21:22:46
                string url2 = "http://egov.jinyuc.com/gxdzwx/gxdzwxlogin/?openid= " + openid + "&url1=" + url1;
                Session["RegisterUrl"] = url2;
                Session["url"]         = url2;
                string url3 = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;//获取当前url端木雲 2018/3/26 21:22:46
                string url4 = "http://egov.jinyuc.com/gxdzwx/gxdzwxlogin/Register/GxLoginRegisterPersonal/?openid= " + openid + "&url1=" + url3;
                Session["FinishRegisterUrl"] = url4;
                ViewBag.openid = openid;
            }
            else
            {
                ViewBag.openid = openid;
                CookieHelper.ClearCookie("openid");
                CookieHelper.SetCookie("openid", openid);
                string url1 = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;//获取当前url端木雲 2018/3/26 21:22:46
                string url2 = "http://egov.jinyuc.com/gxdzwx/gxdzwxlogin/?openid= " + openid + "&url1=" + url1;
                Session["url"] = url2;
                string user_id = getuserinfodal.GetUserID(openid);
                if (user_id == "none")
                {
                }
                Session["user_id"]   = user_id;
                Session["user_name"] = user_id;

                //Session["user_id"] = "70";
                //Session["user_name"] = "70";
            }
            return(View());
        }
コード例 #3
0
        //判断是否会员登录
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        //public string isOrNotUser()
        {
            GetUserInfoDal getuserinfodal = new GetUserInfoDal();

            //string responseText = "";
            try
            {
                string openid = CookieHelper.GetCookieValue("openid");

                if (openid == null)
                {
                    //未取到openid
                }
                else
                {
                    string url1     = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;                                                            //获取当前url端木雲 2018/3/26 21:22:46
                    string url2     = "http://egov.jinyuc.com/gxdzwx/gxdzwxlogin/?openid= " + openid + "&url1=" + url1;                                  //登录界面
                    string url3     = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;                                                            //获取当前url端木雲 2018/3/26 21:22:46
                    string url4     = "http://egov.jinyuc.com/gxdzwx/gxdzwxlogin/Register/GxLoginRegisterPersonal/?openid= " + openid + "&url1=" + url3; //完善信息界面
                    string user_id  = getuserinfodal.GetUserID(openid);
                    string username = getuserinfodal.GetUserName(user_id);
                    if (user_id == "none")//如果没有注册
                    {
                        //System.Web.HttpContext.Current.Response.Write("<script language=javascript>location.replace("+url2+")" + "</script>");
                        //System.Web.HttpContext.Current.Response.Write("window.parent.location.href=" + url2 + "</script>");
                        System.Web.HttpContext.Current.Response.Redirect(url2);
                    }
                    else
                    {
                        string login_flag = CookieHelper.GetCookieValue("login_flag");
                        if (login_flag != "1")
                        {
                            //非会员,跳转登陆页面
                            System.Web.HttpContext.Current.Response.Redirect(url2);
                        }
                    }
                }
            }
            catch
            {
            }
        }