Пример #1
0
        /// <summary>
        /// 刷新八金社用户token
        /// </summary>
        /// <param name="bjsUserToken"></param>
        /// <returns></returns>
        private Tuple <string, string> RefreshBjsUserToken(string bjsUserToken)
        {
            try
            {
                RefreshBjsUserTokenRequest request = new RefreshBjsUserTokenRequest {
                    platformCode     = BjsPlatformCode,
                    requestId        = Guid.NewGuid().ToString(),
                    requestTimeMills = DateTimeToTimestamp().ToString(),
                    refreshUserToken = bjsUserToken,
                    ext = ""
                };
                request.signature = Cryptography.GetMd5(request.platformCode + "-" + BjsKey + "-" + request.requestId);

                string url  = "http://api2.bajinshe.com/json/v2/external/UserService/refreshUserToken/gzip";
                string resp = HttpUtils.HttpPostJson(url, JsonConvert.SerializeObject(request));

                RefreshBjsUserTokenResponse response = JsonConvert.DeserializeObject <RefreshBjsUserTokenResponse>(resp);
                if (response == null)
                {
                    return(null);
                }
                if (response.code == "10000")
                {
                    return(new Tuple <string, string>(response.bjsUserId, response.phoneNumber));
                }
            }
            catch (Exception ex)
            {
                SysLogHelper.WriteErrorLog("刷新八青社用户信息接口时出错", Tool.ExceptionHelper.GetExceptionMessage(ex));
            }
            return(null);
        }
Пример #2
0
        /// <summary>
        /// 获取统计数据
        /// </summary>
        private void GetStatistics()
        {
            WebSiteDataInfo websitedatemodel = new WebSiteDataBLL().GetWebSiteData();

            if (websitedatemodel != null)
            {
                this.UserCount = websitedatemodel.TotalUser.ToString();
                this.UserName  = Tool.CookieHelper.GetCookie("TDWUserName");
                TuanDai.PortalSystem.BLL.UserBLL userBll = new TuanDai.PortalSystem.BLL.UserBLL();
                userBasicObj = userBll.GetUserBasicInfoModelById(WebUserAuth.UserId.Value);
                if (this.UserName.IsEmpty())
                {
                    if (userBasicObj != null)
                    {
                        this.UserName = userBasicObj.UserName;
                    }
                }
                this.returnUrl = Tool.WEBRequest.GetString("ReturnUrl");
                if (!string.IsNullOrEmpty(returnUrl) && returnUrl.ToLower().Contains(TuanDai.WXApiWeb.GlobalUtils.ActivityWebsiteUrl.ToLower()))//跳转回ReturnUrl
                {
                    try
                    {
                        Response.Redirect(returnUrl, false);
                    }
                    catch (Exception ex)
                    {
                        SysLogHelper.WriteErrorLog("注册成功页面跳转异常", Tool.ExceptionHelper.GetExceptionMessage(ex));
                    }
                    finally {
                        Response.End();
                    }
                }
            }
        }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         string postString = string.Empty;
         string action     = Tool.WEBRequest.GetQueryString("action");
         if (string.IsNullOrEmpty(action))
         {
             if (HttpContext.Current.Request.HttpMethod.ToUpper() == "POST")
             {
                 using (Stream stream = HttpContext.Current.Request.InputStream)
                 {
                     Byte[] postBytes = new Byte[stream.Length];
                     stream.Read(postBytes, 0, (Int32)stream.Length);
                     postString = Encoding.UTF8.GetString(postBytes);
                     string msg = new EventHandle().ReturnMessage(postString);
                     Response.Write(msg);
                 }
             }
             if (HttpContext.Current.Request.HttpMethod.ToUpper() == "GET")
             {
                 new WeiXin().Auth();
             }
         }
         else if (action.ToLower() == "clearcache")
         {
             string user_Ip = Tool.WEBRequest.GetIP();
             if (IsValidIp(user_Ip))
             {
                 //清理客户端WCF缓存
                 //TuanDai.BalancedSystem.Client.BalancedSystemClient client = new TuanDai.BalancedSystem.Client.BalancedSystemClient();
                 //client.ClearCacheByClient();
                 Response.Write("1");
                 Response.End();
             }
             else
             {
                 Response.Write("非法的来访IP");
                 Response.End();
             }
         }
         else if (action.ToLower() == "cleartoken")
         {
             string strValidatePass = Tool.WEBRequest.GetQueryString("ValidatePass");
             if (strValidatePass == "tuandaiisgood")
             {
                 //  TuanDai.WXApiWeb.Common.WeiXinApi.removeCache("WeiXinTicket");
                 //请求完检测DB中Token状态 Allen 2015-08-12
                 ThirdLoginSDK.CheckDBTokenDelegate chkStatus = new ThirdLoginSDK.CheckDBTokenDelegate(ThirdLoginSDK.CheckDBTokenStatus);
                 chkStatus.BeginInvoke(GlobalUtils.AppId, null, null);
             }
         }
     }
     catch (Exception ex)
     {
         SysLogHelper.WriteErrorLog("微信请求", "错误详细信息:" + ex.Message + "|" + ex.StackTrace);
     }
 }
