Exemple #1
0
        //获取中止转让验证码
        public void GetStopTranCode()
        {
            Guid              userid  = WebUserAuth.UserId.Value;
            UserBLL           userbll = new UserBLL();
            UserBasicInfoInfo model   = userbll.GetUserBasicInfoModelById(userid);

            if (model == null)
            {
                PrintJson("-1", "用户不存在");
            }

            //string random = StringUtilily.GetRandomString(6);
            string telNo = model.TelNo;
            string strIP = Tool.WebFormHandler.GetIP();

            //TuanDB.CodeRecord codeRecord = new TuanDB.CodeRecord();
            //codeRecord.Id = Guid.NewGuid();
            //codeRecord.UserId = userid;
            //codeRecord.Code = random;
            //codeRecord.AddDate = DateTime.Now;
            //codeRecord.Status = 0;
            //codeRecord.Type = 2;
            //codeRecord.Type2 = 20;
            //codeRecord.token = token;
            //codeRecord.TypeValue = telNo;
            //db.CodeRecord.AddObject(codeRecord);
            //if (db.SaveChanges() > 0)
            var canSend = new CodeRecordBLL().IsCanSendNewCodeRecord(telNo, MsCodeType.PhoneCode, MsCodeType2.PCStopTransferCode, null, 1, strIP);

            if (!canSend.Success)
            {
                PrintJson("-1", canSend.Message);
            }
            var code = new CodeRecordBLL().CreateCodeRecordInfo(userid, "", MsCodeType.PhoneCode, MsCodeType2.PCStopTransferCode, telNo);

            if (code != null)
            {
                var parameters = new Dictionary <string, object>();
                parameters.Add("ValidateCode", code.Code);
                var msgSender  = new BusinessDll.MessageSend();
                var sendResult = msgSender.SendMessage2(option: SendOption.Sms,
                                                        eventCode: MessageTemplates.ValidateCode, parameters: parameters, mobile: telNo, content: code.Code);
                if (sendResult != "1")
                {
                    PrintJson("-1", "短信发送失败");
                }
                else
                {
                    PrintJson("1", "");
                }
            }
            else
            {
                PrintJson("-1", "短信发送失败");
            }
        }
Exemple #2
0
        public void SendCode()
        {
            string mobilePhone = Context.Request.Form["mobilePhone"];

            if (!mobilePhone.IsPhone())
            {
                Response.Write("{\"result\":\"-2\",\"msg\":\"手机号格式不对\"}");
                Response.End();
            }
            var model = new UserBLL().GetUserBasicInfoModelByTelNo(mobilePhone);

            if (model == null)
            {
                Response.Write("{\"result\":\"-1\",\"msg\":\"手机号未在团贷网注册\"}");
                Response.End();
            }
            string err   = "";
            var    ulist = RedisServerStack.StringGet <List <account_manager.WeiXinUser> >(TdConfig.ApplicationName, "/redis/web",
                                                                                           GlobalUtils.OpenId, ref err);

            if (ulist != null && ulist.Exists(o => o.UserId == model.Id))
            {
                Response.Write("{\"result\":\"-3\",\"msg\":\"账号已在微信绑定列表中\"}");
                Response.End();
            }
            var result = new CodeRecordBLL().IsCanSendNewCodeRecord(mobilePhone, MsCodeType.PhoneCode, MsCodeType2.BindWeiXinOpenId, model.Id);

            if (!result.Success)
            {
                Response.Write("{\"result\":\"" + result.Code.ToString() + "\",\"msg\":\"" + result.Message + "\"}");
                Response.End();
            }
            var code = new CodeRecordBLL().CreateCodeRecordInfo(model.Id, "", MsCodeType.PhoneCode, MsCodeType2.BindWeiXinOpenId, mobilePhone);

            if (code != null)
            {
                var parameters = new Dictionary <string, object>();
                parameters.Add("ValidateCode", code.Code);
                var msgSender = new BusinessDll.MessageSend();
                msgSender.SendMessage2(option: SendOption.Sms, eventCode: MessageTemplates.ValidateCode, parameters: parameters, mobile: mobilePhone);
                Response.Write("{\"result\":\"1\",\"msg\":\"已发送,3分钟后可重新获取。\"}");
                Response.End();
            }
            else
            {
                Response.Write("{\"result\":\"0\",\"msg\":\"验证码发送失败,请重试。\"}");
                Response.End();
            }
        }
