Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //判断openid为空时,重新授权
                if (GlobalUtils.IsWeiXinBrowser)
                {
                    Guid?userId = WebUserAuth.UserId;
                    if (userId == null || userId == Guid.Empty)
                    {
                        PrintJson("-1", "对不起,您还未登录!");
                        return;
                    }

                    TuanDai.PortalSystem.BLL.UserBLL bll = new TuanDai.PortalSystem.BLL.UserBLL();
                    userModel = bll.GetUserBasicInfoModelById(userId.Value);

                    if (GlobalUtils.OpenId.IsEmpty())
                    {
                        string strOpenId = TuanDai.WXApiWeb.Common.WeiXinApi.GetUserWXOpenId(userModel.Id);
                        if (strOpenId.IsNotEmpty())
                        {
                            GlobalUtils.WriteOpenIdToCookie(strOpenId.ToText());
                        }
                        else
                        {
                            TuanDai.WXApiWeb.Common.WeiXinApi wxApi = new Common.WeiXinApi();
                            wxApi.GetOpenidAndAccessToken(this);
                        }
                    }
                }

                GetWXJsApiParam();
            }
        }
Ejemplo n.º 2
0
        protected void OnInitData()
        {
            UserBankInfo ubi = new UserBankInfo();
            UserBLL      bll = new UserBLL();

            userModel = bll.GetUserBasicInfoModelById(userId);
            var javaBankService = new BankFromJavaService();

            if (!GlobalUtils.IsOpenCGT)
            {
                if (string.IsNullOrEmpty(userModel.BankAccountNo))
                {
                    string sql = @"SELECT BankNo,BankType FROM dbo.UserBankInfo WITH(NOLOCK) WHERE UserId = @UserId ";

                    DynamicParameters para = new DynamicParameters();
                    para.Add("@UserId", userId);
                    ubi = PublicConn.QuerySingle <UserBankInfo>(sql, ref para);

                    if (ubi != null)
                    {
                        userModel.BankAccountNo = ubi.BankNo;
                        userModel.BankType      = ubi.BankType;
                    }
                }
            }
            else
            {
                if (GlobalUtils.IsBankService)
                {
                    bankInfoFromJava = javaBankService.GetBankInfo(userId, ServiceType.TuoMin);
                    if (bankInfoFromJava != null && bankInfoFromJava.respData != null)
                    {
                        bankName = bankInfoFromJava.respData.bankName;
                        bankNo   = bankInfoFromJava.respData.bankNo;
                    }
                }

                if (string.IsNullOrEmpty(bankNo))
                {
                    GlobalUtils.GetBankImg(userModel.Id, out bankName);
                    bankNo = userModel.BankAccountNo;
                }
            }
            vailStatus = getVailStatusByUserModel(userModel);
            this.IsValidateIdentity = userModel.IsValidateIdentity;
            if (GlobalUtils.IsBankService)
            {
                AviMoney = javaBankService.GetAviMoney(userId);
            }
            else
            {
                AviMoney = bll.GetUserAviMoney(userId);
            }


            bank = GetSupportBank();

            if (!GlobalUtils.IsOpenCGT)
            {
                string sType = WEBRequest.GetString("selectType");
                if (sType == "")
                {
                    //获取默认支付方式
                    if (GlobalUtils.IsWeiXinBrowser)
                    {
                        if (userModel.BankAccountNo.ToText().IsEmpty())
                        {
                            DefPayType = 1;
                        }
                        else
                        {
                            DefPayType = 2;
                        }
                    }
                    else
                    {
                        DefPayType = 2;
                    }
                }
                //判断openid为空时,重新授权
                if (GlobalUtils.IsWeiXinBrowser)
                {
                    if (GlobalUtils.OpenId.IsEmpty())
                    {
                        string strOpenId = TuanDai.WXApiWeb.Common.WeiXinApi.GetUserWXOpenId(userModel.Id);
                        if (strOpenId.IsNotEmpty())
                        {
                            GlobalUtils.WriteOpenIdToCookie(strOpenId.ToText());
                        }
                        else
                        {
                            TuanDai.WXApiWeb.Common.WeiXinApi wxApi = new Common.WeiXinApi();
                            wxApi.GetOpenidAndAccessToken(this);
                        }
                    }
                }
            }
            WebSettingInfo rechargeSet = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA");

            MinRechargeAmount = decimal.Parse(rechargeSet.Param1Value);

            this.CheckUseKuaiJiePay();
        }