Пример #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         PrizeId = WEBRequest.GetString("PrizeId", "");
         //Response.Redirect(GlobalUtils.WebURL + "/Member/UserPrize/Gift_Address.aspx?PrizeId="+PrizeId);
         BindInfo();
     }
     catch (Exception ex)
     {
         SysLogHelper.WriteErrorLog("获取商城默认地址失败", "异常:" + ex.Message);
     }
 }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IsInWeiXin = GlobalUtils.IsWeiXinBrowser ? 1 : 0;
            try
            {
                string postString = string.Empty;
                string action     = Tool.WEBRequest.GetQueryString("action").ToLower();

                string strValidatePass = Tool.WEBRequest.GetQueryString("validatePass");
                if (strValidatePass == "tuandaiisgood")
                {
                    string openId = WEBRequest.GetQueryString("openid");
                    if (openId.IsEmpty())
                    {
                        openId = GlobalUtils.OpenId;
                    }
                    string weburl = GlobalUtils.MTuanDaiURL;
                    if (action == "newhand")
                    {
                        List <WeiXinApi.PicTextArticleItemInfo> newsList = new List <WeiXinApi.PicTextArticleItemInfo>();
                        newsList.Add(new WeiXinApi.PicTextArticleItemInfo {
                            title = "新手福利-518红包,体验金等好礼", description = "新手福利-518红包,体验金等好礼", picurl = weburl + "/imgs/push/banner_newhand.png?v=20160831003", url = "https://mvip.tdw.cn/pages/invest/invest_newHand.aspx"
                        });
                        newsList.Add(new WeiXinApi.PicTextArticleItemInfo {
                            title = "平台的安全保障", description = "平台的安全保障", picurl = weburl + "/imgs/push/icon_safety.png?v=20160831003", url = "http://info.tdw.cn/wap/help/second-question.html?cid=20"
                        });
                        newsList.Add(new WeiXinApi.PicTextArticleItemInfo {
                            title = "如何投资", description = "如何投资", picurl = weburl + "/imgs/push/icon_invest.png?v=20160831003", url = "http://info.tdw.cn/wap/help/second-question.html?cid=15"
                        });
                        newsList.Add(new WeiXinApi.PicTextArticleItemInfo {
                            title = "关于提现和管理费", description = "关于提现和管理费", picurl = weburl + "/imgs/push/icon_withdraw.png?v=20160831003", url = "http://info.tdw.cn/wap/help/second-question.html?cid=16"
                        });
                        WeiXinApi.SendPicTextMessageToUser(openId, newsList);
                    }
                    else if (action == "hotrecommend")
                    {
                        List <WeiXinApi.PicTextArticleItemInfo> newsList = new List <WeiXinApi.PicTextArticleItemInfo>();
                        newsList.Add(new WeiXinApi.PicTextArticleItemInfo {
                            title = "智能投标-We计划", description = "智能投标-We计划", picurl = weburl + "/imgs/push/banner_we.png?v=20160831003", url = weburl + "/pages/invest/WE/WE_list.aspx"
                        });
                        newsList.Add(new WeiXinApi.PicTextArticleItemInfo {
                            title = "邀请有礼", description = "邀请有礼", picurl = weburl + "/imgs/push/icon_gift.png?v=20160831003", url = "https://hd.tdw.cn/weixin/Invite/InviteIndex.aspx"
                        });
                        WeiXinApi.SendPicTextMessageToUser(openId, newsList);
                    }
                }
            }
            catch (Exception ex) {
                SysLogHelper.WriteErrorLog("微信关注推送图文消息失败", "错误详细信息:" + ex.Message + "|" + ex.StackTrace);
            }
        }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                TuanDai.Payment.PaymentBLL paybll = new TuanDai.Payment.PaymentBLL();//此处实例化是为了给微信支付那些参数赋值

                TuanDai.Payment.ResultNotify resultNotify = new TuanDai.Payment.ResultNotify(this);
                resultNotify.AfterPayProcess = DoAfterPay;
                resultNotify.ProcessNotify();
            }
            catch (Exception ex)
            {
                string errormessage = "内部错误:" + ex.InnerException + "\r\n堆栈:" + ex.StackTrace + "\r\n信息:" + ex.Message + "\r\n来源:" + ex.Source;
               
                 SysLogHelper.WriteErrorLog("微信支付回调报错", errormessage);
            }
        }
Пример #7
0
        /// <summary>
        /// 计算承接人的年化利率
        /// </summary>
        /// <returns></returns>
        public void GetUndertakeYearRate()
        {
            Guid subscribeId = Guid.Empty;

            Guid.TryParse(Context.Request["subscribeid"], out subscribeId);
            int totalShares = 0;

            int.TryParse(Context.Request["totalshares"], out totalShares);

            decimal totalAmount = 0;

            decimal.TryParse(Context.Request["totalamount"], out totalAmount);

            string sql = "select isnull(dbo.f_GetCurTransferProjectRate(@SubscribeId,@TotalShares,@TotalAmount),0)";

            var whereParas = new Dapper.DynamicParameters();

            whereParas.Add("@SubscribeId", subscribeId);
            whereParas.Add("@TotalShares", totalShares);
            whereParas.Add("@TotalAmount", totalAmount);
            decimal yearRate = 0;

            try
            {
                //using (SqlConnection conn = new SqlConnection(TuanDai.Config.BaseConfig.ConnectionString))
                //{
                //    conn.Open();
                //    yearRate = conn.Query<decimal>(sql, whereParas).Sum();
                //    conn.Close();
                //    conn.Dispose();
                //}
                yearRate = PublicConn.QueryBySqlWrite <decimal>(sql, ref whereParas).Sum();
            }
            catch (Exception ex)
            {
                SysLogHelper.WriteErrorLog("计算承接者利率异常", "申购Id:" + subscribeId + "异常:" + ex.Message);
            }
            finally
            {
                PrintJson(yearRate.ToString(), "");
            }
        }
