示例#1
0
 /// <summary>
 /// 页面加载
 /// </summary>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack)
     {
         return;
     }
     if ((Typeid != 81 && Typeid != 82) || Gameid <= 0)
     {
         Response.Redirect("/404.html");
         return;
     }
     if (string.IsNullOrEmpty(Wxparam))
     {
         string param = Typeid == 82
             ? $"/Mobile/WxRegister.aspx?t=82&g={Gameid}&r={Roomid}&k={Kindid}&a={Action}&p={Password}"
             : "/Mobile/WxRegister.aspx?t=81&g=" + Gameid;
         if (!string.IsNullOrEmpty(PlatformType))
         {
             param += $"&y={PlatformType}";
         }
         Response.Redirect(AppConfig.AuthorizeURL + "?url=" + Server.UrlEncode(param));
     }
     else
     {
         WxUser wu = Fetch.GetWxUser(Wxparam);
         if (wu == null)
         {
             Response.Redirect("/404.html");
             return;
         }
         AccountsInfo info = FacadeManage.aideAccountsFacade.GetAccountsInfoByUserUin(wu.unionid);
         if (info == null)
         {
             //注册帐号
             UserInfo user = new UserInfo
             {
                 NickName   = wu.nickname,
                 Gender     = wu.sex,
                 RegisterIP = GameRequest.GetUserIP(),
                 GameID     = Gameid,
                 UserUin    = wu.unionid
             };
             FacadeManage.aideAccountsFacade.RegisterWX(user, Typeid, wu.headimgurl);
         }
         string redirect;
         if (PlatformType == "h5")
         {
             string     wxParam = $"<{wu.openid}>,<{wu.unionid}>,<{wu.nickname}>,<{wu.sex}>,<{wu.headimgurl}>";
             ConfigInfo webCfg  = Fetch.GetWebSiteConfig();
             string     w       = Server.UrlEncode(Fetch.AESEncrypt(wxParam, AppConfig.WxH5Key,
                                                                    AppConfig.WxH5Key));
             string baseUrl = webCfg?.Field4 ?? "/h5/";
             baseUrl += Kindid == 200 ? "land" : "sixoxx";
             redirect = baseUrl + (Typeid == 82
                 ? $"/?w={w}&r={Roomid}&a={Action}&p={Password}"
                 : $"/?w={w}");
         }
         else
         {
             redirect = Typeid == 82
                 ? "/Mobile/RoomLink.aspx?" +
                        $"s=already&g={Gameid}&r={Roomid}&k={Kindid}&a={Action}&p={Password}"
                 : $"/Mobile/ShareLink.aspx?s=already&g={Gameid}";
         }
         Response.Redirect(redirect);
     }
 }