Exemple #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        WebSettingInfo webSetting = new WebSettingBLL().GetWebSettingInfo("E27798C9-9301-4176-AC0B-6F3916F389EA");

        partnerConfig = new PartnerConfig(webSetting.Param1Value, webSetting.Param2Value, webSetting.Param3Value, webSetting.Param5Value);
        SortedDictionary <string, string> sPara = GetRequestPost();

        if (null == sPara)
        {
            Response.End();
        }

        if (sPara.Count > 0)//判断是否有带返回参数
        {
            NetLog.WriteBatchwithdrawHandler("接收连连支付异步通知数据", string.Concat("【", "签名:", sPara["sign"].ToString(), "签名方式:", sPara["sign_type"].ToString(), "我方订单号:", sPara["no_order"].ToString(), "充值金额:", sPara["money_order"].ToString(), "连连订单号:", sPara["oid_paybill"].ToString(), "】"));

            if (!PaymentUtil.CheckSign(sPara, partnerConfig.YTPublicKey, //验证失败
                                       partnerConfig.MD5Key))
            {
                var out_trade_no   = sPara["no_order"].ToString();
                var rechargeMoney  = sPara["money_order"].ToString();
                var transaction_id = sPara["oid_paybill"].ToString();

                //ObjectParameter outStatus = new ObjectParameter("outStatus", "0");
                //db.p_OnLineRechargeHandler(1, out_trade_no, decimal.Parse(rechargeMoney), transaction_id, outStatus);
                //int result = int.Parse(outStatus.Value.ToString());

                NetLog.WriteBatchwithdrawHandler("连连验签失败", string.Concat("签名:", sPara["sign"].ToString(), "签名方式:", sPara["sign_type"].ToString(), "连连处理状态:9999"));

                Response.Write(@"{""ret_code"":""9999"",""ret_msg"":""验签失败""}");
                Response.End();
            }
            else
            {
                var out_trade_no   = sPara["no_order"].ToString();
                var rechargeMoney  = sPara["money_order"].ToString();
                var transaction_id = sPara["oid_paybill"].ToString();

                string            strSQL   = "p_OnLineRechargeHandler";
                DynamicParameters dyParams = new DynamicParameters();
                dyParams.Add("@orderno", out_trade_no);
                dyParams.Add("@MediumMoney", decimal.Parse(rechargeMoney));
                dyParams.Add("@MediumOrderNo", transaction_id);
                dyParams.Add("@outStatus", 0, DbType.Int32, ParameterDirection.Output, 20);

                if (sPara["result_pay"].ToString().ToLower() == "success".ToLower())
                {
                    dyParams.Add("@handlerStatus", 2);
                }
                else
                {
                    dyParams.Add("@handlerStatus", 1);
                }
                PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, strSQL, ref dyParams, CommandType.StoredProcedure);
                int result = dyParams.Get <int>("@outStatus");

                AccountRechareInfo accountRechare = getAccountRechare(out_trade_no);
                if (accountRechare != null)
                {
                    var para = new DynamicParameters();
                    para.Add("@UserId", accountRechare.UserId);
                    var count = PublicConn.QuerySingleWrite <int>("select count(0) from AccountRechare with(nolock) where UserId=@UserId and Status =2   and type in (2, 3, 4, 6, 8, 12)", ref para);
                    if (count == 1)
                    {
                        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("User", userBasicInfo);
                            parameters.Add("CurrentDate", DateTime.Now);
                            parameters.Add("RechargeMoney", rechargeMoney);
                            parameters.Add("Host", GlobalUtils.WebURL);

                            var messageSender = new BusinessDll.MessageSend();
                            messageSender.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", rechargeMoney);

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



                        //第三方渠道回调
                        try
                        {
                            TuanDai.PortalSystem.BLL.ThirdPartyChannel.RechargeCallBack(accountRechare.Id, accountRechare.UserId);
                        }
                        catch (Exception ex)
                        {
                            new TuanDai.LogSystem.LogClient.LogClients().WriteErrorLog(
                                "TuanDai.PortalSystem.BLL.ThirdPartyChannel.RechargeCallBack",
                                "", "", ex.Message);
                        }
                    }
                }

                NetLog.WriteTraceLogHandler("交易成功", string.Concat("签名:", sPara["sign"].ToString(), "签名方式:", sPara["sign_type"].ToString(), "我方处理状态:", result.ToString().Trim(), "连连处理状态:", sPara["result_pay"].ToString()));
                Response.Write(@"{""ret_code"":""0000"",""ret_msg"":""交易成功""}");
                Response.End();
            }
        }
        else
        {
            //var out_trade_no = sPara["no_order"].ToString();
            //var rechargeMoney = sPara["money_order"].ToString();
            //var transaction_id = sPara["oid_paybill"].ToString();

            //ObjectParameter outStatus = new ObjectParameter("outStatus", "0");
            //db.p_OnLineRechargeHandler(1, out_trade_no, decimal.Parse(rechargeMoney), transaction_id, outStatus);
            ////Response.Write(@"{""ret_code"":""9999"",""ret_msg"":""验签失败""}");

            //int result = int.Parse(outStatus.Value.ToString());

            NetLog.WriteBatchwithdrawHandler("连连交易参数为空失败", "连连处理状态:9999");
            Response.Write(@"{""ret_code"":""9999"",""ret_msg"":""交易失败""}");
            Response.End();
        }

        // 解析异步通知对象
        // sPara 字典对象
        // TODO:更新订单,发货等后续处理
    }