Пример #8
0
        //确认申请转让
        public void SubmitTransaction()
        {
            Guid subscribeId = Guid.Empty;

            Guid.TryParse(Context.Request["sid"], out subscribeId);
            int transferShares = 0;

            int.TryParse(Context.Request["shares"], out transferShares);
            decimal transferPrice = 0;

            decimal.TryParse(Context.Request["price"], out transferPrice);
            Guid userId = WebUserAuth.UserId.Value;

            string payPwd = Context.Request["ppwd"];

            payPwd = Tool.Encryption.MD5(payPwd);
            UserBasicInfoInfo userBasicEntity = new UserBLL().GetUserBasicInfoModelById(userId);

            if (userBasicEntity == null)
            {
                PrintJson("-31", "登录已过期或未登录");
                return;
            }
            if (!GlobalUtils.IsOpenCGT && !string.IsNullOrEmpty(payPwd) && userBasicEntity.PayPwd != payPwd)
            {
                PrintJson("-32", "交易密码错误");
                return;
            }
            if (string.IsNullOrEmpty(userBasicEntity.TelNo))
            {
                PrintJson("-33", "手机号码未认证");
                return;
            }

            string headImage = userBasicEntity.HeadImage;

            try
            {
                if (headImage.ToText().IsEmpty())
                {
                    //var whereParams = new Dapper.DynamicParameters();
                    Random rnd       = new Random();
                    int    rndNum    = rnd.Next(1, 28);
                    string rndminNum = rndNum.ToString();
                    if (rndNum < 10)
                    {
                        rndminNum = "0" + rndminNum;
                    }
                    headImage = GlobalUtils.TuanDaiURL + "/img/avatar/tdface/tdface" + rndminNum + ".jpg";
                    new TuanDai.PortalSystem.BLL.UserBLL().UpdateUserHeadImage(headImage, userId);
                    //string strSQL = string.Format(@"update UserBasicInfo set HeadImage=@HeadImage where id=@userId");
                    //whereParams.Add("@HeadImage", headImageURL);
                    //whereParams.Add("@userId", userId);
                    ////using (SqlConnection conn = new SqlConnection(TuanDai.Config.BaseConfig.ConnectionString))
                    ////{
                    ////    conn.Open();
                    ////    conn.Execute(strSQL, whereParams);
                    ////    conn.Close();
                    ////    conn.Dispose();
                    ////}
                    //PublicConn.ExecuteTD(PublicConn.DBWriteType.UserWrite, strSQL, ref whereParams);
                }
            }
            catch (Exception ex)
            {
                SysLogHelper.WriteErrorLog("申请转让,更新头像异常", "用户:" + userId + "异常:" + ex.Message);
            }

            if (GlobalUtils.IsOpenCGT && GlobalUtils.IsOpenCgtTrans)
            {
                var reqMode = new TuanDai.CgtCallbackUrl.Model.ModelRequest.SanBiaoTransactionRequest
                {
                    Channel        = "MOBILE",
                    UserId         = userId.ToString(),
                    subscribeId    = subscribeId,
                    transferPrice  = transferPrice,
                    transferShares = transferShares,
                    headImageURL   = headImage,
                    Version        = GlobalUtils.Version
                };

                string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.ApplyZqzr);
                PrintJson("8888", url);
            }
            else
            {
                int    outputStatus = 0;
                string msg          = string.Empty;
                new TuanDai.PortalSystem.BLL.SubScriberansferBLL().ApplicationTransfer(subscribeId, string.Empty,
                                                                                       transferShares, transferPrice, userId, out outputStatus, out msg);

                if (outputStatus == 0)
                {
                    PrintJson("0", "申请转让失败");
                }
                else
                {
                    PrintJson(outputStatus.ToString(), msg);
                }
            }
        }
Пример #9
0
        public void GetLongUrl()
        {
            Guid           webSetId         = Guid.Parse("28670136-C253-4B88-962F-F99E81806D5E");
            WebSettingInfo webSettingEntity = new WebSettingBLL().GetWebSettingInfo(webSetId.ToString());
            string         url = webSettingEntity.Param1Value;

            try
            {
                string shortUrlKey   = string.Empty;
                int    functonType   = 0;
                int    shareToolType = 0;
                GetSharedAddressKey(ref shortUrlKey, ref functonType, ref shareToolType);    //获取段地址的key、功能类型、分享类型
                if (functonType > 0 && shareToolType > 0)
                {
                    string sharedUrl = GetSharedAddress(functonType, shareToolType);//获取分享设置表中对应功能、分享类型的url
                    if (!string.IsNullOrEmpty(sharedUrl))
                    {
                        url = sharedUrl;
                    }
                }
                //ShortUrlService serviceShortUrl = new ShortUrlService();
                ShortUrlRequest requestShortUrl = new ShortUrlRequest();
                requestShortUrl.ShortUrlKey = shortUrlKey;
                TuanDai.InfoSystem.Model.RequestContentApi reqApi = new TuanDai.InfoSystem.Model.RequestContentApi();
                reqApi.Data = JsonConvert.SerializeObject(requestShortUrl);
                ReplyContentApi      repApi = null;
                InfoSystemClient_New client = new InfoSystemClient_New();
                string errorMsg             = "";

                repApi = client.getlongurl(reqApi, out errorMsg);

                List <UserExtendShortUrl> shortUrList = new List <UserExtendShortUrl>();
                if (errorMsg == "" && repApi.Data != null && repApi.ReturnCode == 1)
                {
                    shortUrList = JsonConvert.DeserializeObject <List <UserExtendShortUrl> >(repApi.Data.ToString());
                }
                if (shortUrList.Count <= 0)
                {
                    Response.Redirect(url);
                }

                string             resultUrl     = string.Empty;
                UserExtendShortUrl shortUrEntity = shortUrList.FirstOrDefault();
                if (shortUrEntity != null && !string.IsNullOrEmpty(shortUrEntity.LongUrl))
                {
                    resultUrl = url + shortUrEntity.LongUrl;
                }
                if (!string.IsNullOrEmpty(resultUrl))
                {
                    Response.Redirect(resultUrl, false);
                }
                else
                {
                    Response.Redirect(url, false);
                }
            }
            catch (Exception ex)
            {
                SysLogHelper.WriteErrorLog("GetLongUrl应用系统错误:" + ex.TargetSite.Name, ex.ToString());
                Response.Redirect(url, false);
            }
            finally
            {
                Response.End();
            }
        }