示例#2
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            if ((Typeid != 81 && Typeid != 82 && Typeid != 83 && Typeid != 84) || Gameid <= 0)
            {
                Response.Redirect("/404.html");
                return;
            }


            string userAgent = Request.UserAgent;
            bool   IsWeiXin  = false;

            if (userAgent.ToLower().Contains("micromessenger"))
            {
                IsWeiXin = true;
            }
            else
            {
                IsWeiXin = false;
            }

            //获取公众号配置
            string appid = AppConfig.GetSetting("WXNATIVEAPPID");


            if (string.IsNullOrEmpty(Wxparam) && IsWeiXin && !string.IsNullOrEmpty(appid))
            {
                string path = Typeid == 82
                    ? $"/Mobile/WxRegister.aspx?t=82&g={Gameid}&gr={Groupid}&r={Roomid}&k={Kindid}&a={Action}&p={Password}"
                    : "/Mobile/WxRegister.aspx?t=81&g=" + Gameid;
                if (Typeid == 83)
                {
                    path = "/Mobile/WxRegister.aspx?t=83&g=" + Gameid;
                }
                else if (Typeid == 84)
                {
                    path = "/Mobile/WxRegister.aspx?t=84&g=" + Gameid;
                }

                string param = $"http://{AppConfig.GetSetting("FrontSiteDomain")}{path}";
                if (!string.IsNullOrEmpty(PlatformType))
                {
                    param += $"&y={PlatformType}";
                    //                    TextLogger.Write($"HAuthorizeUrl:{AppConfig.HAuthorizeURL}?url={Server.UrlEncode(param)}");
                    //                    Response.Redirect($"{AppConfig.HAuthorizeURL}?url={Server.UrlEncode(param)}");
                    //                    return;
                }
                Response.Redirect($"{AppConfig.AuthorizeURL}?url={Server.UrlEncode(param)}");
            }
            else if (!string.IsNullOrEmpty(Wxparam) && IsWeiXin && !string.IsNullOrEmpty(appid))
            {
                WxUser wu = Fetch.GetWxUser(Wxparam);
                if (wu == null)
                {
                    Log4Net.WriteInfoLog("获取不到微信信息,Gameid" + Gameid);
                    Response.Redirect("/404.html");
                    return;
                }
                AccountsInfo info = FacadeManage.aideAccountsFacade.GetAccountsInfoByUserUin(wu.unionid);
                if (info == null)
                {
                    //注册帐号
                    UserInfo user = new UserInfo
                    {
                        NickName   = wu.nickname,
                        Gender     = wu.sex,
                        RegisterIP = GameRequest.GetUserIP(),
                        GameID     = Gameid,
                        UserUin    = wu.unionid
                    };
                    FacadeManage.aideAccountsFacade.RegisterWX(user, Typeid, wu.headimgurl);
                }
                else if (info.SpreaderID == 0 && info.AgentID == 0)
                {
                    AccountsInfo infos = FacadeManage.aideAccountsFacade.GetAccountsInfoByGameID(Gameid);
                    if (infos != null && infos.AgentID > 0)
                    {
                        Message mesg = new Message();
                        mesg = FacadeManage.aideAgentFacade.UserAgentBind(info.UserID, infos.GameID, GameRequest.GetUserIP());
                    }
                }


                string redirect;
                if (PlatformType == "h5")
                {
                    string     wxParam = $"<{wu.openid}>,<{wu.unionid}>,<{wu.nickname}>,<{wu.sex}>,<{wu.headimgurl}>";
                    ConfigInfo webCfg  = Fetch.GetWebSiteConfig();
                    string     w       = Server.UrlEncode(Fetch.AESEncrypt(wxParam, AppConfig.WxH5Key,
                                                                           AppConfig.WxH5Key));
                    string baseUrl = "/h5/";
                    if (Typeid == 82)
                    {
                        switch (Kindid)
                        {
                        case 200:
                            baseUrl += "land";
                            break;

                        case 50:
                            baseUrl += "oxsixx";
                            break;

                        case 122:
                            baseUrl += "baccarat";
                            break;

                        case 33:
                            baseUrl += "sangong";
                            break;

                        case 391:
                            baseUrl += "sparrowgdex";
                            break;

                        case 51:
                            baseUrl += "thirteenzj";
                            break;

                        case 6:
                            baseUrl += "zhajinhua";
                            break;

                        case 302:
                            baseUrl += "bloodWar";
                            break;

                        case 390:
                            baseUrl += "sparrowhz";
                            break;

                        case 57:
                            baseUrl += "oxeight";
                            break;

                        case 56:
                            baseUrl += "fksanzhang";
                            break;

                        case 14:
                            baseUrl += "paiGow";
                            break;

                        case 242:
                            baseUrl += "pushBobbin";
                            break;

                        case 389:
                            baseUrl += "sparrowhz";
                            break;

                        default:
                            baseUrl += "hall";
                            break;
                        }
                    }
                    else
                    {
                        baseUrl += "hall";
                    }
                    redirect = baseUrl + (Typeid == 82
                                   ? $"/?w={w}&r={Roomid}&a={Action}&p={Password}"
                                   : $"/?w={w}");
                }
                else
                {
                    redirect = Typeid == 82
                        ? "/Mobile/RoomLink.aspx?" +
                               $"s=already&g={Gameid}&r={Roomid}&gr={Groupid}&k={Kindid}&a={Action}&p={Password}&y={PlatformType}"
                        : $"/Mobile/ShareLinkNew.aspx?s=already&g={Gameid}&y={PlatformType}";

                    if (Typeid == 83)
                    {
                        redirect = $"/Mobile/AgentShareLink.aspx?s=already&g={Gameid}&y={PlatformType}";
                    }
                    else if (Typeid == 84)
                    {
                        redirect = $"/Mobile/AgentShareLinkLua.aspx?s=already&g={Gameid}";
                    }
                }
                Response.Redirect(redirect);
            }
            else
            {
                //保存IP绑定信息
                string UserIP = GameRequest.GetUserIP();
                int    result = FacadeManage.aideAccountsFacade.UserIPBind(UserIP, Gameid);

                string redirectUrl = "";
                redirectUrl = Typeid == 82
                    ? "/Mobile/RoomLink.aspx?" +
                              $"s=already&g={Gameid}&r={Roomid}&gr={Groupid}&k={Kindid}&a={Action}&p={Password}&y={PlatformType}"
                    : $"/Mobile/ShareLinkNew.aspx?s=already&g={Gameid}&y={PlatformType}";

                if (Typeid == 83)
                {
                    redirectUrl = $"/Mobile/AgentShareLink.aspx?s=already&g={Gameid}";
                }
                else if (Typeid == 84)
                {
                    redirectUrl = $"/Mobile/AgentShareLinkLua.aspx?s=already&g={Gameid}";
                }
                Response.Redirect(redirectUrl);
            }
        }
