Esempio n. 1
0
 public JFTH5Notify(OnLinePayOrder order)
 {
     p1_yingyongnum = Config.JFTID;
     p2_ordernumber = order.OrderID;
     p3_money       = order.Amount.ToString("F2");
     p4_zfstate     = "1";
     p5_orderid     = Fetch.ConvertDateTimeToUnix(DateTime.Now);
     p6_productcode = order.ShareID == 303 ? "ZFB" : "WX";
     p8_charset     = "UTF-8";
     p9_signtype    = "1";
     p10_sign       = MarkSign();
 }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (AppConfig.Mode != AppConfig.CodeMode.Dev)
                {
                    if (Fetch.isWeChat(Request))
                    {
                        //演示和通用平台
                        if (string.IsNullOrEmpty(wxparam))
                        {
//                        string domain = "http://" + (string.IsNullOrEmpty(AppConfig.FrontSiteDomain)
//                                            ? GameRequest.GetCurrentFullHost()
//                                            : AppConfig.FrontSiteDomain);
                            Response.Redirect(AppConfig.AuthorizeURL + "?url=http://" +
                                              GameRequest.GetCurrentFullHost() + "/Card/Index.aspx?code=1001");
                        }
                        else
                        {
                            WxUser wu = Fetch.GetWxUser(wxparam);
                            if (wu == null)
                            {
                                Response.Write(
                                    "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">参数异常,请稍后尝试。</div>");
                                return;
                            }
                            Message msg =
                                FacadeManage.aideAgentFacade.AgentWXLogin(wu.unionid, GameRequest.GetUserIP());
                            if (msg.Success)
                            {
                                Entity.Agent.AgentInfo ui = msg.EntityList[0] as Entity.Agent.AgentInfo;
                                if (ui != null)
                                {
                                    //for Version 2.0 跳转
                                    string token = Fetch.SHA256Encrypt(
                                        $"<{ui.UserID}>,<{ui.AgentID}>,<{ui.AgentDomain}>,<{Fetch.ConvertDateTimeToUnix(DateTime.Now)}>");
                                    FacadeManage.aideAgentFacade.SaveAgentToken(ui, token);
                                    HttpRuntime.Cache.Insert("token", token);
                                    Response.Redirect($"v2/#/");
                                }
                                else
                                {
                                    Response.Write(
                                        "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">登录失败,请稍后尝试</div>");
                                }
                            }
                            else
                            {
                                Response.Write(
                                    "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">" +
                                    wu.nickname + "," +
                                    msg.Content + "</div>");
                            }
                        }
                    }
                    else
                    {
                        //if (version == 1)
                        //    // for Version 1.0 非微信提示
                        //    Response.Write(
                        //        "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">请在微信内打开</div>");
                        //else if (version == 2)
                        // for Version 2.0 跳转到手机+安全密码登录页面
                        if (!string.IsNullOrEmpty(Gameid))
                        {
                            AccountsInfo user = FacadeManage.aideAccountsFacade.GetAccountsInfoByGameID(Convert.ToInt32(Gameid));
                            if (user == null)
                            {
                                Response.Write(
                                    "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">抱歉,您为非代理玩家。</div>");
                                return;
                            }

                            if (user.AgentID > 0)
                            {
                                AgentInfo agent = FacadeManage.aideAgentFacade.GetAgentInfo(user.AgentID, 0);
                                if (agent != null && string.IsNullOrEmpty(agent.Password))
                                {
                                    Response.Redirect("setPassword.aspx?gameid=" + Gameid);
                                }
                                else
                                {
                                    Response.Redirect("v2/#/Login?gameid=" + Gameid);
                                }
                            }
                            else
                            {
                                Response.Write(
                                    "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">抱歉,您为非代理玩家。</div>");
                                return;
                            }
                        }
                    }
                }
                if (!string.IsNullOrEmpty(Gameid))
                {
                    AccountsInfo user = FacadeManage.aideAccountsFacade.GetAccountsInfoByGameID(Convert.ToInt32(Gameid));
                    if (user.AgentID > 0)
                    {
                        AgentInfo agent = FacadeManage.aideAgentFacade.GetAgentInfo(user.AgentID, 0);
                        if (agent != null && string.IsNullOrEmpty(agent.Password))
                        {
                            Response.Redirect("setPassword.aspx?gameid=" + Gameid);
                        }
                        else
                        {
                            txtGameid.Text = Gameid;
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        protected void btnAuth_OnClick(object sender, EventArgs e)
        {
            //if (AppConfig.Mode == AppConfig.CodeMode.Dev)
            //{
            #region Version 2.0 Dev

            string  mobile = CtrlHelper.GetText(txtGameid);
            string  pass   = Utility.MD5(CtrlHelper.GetText(txtPassword));
            Message msg    =
                FacadeManage.aideAgentFacade.AgentMobileLogin(mobile, pass, GameRequest.GetUserIP());
            if (msg.Success)
            {
                Entity.Agent.AgentInfo info = msg.EntityList[0] as Entity.Agent.AgentInfo;
                if (info != null)
                {
                    string token =
                        Fetch.SHA256Encrypt(
                            $"<{info.UserID}>,<{info.AgentID}>,<{info.AgentDomain}>,<{Fetch.ConvertDateTimeToUnix(DateTime.Now)}>");

                    FacadeManage.aideAgentFacade.SaveAgentToken(info, token);
                    HttpRuntime.Cache.Insert("token", token);
                    Response.Redirect($"v2/#/");
                    return;
                }
            }
            else
            {
                Response.Write(
                    $"<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">{msg.Content}</div>");
                return;
            }

            Response.Write(
                "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">账号或密码错误。</div>");

            #endregion
            //}
        }
Esempio n. 4
0
        /// <summary>
        /// 代理账号+安全密码认证 换取 Token
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="pass"></param>
        private static void AgentAuth(string mobile, string pass)
        {
            if (string.IsNullOrEmpty(mobile) || string.IsNullOrEmpty(pass))
            {
                _ajv.code = (int)ApiCode.VertyParamErrorCode;
                _ajv.msg  = string.Format(EnumHelper.GetDesc(ApiCode.VertyParamErrorCode),
                                          " mobile、pass 缺失");
                return;
            }
            Message msg = FacadeManage.aideAgentFacade.AgentMobileLogin(mobile, pass, GameRequest.GetUserIP());

            if (msg.Success)
            {
                Entity.Agent.AgentInfo info = msg.EntityList[0] as Entity.Agent.AgentInfo;
                if (info != null)
                {
                    string token =
                        Fetch.SHA256Encrypt(
                            $"<{info.UserID}>,<{info.AgentID}>,<{info.AgentDomain}>,<{Fetch.ConvertDateTimeToUnix(DateTime.Now)}>");

                    FacadeManage.aideAgentFacade.SaveAgentToken(info, token);

                    _ajv.SetValidDataValue(true);
                    _ajv.SetDataItem("token", token);
                    _ajv.SetDataItem("expirtAt", DateTime.Now.AddDays(1));
                    return;
                }
            }

            _ajv.code = (int)ApiCode.Unauthorized;
            _ajv.msg  = EnumHelper.GetDesc(ApiCode.Unauthorized);
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (AppConfig.Mode != AppConfig.CodeMode.Dev)
                {
                    if (Fetch.isWeChat(Request))
                    {
                        //演示和通用平台
                        if (string.IsNullOrEmpty(wxparam))
                        {
//                        string domain = "http://" + (string.IsNullOrEmpty(AppConfig.FrontSiteDomain)
//                                            ? GameRequest.GetCurrentFullHost()
//                                            : AppConfig.FrontSiteDomain);
                            Response.Redirect(AppConfig.AuthorizeURL + "?url=http://" +
                                              GameRequest.GetCurrentFullHost() + "/Card/Index.aspx?code=1001");
                        }
                        else
                        {
                            WxUser wu = Fetch.GetWxUser(wxparam);
                            if (wu == null)
                            {
                                Response.Write(
                                    "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">参数异常,请稍后尝试。</div>");
                                return;
                            }
                            Message msg =
                                FacadeManage.aideAgentFacade.AgentWXLogin(wu.unionid, GameRequest.GetUserIP());
                            if (msg.Success)
                            {
                                Entity.Agent.AgentInfo ui = msg.EntityList[0] as Entity.Agent.AgentInfo;
                                if (ui != null)
                                {
                                    //for Version 2.0 跳转
                                    string token = Fetch.SHA256Encrypt(
                                        $"<{ui.UserID}>,<{ui.AgentID}>,<{ui.AgentDomain}>,<{Fetch.ConvertDateTimeToUnix(DateTime.Now)}>");
                                    FacadeManage.aideNativeWebFacade.SaveAgentToken(ui, token);
                                    Response.Redirect($"v2/#/?token={token}");
                                }
                                else
                                {
                                    Response.Write(
                                        "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">登录失败,请稍后尝试</div>");
                                }
                            }
                            else
                            {
                                Response.Write(
                                    "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">" +
                                    wu.nickname + "," +
                                    msg.Content + "</div>");
                            }
                        }
                    }
                    else
                    {
                        if (version == 1)
                        {
                            // for Version 1.0 非微信提示
                            Response.Write(
                                "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">请在微信内打开</div>");
                        }
                        else if (version == 2)
                        {
                            // for Version 2.0 跳转到手机+安全密码登录页面
                            Response.Redirect("v2/#/Login");
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        protected void btnAuth_OnClick(object sender, EventArgs e)
        {
            if (AppConfig.Mode == AppConfig.CodeMode.Dev)
            {
                if (version == 1)
                {
                    #region Version 1.0 Dev

                    AccountsInfo info =
                        FacadeManage.aideAccountsFacade.GetAccountsInfoByGameID(Convert.ToInt32(txtGameID.Text));
                    Message msg =
                        FacadeManage.aideAccountsFacade.WXLogin(info != null ? info.UserUin : "yryr",
                                                                GameRequest.GetUserIP());
                    if (msg.Success)
                    {
                        UserInfo ui = msg.EntityList[0] as UserInfo;
                        if (ui != null)
                        {
                            Fetch.SetUserCookie(ui.ToUserTicketInfo());
                            Response.Redirect("AgentInfo.aspx");
                        }
                        else
                        {
                            Response.Write(
                                "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">登录失败,请稍后尝试</div>");
                        }
                    }
                    else
                    {
                        Response.Write(
                            "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">" +
                            msg.Content + "</div>");
                    }

                    #endregion
                }
                else if (version == 2)
                {
                    #region Version 2.0 Dev

                    string  mobile = CtrlHelper.GetText(txtPhone);
                    string  pass   = Utility.MD5(CtrlHelper.GetText(txtPassword));
                    Message msg    =
                        FacadeManage.aideAccountsFacade.AgentMobileLogin(mobile, pass, GameRequest.GetUserIP());
                    if (msg.Success)
                    {
                        UserInfo info = msg.EntityList[0] as UserInfo;
                        if (info != null)
                        {
                            string token =
                                Fetch.SHA256Encrypt(
                                    $"<{info.UserID}>,<{info.AgentID}>,<{info.GameID}>,<{Fetch.ConvertDateTimeToUnix(DateTime.Now)}>");

                            FacadeManage.aideNativeWebFacade.SaveAgentToken(info, token);
                            Response.Redirect($"v2/#/?token={token}");
                            return;
                        }
                    }
                    else
                    {
                        Response.Write(
                            $"<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">{msg.Content}</div>");
                        return;
                    }

                    Response.Write(
                        "<div style=\"font-size:1.2rem; color:red; text-align:center; margin-top:3rem;\">账号或密码错误。</div>");

                    #endregion
                }
            }
        }