Пример #10
0
        private void GetEBPayCheck()
        {
            Guid userid;

            if (WebUserAuth.UserId != null)
            {
                userid = WebUserAuth.UserId.Value;
            }
            else
            {
                PrintJson("0", "您还未登录!");
                return;
            }

            decimal        Amount            = Tool.SafeConvert.ToDecimal(Request.QueryString["Amount"], 0);
            WebSettingInfo rechargeSet       = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA");
            decimal        MinRechargeAmount = decimal.Parse(rechargeSet.Param1Value);

            if (Amount < MinRechargeAmount)
            {
                PrintJson("0", "您好,充值金额必须大于或者等于" + MinRechargeAmount.ToString("N2") + "!");
                return;
            }

            if (Amount > 5000000)
            {
                PrintJson("0", "单次充值不能超过500万!");
                return;
            }
            NoHandler noHandler = new NoHandler();
            string    orderNo   = noHandler.OnLineRechare();

            if (orderNo == "0")
            {
                PrintJson("0", "您好,您的提交失败请重试!");
                return;
            }

            int    Sel        = 11;
            Guid   rechargeId = Guid.NewGuid();
            string bankcode   = "";

            string            userIP    = Tool.WebFormHandler.GetIP();
            int               outStatus = 0;
            DynamicParameters paras     = new DynamicParameters();

            paras.Add("@userid", userid);
            paras.Add("@type", Sel);
            paras.Add("@amount", Amount);
            paras.Add("@orderNo", orderNo);
            paras.Add("@backcode", bankcode);
            paras.Add("@clientIp", userIP);
            paras.Add("@from", "5");
            paras.Add("@outStatus", 0, DbType.Int32, ParameterDirection.Output);
            PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "AccountRechargeInit", ref paras, CommandType.StoredProcedure);
            outStatus = paras.Get <int>("@outStatus");

            int result = outStatus;

            if (result <= 0)
            {
                PrintJson("0", "您好,您的提交失败请重试!");
            }

            UserBLL           bll      = new UserBLL();
            UserBasicInfoInfo userInfo = bll.GetUserBasicInfoModelById(userid);

            //获取个人信息
            if (null == userInfo)
            {
                PrintJson("0", "获取用户信息错误!");
                return;
            }

            //如果查询没有身份或者真实姓名
            if (string.IsNullOrEmpty(userInfo.IdentityCard) || string.IsNullOrEmpty(userInfo.RealName) || !userInfo.IsValidateIdentity)
            {
                PrintJson("0", "没有获取到用户实名信息(身份证和真实姓名)");
                return;
            }
            GetBankCardNo(userInfo, userid);
            //是否绑定银行卡
            if (string.IsNullOrEmpty(userInfo.BankAccountNo))
            {
                PrintJson("0", "银行卡未绑定");
                return;
            }
            //是否绑定手机
            if (string.IsNullOrEmpty(userInfo.TelNo) || !userInfo.IsValidateMobile)
            {
                PrintJson("0", "未完成手机或实名认证");
                return;
            }

            EBRechargeInfo orderInfo = new EBRechargeInfo();

            orderInfo.IsBindCard = 0;
            orderInfo.OrderId    = orderNo;
            //申请充值
            try
            {
                var bankAccountNo  = userInfo.BankAccountNo.Trim();
                var identityId     = userInfo.Id.ToString().Replace("-", string.Empty).ToUpper();
                var bindCardModel  = BindBankCardList.GetBindCardList(identityId, bankAccountNo);
                var rechargeAmount = (int)(Amount * 100);
                if (bindCardModel == null)
                {
                    var model = new BindCardRequestModel
                    {
                        CardNo        = bankAccountNo,
                        IdCardNo      = userInfo.IdentityCard,
                        IdentityId    = identityId,
                        Phone         = userInfo.TelNo,
                        RegisterPhone = userInfo.TelNo,
                        UserName      = userInfo.RealName,
                    };

                    model.RequestId     = string.Concat("D", identityId);
                    orderInfo.RequestId = model.RequestId;
                    BindBankCard.BindCard(model);
                }
                else
                {
                    orderInfo.RequestId  = string.Concat("D", identityId);
                    orderInfo.IsBindCard = 1;
                    BankCardPay.BindPay(new BankCardPayRequestModel
                    {
                        Amount      = rechargeAmount,
                        CallBackUrl = EBNotifyUrl,
                        CardLast    = bindCardModel.Card_Last,
                        CardTop     = bindCardModel.Card_Top,
                        IdentityId  = identityId,
                        OrderId     = orderNo
                    });
                }
            }
            catch (Exception ex)
            {
                SysLogHelper.WriteErrorLog("易宝充值出错:GetEBPayCheck", Tool.ExceptionHelper.GetExceptionMessage(ex));
                PrintJson("0", "发生错误:" + ex.Message);
                return;
            }
            var ResponseData = new { result = "1", msg = JsonHelper.ToJson(orderInfo) };

            PrintJson(ResponseData);
        }