示例#3
0
        /// <summary>
        /// 页面加载(微信授权-H5使用)
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            if (AppConfig.Mode == AppConfig.CodeMode.Dev)
            {
                #region 内部测试

                string unionid    = "59C6CEA7FBAB5A19C3177E1216BBACF6";
                string nickname   = "网站47033";
                string headimgurl =
                    "http://wx.qlogo.cn/mmopen/ajNVdqHZLLAMfyaTEB7juwPCNXBEC5SNBkgUgLuQjeu8bgcsiaEM77Y1F83qb05w0UjGJkVCqqgrs1EWic1Pmn5LjYYKJxSgRwwXz7iaxia6to0/0";

                string wxParam = $"<{unionid}>,<{unionid}>,<{nickname}>,<{1}>,<{headimgurl}>";

                string url = "http://172.16.0.211:6566/develop/majiang/index.html" + "?w=" +
                             Server.UrlEncode(Fetch.AESEncrypt(wxParam, AppConfig.WxH5Key, AppConfig.WxH5Key));

                Response.Redirect(url);

                #endregion
            }
            else if (AppConfig.Mode == AppConfig.CodeMode.Production)
            {
                #region 客户版本

                WxAuthorize jsApiDown = new WxAuthorize(this);
                try
                {
                    jsApiDown.GetOpenidAndAccessToken();
                    jsApiDown.GetUserInfo();

                    string openid     = jsApiDown.Openid;
                    string unionid    = jsApiDown.Unionid;
                    string nickname   = jsApiDown.Nickname;
                    int    sex        = jsApiDown.Sex;
                    string headimgurl = jsApiDown.Headimgurl;

                    string     wxParam = $"<{openid}>,<{unionid}>,<{nickname}>,<{sex}>,<{headimgurl}>";
                    ConfigInfo config  = Fetch.GetWebSiteConfig();
                    string     url     = (config != null ? config.Field4 : "/h5/") + "?w=" +
                                         Server.UrlEncode(Fetch.AESEncrypt(wxParam, AppConfig.WxH5Key,
                                                                           AppConfig.WxH5Key));

                    Response.Redirect(url);
                }
                catch (Exception)
                {
                    Response.Write("<span style='color:#FF0000;font-size:20px'>" + "页面加载出错,请重试" + "</span>");
                }

                #endregion
            }
            else if (AppConfig.Mode == AppConfig.CodeMode.Demo)
            {
                #region 演示版本

                Response.Redirect("http://ry.foxuc.net/JJHAuthorize.aspx?url=" + (LinkUrl.Equals("")?"http://jh.foxuc.net/h5/hall/":LinkUrl));

                #endregion
            }
        }