Exemple #4
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();
            }
        }
Exemple #5
0
        public void GetZhphApplySMSCode()
        {
            Guid userid = WebUserAuth.UserId.Value;
            //UserBasicInfo model = db.UserBasicInfo.FirstOrDefault(p => p.Id == userid);
            var model = new UserBLL().GetUserBasicInfoModelById(userid);

            if (model == null)
            {
                PrintJson("-1", "用户不存在");
            }
            string mobileNo = WEBRequest.GetFormString("mobileno");

            if (mobileNo.ToText().IsEmpty())
            {
                PrintJson("-1", "未输入手机号");
            }

            //string random = StringUtilily.GetRandomString(6);
            string telNo = mobileNo;
            string token = Tool.Encryption.MD5(userid.ToString());

            //CodeRecord codeRecord = new CodeRecord();
            //codeRecord.Id = Guid.NewGuid();
            //codeRecord.UserId = userid;
            //codeRecord.Code = random;
            //codeRecord.AddDate = DateTime.Now;
            //codeRecord.Status = 0;
            //codeRecord.Type = MsCodeType.PhoneCode;
            //codeRecord.Type2 = MsCodeType2.ZhphFastLoanCode;
            //codeRecord.token = token;
            //codeRecord.TypeValue = telNo;
            //db.CodeRecord.AddObject(codeRecord);
            var canSend = new CodeRecordBLL().IsCanSendNewCodeRecord(telNo, MsCodeType.PhoneCode, MsCodeType2.ZhphFastLoanCode,
                                                                     null, 1, token);

            if (!canSend.Success)
            {
                PrintJson("-1", "一天之内最多发送5次!");
            }
            var code = new CodeRecordBLL().CreateCodeRecordInfo(userid, Tool.WebFormHandler.GetIP(),
                                                                MsCodeType.PhoneCode, MsCodeType2.ZhphFastLoanCode, telNo);

            //if (db.SaveChanges() > 0)
            if (code != null)
            {
                var parameters = new Dictionary <string, object>();
                parameters.Add("ValidateCode", code.Code);
                var msgSender  = new BusinessDll.MessageSend();
                var sendResult = msgSender.SendMessage2(option: SendOption.Sms,
                                                        eventCode: MessageTemplates.ValidateCode, parameters: parameters, mobile: telNo, content: code.Code);
                if (sendResult != "1")
                {
                    PrintJson("-1", "短信发送失败");
                }
                else
                {
                    PrintJson("1", "");
                }
            }
            else
            {
                PrintJson("-1", "短信发送失败");
            }
        }