Пример #11
0
        private void ConfirmPay()
        {
            Guid userid;

            if (WebUserAuth.UserId != null)
            {
                userid = WebUserAuth.UserId.Value;
            }
            else
            {
                PrintJson("0", "您还未登录!");
                return;
            }
            string orderId    = WEBRequest.GetFormString("OrderId");
            string valCode    = WEBRequest.GetFormString("SMSCode");
            string isBindCard = WEBRequest.GetFormString("IsBindCard");

            try
            {
                if (isBindCard == "1")
                {
                    AccountRechareInfo ar = getAccountRechare(orderId);
                    if (null == ar)
                    {
                        PrintJson("0", "充值交易未成功!");
                        return;
                    }

                    BankCardPay.ConfirmBindBankCard(orderId, valCode);
                }
                else
                {
                    //获取个人信息
                    UserBLL           userbll  = new UserBLL();
                    UserBasicInfoInfo userInfo = userbll.GetUserBasicInfoModelById(userid);
                    if (null == userInfo)
                    {
                        PrintJson("0", "获取用户信息错误!");
                        return;
                    }
                    GetBankCardNo(userInfo, userid);
                    //是否绑定银行卡
                    if (string.IsNullOrEmpty(userInfo.BankAccountNo))
                    {
                        PrintJson("0", "银行卡未绑定!");
                        return;
                    }
                    string requestId = WEBRequest.GetFormString("RequestId").ToUpper();
                    //确认绑卡
                    BindBankCard.ConfirmBindBankCard(requestId, valCode);

                    //无短信充值
                    AccountRechareInfo ar = getAccountRechare(orderId);
                    if (null == ar)
                    {
                        PrintJson("0", "充值交易未成功!");
                        return;
                    }

                    var identityId     = userInfo.Id.ToString().Replace("-", string.Empty).ToUpper();
                    var bindCardModel  = BindBankCardList.GetBindCardList(identityId, userInfo.BankAccountNo.Trim());
                    var rechargeAmount = (int)(ar.Amount * 100);
                    BindBankCardPay.BindPay(new BankCardPayRequestModel
                    {
                        Amount      = rechargeAmount,
                        CallBackUrl = EBNotifyUrl,
                        CardLast    = bindCardModel.Card_Last,
                        CardTop     = bindCardModel.Card_Top,
                        IdentityId  = identityId,
                        OrderId     = orderId
                    });
                }
            }
            catch (Exception ex)
            {
                SysLogHelper.WriteErrorLog("易宝充值出错:ConfirmPay", Tool.ExceptionHelper.GetExceptionMessage(ex));
                PrintJson("0", "发生错误:" + ex.Message);
                return;
            }
            PrintJson("1", "");
        }
Пример #12
0
        private string UserInsertByPhone(string phone)
        {
            string pwd = new UserBLL().GetRandomPassword(8);//随机密码

            if (!phone.IsPhone())
            {
                return("手机号码格式不正确");
            }

            string strIp = Tool.WebFormHandler.GetIP();

            string[] ips    = strIp.Split(',');
            string   realIp = ips.Length > 1 ? ips[1] : ips[0];
            string   result = Users.UserIsRegByIP(realIp);

            if (result != "1")
            {
                string dt = result.Split('|')[1];
                return("注册失败:为防止恶意注册,请在" + dt + "后重新注册");
            }

            Guid userid = Guid.NewGuid();
            //var model = WXRegister.AddUserInfo(userid, _app, pwd, phone, "", "",
            //    "", "", 0, realIp);


            string from = _app;

            if (!string.IsNullOrEmpty(_appUserId))
            {
                from += "_" + _appUserId;
            }
            #region 写用户信息
            UserRegisterInfo registerUser = new UserRegisterInfo();
            registerUser.Id             = userid;
            registerUser.ExtenderKey    = "";
            registerUser.UserName       = string.Format("{0}wx{1}", phone, DateTime.Now.ToString("yyMMdd")); //针对重复注册特殊处理
            registerUser.Pwd            = pwd;
            registerUser.Email          = string.Empty;
            registerUser.TelNo          = phone;
            registerUser.ThirdPartyId   = string.Empty;
            registerUser.ThirdPartyType = (int)ConstString.ThirdPartyType.TuandaiUser;
            registerUser.RegisterFrom   = from;
            registerUser.RegisterIP     = realIp;
            registerUser.OpenId         = GlobalUtils.OpenId;
            registerUser.NickName       = registerUser.UserName;
            string msg = string.Empty;
            var    userBasicInfoInfo = new UserBLL().RegiserUser(registerUser, ref msg);
            if (userBasicInfoInfo != null && !string.IsNullOrEmpty(userBasicInfoInfo.ExtenderKey))
            {
                //记录日志
                SysLogHelper.WriteErrorLog("会员推广_AddUserInfo", "UserName:" + userBasicInfoInfo.UserName + ";ExtendKey:" + userBasicInfoInfo.ExtenderKey);
            }
            #endregion

            if (userBasicInfoInfo != null)
            {
                RegisterUserHandler.AsyncAfterRegister(_app, userBasicInfoInfo);

                if ((userBasicInfoInfo.uStatus ?? 0) == 1)
                {
                    var isNewSmsRequest = ConfigHelper.getConfigString("IsNewSmsRequest", "0");
                    if (isNewSmsRequest == "0")
                    {
                        //改用新的发短信,邮件,系统消息
                        var messageSender = new MessageSend();
                        //var parameters = new Dictionary<string, object>();
                        //parameters.Add("User", model);
                        //parameters.Add("CurrentDate", DateTime.Now);
                        //parameters.Add("ExtenderKey", model.ExtenderKey);
                        //messageSender.SendMessage2(eventCode: MessageTemplates.RegisterSuccess, parameters: parameters, mobile: model.TelNo, email: model.Email, userId: model.Id);

                        //将生成的密码已短信方式发送给用户
                        var parameters = new Dictionary <string, object>();
                        parameters.Add("PassWord", pwd);
                        messageSender.SendMessage2(option: SendOption.Sms, eventCode: MessageTemplates.BindMobile,
                                                   parameters: parameters, mobile: userBasicInfoInfo.TelNo);
                    }
                    else
                    {
                        SmsRequest rechargeSuccessSmsRequest = new SmsRequest();
                        rechargeSuccessSmsRequest.EventCode      = MsgTemplatesType.BindMobile;
                        rechargeSuccessSmsRequest.PlatformSource = PlatformSource.WeiXin;
                        rechargeSuccessSmsRequest.UserId         = userBasicInfoInfo.Id;
                        rechargeSuccessSmsRequest.EmailAddress   = userBasicInfoInfo.Email;
                        rechargeSuccessSmsRequest.Mobile         = userBasicInfoInfo.TelNo;
                        rechargeSuccessSmsRequest.Parameters     = new Dictionary <string, object>();
                        rechargeSuccessSmsRequest.Parameters.Add("PassWord", pwd);

                        string errorMessage = string.Empty;
                        SmsClient.SendMessage(rechargeSuccessSmsRequest, ref errorMessage);
                    }

                    try
                    {
                        TuanDai.InfoSystem.Model.LoginLog loginLogEntity = new TuanDai.InfoSystem.Model.LoginLog();
                        loginLogEntity.Id         = Guid.NewGuid().ToString();
                        loginLogEntity.UserId     = userBasicInfoInfo.Id.ToString();
                        loginLogEntity.IpAddress  = Tool.WebFormHandler.GetIP();
                        loginLogEntity.LoginDate  = DateTime.Now;
                        loginLogEntity.DeviceType = "WeiXin";
                        loginLogEntity.DeviceName = _app + "自动注册登录";
                        //LoginLogService logApi = new LoginLogService();
                        //logApi.AddLoginLog(loginLogEntity);
                        TuanDai.WXApiWeb.SysLogHelper.AddLoginLog(loginLogEntity);
                    }
                    catch (Exception ex)
                    {
                        NetLog.WriteLoginHandler("写入注册成功登录日志出错", Tool.ExceptionHelper.GetExceptionMessage(ex));
                    }
                }

                #region 注册成功后自动登录

                if (GlobalUtils.IsWeiXinBrowser)
                {
                    string strOpenId = TuanDai.WXApiWeb.Common.WeiXinApi.GetUserWXOpenId(userBasicInfoInfo.Id);
                    if (strOpenId.IsNotEmpty())
                    {
                        GlobalUtils.WriteOpenIdToCookie(strOpenId.ToText());
                    }
                }
                WebUserAuth.SignIn(userid.ToString());

                #endregion
            }
            else
            {
                return("添加用户失败");
            }
            return(string.Empty);
        }