示例#4
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            if ((Typeid != 81 && Typeid != 82) || Gameid <= 0)
            {
                Response.Redirect("/404.html");
                return;
            }
            if (string.IsNullOrEmpty(Wxparam))
            {
                string path = Typeid == 82
                    ? $"/Mobile/WxRegister.aspx?t=82&g={Gameid}&r={Roomid}&k={Kindid}&a={Action}&p={Password}"
                    : "/Mobile/WxRegister.aspx?t=81&g=" + Gameid;
                string param = $"http://{AppConfig.GetSetting("FrontSiteDomain")}{path}";
                if (!string.IsNullOrEmpty(PlatformType))
                {
                    param += $"&y={PlatformType}";
//                    TextLogger.Write($"HAuthorizeUrl:{AppConfig.HAuthorizeURL}?url={Server.UrlEncode(param)}");
//                    Response.Redirect($"{AppConfig.HAuthorizeURL}?url={Server.UrlEncode(param)}");
//                    return;
                }
                Response.Redirect($"{AppConfig.AuthorizeURL}?url={Server.UrlEncode(param)}");
            }
            else
            {
                WxUser wu = Fetch.GetWxUser(Wxparam);
                if (wu == null)
                {
                    Response.Redirect("/404.html");
                    return;
                }
                AccountsInfo info = FacadeManage.aideAccountsFacade.GetAccountsInfoByUserUin(wu.unionid);
                if (info == null)
                {
                    //注册帐号
                    UserInfo user = new UserInfo
                    {
                        NickName   = wu.nickname,
                        Gender     = wu.sex,
                        RegisterIP = GameRequest.GetUserIP(),
                        GameID     = Gameid,
                        UserUin    = wu.unionid
                    };
                    FacadeManage.aideAccountsFacade.RegisterWX(user, Typeid, wu.headimgurl);
                }
                string redirect;
                if (PlatformType == "h5")
                {
                    string     wxParam = $"<{wu.openid}>,<{wu.unionid}>,<{wu.nickname}>,<{wu.sex}>,<{wu.headimgurl}>";
                    ConfigInfo webCfg  = Fetch.GetWebSiteConfig();
                    string     w       = Server.UrlEncode(Fetch.AESEncrypt(wxParam, AppConfig.WxH5Key,
                                                                           AppConfig.WxH5Key));
                    string baseUrl = "/h5/";
                    if (Typeid == 82)
                    {
                        switch (Kindid)
                        {
                        case 200:
                            baseUrl += "land";
                            break;

                        case 50:
                            baseUrl += "oxsixx";
                            break;

                        default:
                            baseUrl += "hall";
                            break;
                        }
                    }
                    else
                    {
                        baseUrl += "hall";
                    }
                    redirect = baseUrl + (Typeid == 82
                                   ? $"/?w={w}&r={Roomid}&a={Action}&p={Password}"
                                   : $"/?w={w}");
                }
                else
                {
                    redirect = Typeid == 82
                        ? "/Mobile/RoomLink.aspx?" +
                               $"s=already&g={Gameid}&r={Roomid}&k={Kindid}&a={Action}&p={Password}"
                        : $"/Mobile/ShareLink.aspx?s=already&g={Gameid}";
                }
                Response.Redirect(redirect);
            }
        }