Пример #13
0
        /// <summary>
        /// 标的申购
        /// </summary>
        private string Project()
        {
            try
            {
                bool data = SecurityValidation();

                string       url;
                Guid         projId = Guid.Parse(_pid);
                WeProductBLL bll    = new WeProductBLL();
                //WeProductDetailInfo weProductDetailtInfo = bll.GetWeProductInfo(projId);
                WeProductDetailInfo weProductDetailtInfo = null;
                if (GlobalUtils.IsRedis && GlobalUtils.IsWePlanRedis)
                {
                    string err         = string.Empty;
                    var    weRedisInfo = TuanDai.RedisApi.Client.WePlanRedis.GetWePlanRedisByProductIdJson(projId,
                                                                                                           out err, TdConfig.ApplicationName);
                    if (weRedisInfo != null)
                    {
                        weProductDetailtInfo = JsonConvert.DeserializeObject <WeProductDetailInfo>(weRedisInfo);
                    }
                    if (weProductDetailtInfo == null || !string.IsNullOrEmpty(err))
                    {
                        weProductDetailtInfo = new WeProductBLL().GetWeProductInfo(projId);
                    }
                }
                else
                {
                    weProductDetailtInfo = new WeProductBLL().GetWeProductInfo(projId);
                }
                if (weProductDetailtInfo != null)
                {
                    if (weProductDetailtInfo.IsWeFQB)
                    {
                        url = string.Format("/pages/invest/WE/WeFqb_detail.aspx?id={0}", projId);
                    }
                    else if (weProductDetailtInfo.IsFTB)
                    {
                        url = string.Format("/pages/invest/WE/WeFtb_detail.aspx?id={0}", projId);
                    }
                    else
                    {
                        url = string.Format("/pages/invest/WE/WE_detail.aspx?id={0}", projId);
                    }
                    url += "&typeId=" + weProductDetailtInfo.ProductTypeId + "&IsPreSell=" + (weProductDetailtInfo.IsPreSell ? 1 : 0).ToString();
                }
                else
                {
                    url = GlobalUtils.WebURL;
                }
                //url = "/pages/invest/detail.aspx?id=" + data[2];
                if (!data)
                {
                    return(url);
                }

                return(JumpBase(_telNo, url));
            }
            catch (Exception ex)
            {
                SysLogHelper.WriteErrorLog(_app + "标的申购出错", ExceptionHelper.GetExceptionMessage(ex));
                return(GlobalUtils.WebURL);
            }
        }
Пример #14
0
        private string Goto(string action)
        {
            try
            {
                bool data = SecurityValidation();
                if (!data)
                {
                    return(GlobalUtils.WebURL);
                }
                string url = string.Empty;
                switch (action)
                {
                case "account":     //账户首页
                    url = GlobalUtils.WebURL + "/Member/my_account.aspx";
                    break;

                case "drawmoney":     //提现
                    url = GlobalUtils.WebURL + "/Member/withdrawal/drawmoney.aspx";
                    break;

                case "recharge":     //充值
                    url = GlobalUtils.WebURL + "/Member/Bank/Recharge.aspx";
                    break;

                case "list":
                    url = GlobalUtils.WebURL + "/pages/invest/invest_list.aspx";
                    break;

                default:
                    url = GlobalUtils.WebURL;
                    break;
                }

                return(JumpBase(_telNo, url));
            }
            catch (Exception ex)
            {
                string actName = string.Empty;
                switch (action)
                {
                case "account":     //账户首页
                    actName = "账户首页";
                    break;

                case "drawmoney":     //提现
                    actName = "提现";
                    break;

                case "recharge":     //充值
                    actName = "充值";
                    break;

                case "list":
                    actName = "投资列表";
                    break;

                default:
                    break;
                }
                SysLogHelper.WriteErrorLog(_app + actName + "接口出错", ExceptionHelper.GetExceptionMessage(ex));
                return(GlobalUtils.WebURL);
            }
        }
Пример #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Guid userid = WebUserAuth.UserId.Value;

            decimal Amount = Tool.SafeConvert.ToDecimal(Request.Params["Amount"], 0);

            //if (Amount < 100)
            //{
            //    Response.Write("您好,充值金额必须大于或者等于100!");
            //    return;
            //}

            if (Amount > 5000000)
            {
                Response.Write("单次充值不能超过500万!");
                return;
            }


            NoHandler noHandler = new NoHandler();
            string    orderNo   = noHandler.OnLineRechare();

            if (orderNo == "0")
            {
                Response.Write("您好,您的提交失败请重试!");
                return;
            }

            int  Sel        = Tool.SafeConvert.ToInt32(Request.Params["Sel"], 12);
            Guid rechargeId = Guid.NewGuid();
            int  outStatus  = 0;

            //string bankcode = "";
            //bankcode = Request.Params["bankcode"];
            ////if (Request.Params["bankcode"] != null)
            ////{

            ////}

            //if (string.IsNullOrEmpty(bankcode))
            //{
            //    Response.Write("您好,银行编号获取错误!" + Request.QueryString["bankcode"]);
            //    return;
            //}

            string userIP = Tool.WebFormHandler.GetIP();

            var paramData = new Dapper.DynamicParameters();

            paramData.Add("@userid", userid);
            paramData.Add("@type", Sel);
            paramData.Add("@amount", Amount);
            paramData.Add("@orderNo", orderNo);
            paramData.Add("@backcode", "");
            paramData.Add("@clientIp", userIP);
            paramData.Add("@from", "5");
            paramData.Add("@outStatus", 0, System.Data.DbType.Int32, System.Data.ParameterDirection.Output);
            TuanDai.WXApiWeb.PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "AccountRechargeInit",
                                                  ref paramData, CommandType.StoredProcedure);
            outStatus = paramData.Get <int>("@outStatus");

            int result = outStatus;

            //NetLog.WriteLoginHandler("宝付5-调用写入充值记录存储过AccountRechargeInit", "UserId:"+userid+",Sel:"+Sel+",Amount:"+Amount+",OrderNo:"+orderNo+",bankcode:"+bankcode+",OutStatus:"+outStatus.Value.ToString());
            if (result > 0)
            {
                //NetLog.WriteLoginHandler("宝付6","进入写入来源" );
                AccountRechareInfo ar = null;
                lock (lockstatus)
                {
                    ar = getAccountRechare(orderNo);
                }
                //1:PC
                if (null == ar)
                {
                    Response.Write("您好,您的提交失败请重试!");
                }

                ar.From = 5;
                //ar.CradNo = db.UserBasicInfo.FirstOrDefault(x => x.Id == userid).BankAccountNo;

                if (UpdateAccountRechare(ar) <= 0)
                {
                    Response.Write("您好,您的提交失败请重试!");
                    return;
                }

                //NetLog.WriteLoginHandler("宝付7", "进入跳转");
                var url = "/PaymentPlatform/Baofu/pay_post.aspx?orderno=" + orderNo + "&totalprice=" + Amount + "&PayID=";
                //NetLog.WriteLoginHandler("宝付8--跳转的URL", url);
                try
                {
                    Response.Redirect(url, false);
                }
                catch (Exception ex)
                {
                    SysLogHelper.WriteErrorLog("宝付9跳转错误", "错误详细信息:" + ex.Message + "|" + ex.StackTrace);
                }
            }
            else
            {
                Response.Write("您好,您的提交失败请重试!");
            }
        }
Пример #16
0
        private void InitData()
        {
            try
            {
                WebSettingInfo webSetting = new WebSettingBLL().GetWebSettingInfo("fe5e5a30-b12c-4888-9858-12cbe80e1018");

                string MemberID       = Request.Params["MemberID"];          //商户号
                string TerminalID     = Request.Params["TerminalID"];        //商户终端号
                string TransID        = Request.Params["TransID"];           //商户流水号
                string Result         = Request.Params["Result"];            //支付结果(1:成功,0:失败)
                string ResultDesc     = Request.Params["ResultDesc"];        //支付结果描述
                string FactMoney      = Request.Params["FactMoney"];         //实际成交金额
                string AdditionalInfo = Request.Params["AdditionalInfo"];    //订单附加消息
                string SuccTime       = Request.Params["SuccTime"];          //交易成功时间
                string Md5Sign        = Request.Params["Md5Sign"].ToLower(); //md5签名
                string Md5Key         = "abcdefg";                           //webSetting.Param2Value;//ConfigurationManager.AppSettings["Md5key"];//密钥 双方约定
                String mark           = "~|~";                               //分隔符

                //string _Md5Key = "100000178";//测试商户号//webSetting.Param1Value;//WebConfigurationManager.AppSettings["Md5key"];

                string _WaitSign = "MemberID=" + MemberID + mark + "TerminalID=" + TerminalID + mark + "TransID=" + TransID + mark + "Result=" + Result + mark + "ResultDesc=" + ResultDesc + mark
                                   + "FactMoney=" + FactMoney + mark + "AdditionalInfo=" + AdditionalInfo + mark + "SuccTime=" + SuccTime
                                   + mark + "Md5Sign=" + Md5Key;

                SysLogHelper.WriteTraceLog("等待验签参数", _WaitSign);
                //验证签名成功
                if (Md5Sign.ToLower() == Md5Encrypt(_WaitSign).ToLower())
                {
                    ///支付结果(1:成功,0:失败)
                    DynamicParameters dyParams = new DynamicParameters();
                    string            strSQL   = "";
                    if (Result == "1")
                    {
                        strSQL   = "p_OnLineRechargeHandler";
                        dyParams = new DynamicParameters();
                        dyParams.Add("@handlerStatus", 2);
                        dyParams.Add("@MediumMoney", decimal.Divide(decimal.Parse(FactMoney), 100));
                        dyParams.Add("@MediumOrderNo", (TransID + SuccTime).Trim());
                        dyParams.Add("@outStatus", 0, DbType.Int32, ParameterDirection.Output, 20);

                        PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, strSQL, ref dyParams, CommandType.StoredProcedure);

                        int presult = dyParams.Get <int>("@outStatus");

                        SysLogHelper.WriteTraceLog("宝付支付交易成功", string.Concat("签名:", Md5Sign.ToLower(), "签名方式:", "MD5", "我方处理状态:", presult.ToString().Trim(), "宝付处理状态:", Result, "支付单号:", TransID));

                        AccountRechareInfo accountRechare = getAccountRechare(TransID);
                        if (accountRechare != null)
                        {
                            strSQL   = "select count(1) from AccountRechare where UserId=@userId and Status=2 and  [type] in(2, 3, 4, 6, 8, 12)";
                            dyParams = new DynamicParameters();
                            dyParams.Add("@userId", accountRechare.UserId);
                            int iCount = PublicConn.QuerySingleWrite <int>(strSQL, ref dyParams);
                            if (iCount > 0)
                            {
                                TuanDai.PortalSystem.BLL.VipGetWorthBLL.AddGetWorth(accountRechare.UserId, (int)ConstString.UserGrowthType.FirstReCharge, null, 0);
                            }
                            UserBasicInfoInfo userBasicInfo = new UserBLL().GetUserBasicInfoModelById(accountRechare.UserId);
                            if (userBasicInfo != null)
                            {
                                var isNewSmsRequest = ConfigHelper.getConfigString("IsNewSmsRequest", "0");
                                if (isNewSmsRequest == "0")
                                {
                                    var parameters = new Dictionary <string, object>();
                                    parameters.Add("CurrentDate", DateTime.Now);
                                    //parameters.Add("RechargeMoney", FactMoney);
                                    parameters.Add("RechargeMoney", decimal.Divide(decimal.Parse(FactMoney), 100));//宝付充值以分为单位
                                    parameters.Add("User", userBasicInfo);
                                    parameters.Add("Host", GlobalUtils.WebURL);

                                    var msgSender = new BusinessDll.MessageSend();
                                    msgSender.SendMessage2(eventCode: MessageTemplates.RechargeSuccess, parameters: parameters,
                                                           mobile: userBasicInfo.TelNo, email: userBasicInfo.Email, userId: userBasicInfo.Id);
                                }
                                else
                                {
                                    SmsRequest rechargeSuccessSmsRequest = new SmsRequest();
                                    rechargeSuccessSmsRequest.EventCode      = MsgTemplatesType.RechargeSuccess;
                                    rechargeSuccessSmsRequest.PlatformSource = PlatformSource.Pc;
                                    rechargeSuccessSmsRequest.UserId         = userBasicInfo.Id;
                                    rechargeSuccessSmsRequest.EmailAddress   = userBasicInfo.Email;
                                    rechargeSuccessSmsRequest.Mobile         = userBasicInfo.TelNo;
                                    rechargeSuccessSmsRequest.Parameters     = new Dictionary <string, object>();
                                    rechargeSuccessSmsRequest.Parameters.Add("RechargeMoney", FactMoney);

                                    string errorMessage = string.Empty;
                                    SmsClient.SendMessage(rechargeSuccessSmsRequest, ref errorMessage);
                                }
                            }
                        }
                        Response.Write("OK");
                        Response.End();
                    }

                    //if (Result == "0")
                    //{
                    //    db.p_OnLineRechargeHandler(1, TransID.Trim(), decimal.Divide(decimal.Parse(FactMoney), 100), (TransID + SuccTime).Trim(), outStatus);
                    //    int presult = int.Parse(outStatus.Value.ToString());
                    //    NetLog.WriteLoginHandler("宝付支付交易失败", string.Concat("签名:", Md5Sign.ToLower(), "签名方式:", "MD5", "我方处理状态:", presult.ToString().Trim(), "宝付处理状态:", Result, "支付单号:", TransID));

                    //    Response.Write("Fail");
                    //}
                }
                else
                {
                    SysLogHelper.WriteTraceLog("宝付验签失败", string.Concat("宝付返回签名:", Md5Sign.ToLower(), "等待验签", Md5Encrypt(_WaitSign).ToLower(), "签名方式:", "MD5", "宝付处理状态:", Result));
                    Response.Write("校验失败");
                    Response.End();
                }
            }
            catch (Exception ex)
            {
                SysLogHelper.WriteErrorLog("宝付支付失败", "错误详细信息:" + ex.Message + "|" + ex.StackTrace);
                Response.Write("Fail");
                Response.End();
            }
        }