/// <summary> /// 构造用户开户对象及签名 /// </summary> /// <param name="mobile">用户手机号</param> /// <param name="userName">用户名(当前同为手机号)</param> /// <returns></returns> public static M_UserRegister UserRegister(string mobile, string userName) { M_UserRegister m = new M_UserRegister(); m.MerId = Utils.GetMerId(); m.Version = "10"; m.CmdId = "UserRegister"; m.MerCustId = Utils.GetMerCustID(); m.BgRetUrl = Utils.GetRe_url("Thirdparty/Bg_Succ_Registered"); m.RetUrl = Utils.GetRe_url("Register/Succ_Registered"); m.UsrMp = mobile; m.UsrId = userName; StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.Version); chkVal.Append(m.CmdId); chkVal.Append(m.MerCustId); chkVal.Append(m.BgRetUrl); chkVal.Append(m.RetUrl); chkVal.Append(m.UsrId); chkVal.Append(m.UsrMp); string chkv = chkVal.ToString(); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr(); //需要指定提交字符串的长度 int len = Encoding.UTF8.GetBytes(chkv).Length; StringBuilder sbChkValue = new StringBuilder(256); //加签 int str = DllInterop.SignMsg(m.MerId, merKeyFile, chkv, len, sbChkValue); m.ChkValue = sbChkValue.ToString(); LogInfo.WriteLog("注册开户请求报文:" + FastJSON.toJOSN(m)); return(m); }
/// <summary> /// 复核 汇付通知页 /// </summary> /// <returns></returns> public ActionResult RePostCashProcessing() { ReCashAudit m = new ReCashAudit(); m.CmdId = DNTRequest.GetString("CmdId"); m.RespCode = DNTRequest.GetString("RespCode"); m.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); m.MerCustId = DNTRequest.GetString("MerCustId"); m.OrdId = DNTRequest.GetString("OrdId"); m.UsrCustId = DNTRequest.GetString("UsrCustId"); m.TransAmt = DNTRequest.GetString("TransAmt"); m.OpenAcctId = DNTRequest.GetString("OpenAcctId"); m.OpenBankId = DNTRequest.GetString("OpenBankId"); m.AuditFlag = DNTRequest.GetString("AuditFlag"); m.FeeAmt = DNTRequest.GetString("FeeAmt"); m.FeeCustId = DNTRequest.GetString("FeeCustId"); m.FeeAcctId = DNTRequest.GetString("FeeAcctId"); m.RetUrl = DNTRequest.GetString("RetUrl"); m.BgRetUrl = DNTRequest.GetString("BgRetUrl"); m.MerPriv = DNTRequest.GetString("MerPriv"); m.ChkValue = DNTRequest.GetString("ChkValue"); LogInfo.WriteLog("取现审核返回参数:" + FastJSON.toJOSN(m)); BusinessLogicHelper.RePostCashHelper(m); ViewBag.info = Utils.GetReturnCode(Int32.Parse(m.RespCode)); return(View()); }
/// <summary> /// 用户资金解冻 /// </summary> /// <param name="ordDate">冻结单</param> /// <param name="freezeTrxId">冻结号</param> /// <returns></returns> public static M_UsrUnFreeze UsrUnFreeze(string ordDate, string freezeTrxId) { M_UsrUnFreeze m = new M_UsrUnFreeze(); m.Version = "10"; m.CmdId = "UsrUnFreeze"; m.MerCustId = Utils.GetMerCustID(); m.OrdId = Utils.Createcode(); m.OrdDate = ordDate; m.TrxId = freezeTrxId; m.RetUrl = ""; m.BgRetUrl = Utils.GetRe_url("Thirdparty/BG_UsrUnFreeze"); m.MerPriv = Utils.Base64Encoder("chuanglitou"); string chkv = CFormHelper.GetChkValue <M_UsrUnFreeze>(m); LogInfo.WriteLog("解冻加签chkv字符:" + chkv); string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr(); int len = Encoding.UTF8.GetBytes(chkv).Length; StringBuilder sbChkValue = new StringBuilder(256); int ret = DllInterop.SignMsg(Utils.GetMerId(), merKeyFile, chkv, len, sbChkValue); m.ChkValue = sbChkValue.ToString(); LogInfo.WriteLog("解冻提交信息:" + FastJSON.toJOSN(m)); LogInfo.WriteLog("解冻ChkValue:" + m.ChkValue); if (ret == 0) { return(m); } return(null); }
/// <summary> /// 平台向用户转账 回调 /// </summary> /// <param name="ret">out 返回状态值</param> /// <param name="isFront">是否是前台form形式调用</param> /// <returns></returns> public static ReTransfer TransferCallBack(out int ret, bool isFront = true) { ReTransfer m = new ReTransfer(); m.CmdId = DNTRequest.GetString("CmdId"); m.RespCode = DNTRequest.GetString("RespCode"); m.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); m.OrdId = DNTRequest.GetString("OrdId"); m.OutCustId = DNTRequest.GetString("OutCustId"); m.OutAcctId = DNTRequest.GetString("OutAcctId"); m.TransAmt = DNTRequest.GetString("TransAmt"); m.InCustId = DNTRequest.GetString("InCustId"); m.InAcctId = DNTRequest.GetString("InAcctId"); m.RetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl")); m.BgRetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl")); m.MerPriv = DNTRequest.GetString("MerPriv"); m.ChkValue = DNTRequest.GetString("ChkValue"); string chkv = CFormHelper.GetChkValue <ReTransfer>(m); LogInfo.WriteLog(chkv); string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); ret = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, m.ChkValue); LogInfo.WriteLog("平台向用户转账" + (isFront ? "前台" : "后台" + "返回报文:") + FastJSON.toJOSN(m)); LogInfo.WriteLog("平台向用户活动转账后---1台验签:" + ret.ToString()); if (ret == 0) { return(m); } return(null); }
/// <summary> /// 绑卡回调 /// </summary> /// <param name="ret">out 返回状态值</param> /// <param name="isFront">是否是前台form形式调用</param> /// <returns></returns> public static ReUserBindCard UserBindCardCallBack(out int ret, bool isFront = true) { ReUserBindCard m = new ReUserBindCard(); m.CmdId = DNTRequest.GetString("CmdId"); m.RespCode = DNTRequest.GetString("RespCode"); m.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); m.MerCustId = DNTRequest.GetString("MerCustId"); m.OpenAcctId = DNTRequest.GetString("OpenAcctId"); m.OpenBankId = DNTRequest.GetString("OpenBankId"); m.UsrCustId = DNTRequest.GetString("UsrCustId"); m.TrxId = DNTRequest.GetString("TrxId"); m.BgRetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl")); m.MerPriv = HttpUtility.UrlDecode(DNTRequest.GetString("MerPriv")); m.ChkValue = DNTRequest.GetString("ChkValue"); string chkv = CFormHelper.GetChkValue <ReUserBindCard>(m); LogInfo.WriteLog(chkv); string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); ret = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, m.ChkValue); LogInfo.WriteLog("绑卡" + (isFront ? "前台" : "后台" + "返回报文:") + FastJSON.toJOSN(m)); LogInfo.WriteLog("绑卡---1台验签:" + ret.ToString()); if (ret == 0) { return(m); } return(null); }
/// <summary> /// 绑卡 /// </summary> /// <param name="usrCustId">用户客户号</param> /// <returns></returns> public static M_UserBindCard UserBindCard(string usrCustId) { M_UserBindCard m = new M_UserBindCard(); m.Version = "10"; m.CmdId = "UserBindCard"; m.MerCustId = Utils.GetMerCustID(); m.BgRetUrl = Utils.GetRe_url("Thirdparty/Bgthirdpartybindbank"); m.MerPriv = Utils.Base64Encoder("chuanglitou"); m.UsrCustId = usrCustId; string chkv = CFormHelper.GetChkValue <M_UserBindCard>(m); LogInfo.WriteLog(chkv); string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr(); int len = Encoding.UTF8.GetBytes(chkv).Length; StringBuilder sbChkValue = new StringBuilder(256); int ret = DllInterop.SignMsg(Utils.GetMerId(), merKeyFile, chkv, len, sbChkValue); m.ChkValue = sbChkValue.ToString(); LogInfo.WriteLog("加签字符:" + ret.ToString() + "绑卡chkv字符:" + chkv); LogInfo.WriteLog("绑卡提交表单报文:" + FastJSON.toJOSN(m)); if (ret == 0) { return(m); } return(null); }
public static ReUsrFreezeBg UsrUnFreezeCallBack(out int ret) { ReUsrFreezeBg m = new ReUsrFreezeBg(); m.CmdId = DNTRequest.GetString("CmdId"); m.RespCode = DNTRequest.GetString("RespCode"); m.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); m.MerCustId = DNTRequest.GetString("MerCustId"); m.OrdId = DNTRequest.GetString("OrdId"); m.OrdDate = DNTRequest.GetString("OrdDate"); m.TrxId = DNTRequest.GetString("TrxId"); m.RetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl")); m.BgRetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl")); m.MerPriv = HttpUtility.UrlDecode(DNTRequest.GetString("MerPriv")); m.ChkValue = DNTRequest.GetString("ChkValue"); //m.UsrCustId = DNTRequest.GetString("UsrCustId"); string chkv = CFormHelper.GetChkValue <ReUsrFreezeBg>(m); LogInfo.WriteLog("解冻加签chkv字符:" + chkv); string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); ret = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, m.ChkValue); LogInfo.WriteLog("后台解冻加签信息---1台验签:" + FastJSON.toJOSN(m)); LogInfo.WriteLog("解冻加签chkv字符---1台验签:" + ret.ToString()); if (ret == 0) { return(m); } return(null); }
public ActionResult BgCorpRegister() { string str = ""; ReCorpRegister m = new ReCorpRegister(); m.CmdId = DNTRequest.GetString("CmdId"); m.RespCode = DNTRequest.GetString("RespCode"); m.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); m.MerCustId = DNTRequest.GetString("MerCustId"); m.UsrId = DNTRequest.GetString("UsrId"); m.UsrCustId = DNTRequest.GetString("UsrCustId"); m.AuditStat = DNTRequest.GetString("AuditStat"); m.AuditDesc = DNTRequest.GetString("AuditDesc"); m.MerPriv = DNTRequest.GetString("MerPriv"); m.TrxId = DNTRequest.GetString("TrxId"); m.OpenBankId = DNTRequest.GetString("OpenBankId"); m.CardId = DNTRequest.GetString("CardId"); m.BgRetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl")); m.ChkValue = DNTRequest.GetString("ChkValue"); m.RespExt = DNTRequest.GetString("RespExt"); LogInfo.WriteLog("开户的返回参数:" + FastJSON.toJOSN(m)); StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.CmdId); chkVal.Append(m.RespCode); chkVal.Append(m.MerCustId); chkVal.Append(m.UsrId); //chkVal.Append(m.UsrName); chkVal.Append(m.UsrCustId); chkVal.Append(m.AuditStat); chkVal.Append(m.TrxId); chkVal.Append(m.OpenBankId); chkVal.Append(m.CardId); chkVal.Append(m.BgRetUrl); // chkVal.Append(m.RespExt); string chkv = chkVal.ToString(); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, m.ChkValue); //LogInfo.WriteLog("企业开户验签:" + ret.ToString()); //if (ret == 0) // { if (m.RespCode == "000") { if (m.AuditStat == "Y") { string sql = "update hx_bonding_company set UsrCustId='" + m.UsrCustId + "',AuditStat='" + m.AuditStat + "',TrxId='" + m.TrxId + "',OpenBandkId='" + m.OpenBankId + "',CardId='" + m.CardId + "' where companyid=" + m.MerPriv; LogInfo.WriteLog("企业开户sql:" + sql); DbHelperSQL.RunSql(sql); str = "RECV_ORD_ID_" + m.TrxId; } } //} return(Content(str)); }
/// <summary> /// 汇付用户资金解冻回调 /// </summary> /// <returns></returns> public ActionResult BG_UsrUnFreeze() { string srt = ""; ReUsrFreezeBg m = new ReUsrFreezeBg(); m.CmdId = DNTRequest.GetString("CmdId"); m.RespCode = DNTRequest.GetString("RespCode"); m.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); m.MerCustId = DNTRequest.GetString("MerCustId"); m.OrdId = DNTRequest.GetString("OrdId"); m.OrdDate = DNTRequest.GetString("OrdDate"); m.TrxId = DNTRequest.GetString("TrxId"); m.RetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl")); m.BgRetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl")); m.MerPriv = HttpUtility.UrlDecode(DNTRequest.GetString("MerPriv")); m.ChkValue = DNTRequest.GetString("ChkValue"); //m.UsrCustId = DNTRequest.GetString("UsrCustId"); StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.CmdId); chkVal.Append(m.RespCode); chkVal.Append(m.MerCustId); chkVal.Append(m.OrdId); chkVal.Append(m.OrdDate); chkVal.Append(m.TrxId); chkVal.Append(m.RetUrl); chkVal.Append(m.BgRetUrl); chkVal.Append(m.MerPriv); string chkv = chkVal.ToString(); string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, m.ChkValue); string log = ""; log += "签名返回结果:" + ret.ToString(); log += "<br>解冻回调报文:" + FastJSON.toJOSN(m); if (ret == 0) { if (m.RespCode == "000") { //ToDO LogInfo.WriteLog("进入处理:资金解冻未实现" + m.UsrCustId); srt = "RECV_ORD_ID"; } } else { log += "<br>签名失败"; } LogInfo.WriteLog(log); return(Content(srt)); }
/// <summary> /// 用户注册,第三方开户 /// </summary> /// <param name="id"></param> /// <returns></returns> // GET: opening_account public ActionResult Index(int id) { B_member_table b = new B_member_table(); M_member_table p = new M_member_table(); int uid = Utils.checkloginsession(); p = b.GetModel(uid); string UsrId1 = p.username; string url = Utils.GetChinapnrUrl(); M_UserRegister m = new M_UserRegister(); m.MerId = Utils.GetMerId(); m.Version = "10"; m.CmdId = "UserRegister"; m.MerCustId = Utils.GetMerCustID(); m.BgRetUrl = Utils.GetRe_url("Thirdparty/Bg_Succ_Registered"); // m.BgRetUrl = Utils.GetRe_url("22Thirdparty/Bg_Succ_Registered"); // m.RetUrl = "http://localhost:17745/Register/Succ_Registered"; m.RetUrl = Utils.GetRe_url("Register/Succ_Registered"); m.UsrMp = p.mobile; // m.UsrEmail = p.email; m.UsrId = UsrId1; LogInfo.WriteLog("注册开户请求报文:" + FastJSON.toJOSN(m)); StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.Version); chkVal.Append(m.CmdId); chkVal.Append(m.MerCustId); chkVal.Append(m.BgRetUrl); chkVal.Append(m.RetUrl); chkVal.Append(m.UsrId); chkVal.Append(m.UsrMp); string chkv = chkVal.ToString(); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr(); //需要指定提交字符串的长度 int len = Encoding.UTF8.GetBytes(chkv).Length; StringBuilder sbChkValue = new StringBuilder(256); //加签 int str = DllInterop.SignMsg(m.MerId, merKeyFile, chkv, len, sbChkValue); m.ChkValue = sbChkValue.ToString(); ViewBag.url = url; ViewBag.uid = uid; return(View(m)); }
/// <summary> /// 处理用户注册回调,实体封装及验签。验签失败返回null /// </summary> /// <param name="isFront">是否是前台form形式调用</param> /// <returns>用户注册回调实体对象,验签失败返回null</returns> public static ReUserRegister UserRegisterCallBack(bool isFront = true) { ReUserRegister m = new ReUserRegister(); m.CmdId = DNTRequest.GetString("CmdId"); m.RespCode = DNTRequest.GetString("RespCode"); m.RespDesc = DNTRequest.GetString("RespDesc"); m.MerCustId = DNTRequest.GetString("MerCustId"); m.UsrId = DNTRequest.GetString("UsrId"); m.UsrCustId = DNTRequest.GetString("UsrCustId"); m.BgRetUrl = DNTRequest.GetString("BgRetUrl"); m.TrxId = DNTRequest.GetString("TrxId"); m.RetUrl = DNTRequest.GetString("RetUrl"); m.MerPriv = DNTRequest.GetString("MerPriv"); m.IdType = DNTRequest.GetString("IdType"); m.IdNo = DNTRequest.GetString("IdNo"); m.UsrMp = DNTRequest.GetString("UsrMp"); m.UsrEmail = DNTRequest.GetString("UsrEmail"); m.UsrName = HttpUtility.UrlDecode(DNTRequest.GetString("UsrName")); m.ChkValue = DNTRequest.GetString("ChkValue"); LogInfo.WriteLog("注册开户" + (isFront ? "前台" : "后台" + "返回报文:") + FastJSON.toJOSN(m)); StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.CmdId); chkVal.Append(m.RespCode); chkVal.Append(m.MerCustId); chkVal.Append(m.UsrId); chkVal.Append(m.UsrCustId); chkVal.Append(m.BgRetUrl); chkVal.Append(m.TrxId); chkVal.Append(m.RetUrl); chkVal.Append(m.MerPriv); string chkv = chkVal.ToString(); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, m.ChkValue); LogInfo.WriteLog(";验签ret:" + ret.ToString()); if (ret == 0) { return(m); } return(null); }
public ActionResult BgReviw_case() { string str = ""; R_AddBidInfo m = new R_AddBidInfo(); m.CmdId = DNTRequest.GetString("CmdId"); m.RespCode = DNTRequest.GetString("RespCode"); m.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); m.MerCustId = DNTRequest.GetString("MerCustId"); m.ProId = DNTRequest.GetString("ProId"); m.BorrCustId = DNTRequest.GetString("BorrCustId"); m.BorrTotAmt = DNTRequest.GetString("BorrTotAmt"); m.GuarCompId = DNTRequest.GetString("GuarCompId"); m.GuarAmt = DNTRequest.GetString("GuarAmt"); m.ProArea = DNTRequest.GetString("ProArea"); m.BgRetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl")); m.MerPriv = DNTRequest.GetString("MerPriv"); m.RespExt = DNTRequest.GetString("RespExt"); m.ChkValue = DNTRequest.GetString("ChkValue"); LogInfo.WriteLog("录入标的返回参数:" + FastJSON.toJOSN(m)); StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.CmdId); chkVal.Append(m.RespCode); chkVal.Append(m.MerCustId); chkVal.Append(m.ProId); chkVal.Append(m.BorrCustId); chkVal.Append(m.BorrTotAmt); if (m.MerPriv == "1") { chkVal.Append(m.GuarCompId); chkVal.Append(m.GuarAmt); } chkVal.Append(m.ProArea); chkVal.Append(m.BgRetUrl); chkVal.Append(m.MerPriv); chkVal.Append(m.RespExt); string msg = chkVal.ToString(); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); //需要指定提交字符串的长度 int len = Encoding.UTF8.GetBytes(msg).Length; StringBuilder sbChkValue = new StringBuilder(256); int ret = DllInterop.VeriSignMsg(merKeyFile, msg, msg.Length, m.ChkValue); LogInfo.WriteLog("录入标的验签返回参数:" + ret.ToString()); if (ret == 0) { if (m.RespCode == "000") { // Response.Write("RECV_ORD_ID_"); str = "RECV_ORD_ID_" + m.ProId; } else { string sql = "update hx_borrowing_target set tender_state=1 where targetid=" + m.ProId; DbHelperSQL.RunSql(sql); } } else { string sql = "update hx_borrowing_target set tender_state=1 where targetid=" + m.ProId; DbHelperSQL.RunSql(sql); } return(Content(str)); }
/// <summary> /// 平台向用户转账 /// </summary> /// <returns></returns> public ActionResult BgToUserTransfer() { ReTransfer p = new ReTransfer(); p.CmdId = DNTRequest.GetString("CmdId"); p.RespCode = DNTRequest.GetString("RespCode"); p.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); p.OrdId = DNTRequest.GetString("OrdId"); p.OutCustId = DNTRequest.GetString("OutCustId"); p.OutAcctId = DNTRequest.GetString("OutAcctId"); p.TransAmt = DNTRequest.GetString("TransAmt"); p.InCustId = DNTRequest.GetString("InCustId"); p.InAcctId = DNTRequest.GetString("InAcctId"); p.RetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl")); p.BgRetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl")); p.MerPriv = DNTRequest.GetString("MerPriv"); p.ChkValue = DNTRequest.GetString("ChkValue"); StringBuilder builder = new StringBuilder(); builder.Append(p.CmdId); builder.Append(p.RespCode); builder.Append(p.OrdId); builder.Append(p.OutCustId); builder.Append(p.OutAcctId); builder.Append(p.TransAmt); builder.Append(p.InCustId); builder.Append(p.InAcctId); builder.Append(HttpUtility.UrlDecode(p.RetUrl)); builder.Append(HttpUtility.UrlDecode(p.BgRetUrl)); builder.Append(p.MerPriv); string chkv = builder.ToString(); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, p.ChkValue); LogInfo.WriteLog("平台向用户活动转账后---1台验签:" + ret.ToString()); LogInfo.WriteLog("平台向用户活动转账后---1台主动投标返回报文:" + FastJSON.toJOSN(p)); string sql = ""; string srt = ""; if (ret == 0) { if (p.RespCode == "000") { /* * sql = "update hx_CashAwards set OrdIdstate=3 where OrdIdstate=1 and OrdId=" + p.OrdId + " and proid =" + p.MerPriv; * DbHelperSQL.RunSql(sql);*/ sql = "update hx_member_table set account_total_assets=account_total_assets+" + p.TransAmt + " ,available_balance=available_balance+" + p.TransAmt + " where UsrCustId='" + p.InCustId + "'"; DbHelperSQL.RunSql(sql); srt = "RECV_ORD_ID_" + p.OrdId; LogInfo.WriteLog("平台向用户活动转账后成功:" + srt + " " + sql); } else { } } return(Content(srt)); }
public ActionResult PlatformToUserMoney(string UsrCustId = "", decimal money = 0) { string keypassword = ConfigurationManager.AppSettings["RechargePassWord"].ToString(); string password = DNTRequest.GetFormString("pssword"); if (string.IsNullOrEmpty(UsrCustId)) { return(Content(StringAlert.Alert("客户号不可以为空!"), "text/html")); } if (money <= 0) { return(Content(StringAlert.Alert("转账金额错误!"), "text/html")); } if (String.IsNullOrEmpty(password)) { return(Content(StringAlert.Alert("密码不能为空!"), "text/html")); } if (keypassword != password) { return(Content(StringAlert.Alert("充值密码不正确"), "text/html")); } M_Transfer m = new M_Transfer(); m.Version = "10"; m.CmdId = "Transfer"; m.OrdId = Utils.Createcode(); m.OutCustId = Utils.GetMerCustID(); m.OutAcctId = "MDT000001"; m.TransAmt = money.ToString("0.00"); m.InCustId = Utils.CheckSQLHtml(UsrCustId); m.BgRetUrl = Utils.GetRe_url("admin/Thirdparty/BgToUserTransfer"); StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.Version); chkVal.Append(m.CmdId); chkVal.Append(m.OrdId); chkVal.Append(m.OutCustId); chkVal.Append(m.OutAcctId); chkVal.Append(m.TransAmt); chkVal.Append(m.InCustId); chkVal.Append(m.RetUrl); chkVal.Append(m.BgRetUrl); chkVal.Append(m.MerPriv); string chkv = chkVal.ToString(); LogInfo.WriteLog("加签chkv字符:" + chkv); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr(); //需要指定提交字符串的长度 int len = Encoding.UTF8.GetBytes(chkv).Length; StringBuilder sbChkValue = new StringBuilder(256); //加签 int str = DllInterop.SignMsg(Utils.GetMerId(), merKeyFile, chkv, len, sbChkValue); LogInfo.WriteLog("加签字符:" + str.ToString()); m.ChkValue = sbChkValue.ToString(); LogInfo.WriteLog("提交信息:" + FastJSON.toJOSN(m)); LogInfo.WriteLog("ChkValue:" + m.ChkValue); string _resultStr = ""; using (var client = new WebClient()) { var values = new NameValueCollection(); values.Add("Version", m.Version); values.Add("CmdId", m.CmdId); values.Add("OrdId", m.OrdId); values.Add("OutCustId", m.OutCustId); values.Add("OutAcctId", m.OutAcctId); values.Add("TransAmt", m.TransAmt); values.Add("InCustId", m.InCustId); values.Add("InAcctId", m.InAcctId); values.Add("RetUrl", m.RetUrl); values.Add("BgRetUrl", m.BgRetUrl); values.Add("MerPriv", m.MerPriv); values.Add("ChkValue", m.ChkValue); string url = Utils.GetChinapnrUrl(); //同步发送form表单请求 byte[] result = client.UploadValues(url, "POST", values); var retStr = Encoding.UTF8.GetString(result); // Response.Write(retStr); LogInfo.WriteLog("自动扣款转账(商户用)返回报文" + retStr); ReTransfer reg = new ReTransfer(); var retloan = (ReTransfer)FastJSON.ToObject(retStr, reg); StringBuilder builder = new StringBuilder(); builder.Append(retloan.CmdId); builder.Append(retloan.RespCode); builder.Append(retloan.OrdId); builder.Append(retloan.OutCustId); builder.Append(retloan.OutAcctId); builder.Append(retloan.TransAmt); builder.Append(retloan.InCustId); builder.Append(retloan.InAcctId); builder.Append(retloan.RetUrl); builder.Append(retloan.BgRetUrl); builder.Append(retloan.MerPriv); var msg = builder.ToString(); LogInfo.WriteLog("返回参数:" + msg); //验签 string pgPubkFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(pgPubkFile, msg, msg.Length, retloan.ChkValue); LogInfo.WriteLog("验签ret:" + ret.ToString()); if (ret == 0) { if (retloan.RespCode == "000") { //_resultStr = retloan.RespCode.ToString() + " <br> " + HttpUtility.UrlDecode(retloan.RespDesc) + "<br>转账成功"; #region 流水信息 string sql = "SELECT registerid,username,mobile from hx_member_table where UsrCustId='" + retloan.InCustId + "'"; System.Data.DataTable dt = DbHelperSQL.GET_DataTable_List(sql); if (dt.Rows.Count > 0) { B_usercenter ors = new B_usercenter(); decimal di = ors.GetUsridAvailable_balance(int.Parse(dt.Rows[0]["registerid"].ToString())); // di = di + decimal.Parse(hua.Amt.ToString()); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into hx_Capital_account_water("); strSql.Append("membertable_registerid,income,expenditure,time_of_occurrence,account_balance,types_Finance,createtime,keyid,remarks)"); strSql.Append(" values ("); strSql.Append("" + int.Parse(dt.Rows[0]["registerid"].ToString()) + "," + decimal.Parse(retloan.TransAmt) + ",0,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + (di + decimal.Parse(retloan.TransAmt)) + "," + (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.平台向用户划账.ToString()) + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',0,'" + "平台向用户划账" + "')"); DbHelperSQL.RunSql(strSql.ToString()); strSql.Clear(); } #endregion _resultStr = "<br>转账成功"; } else { _resultStr = HttpUtility.UrlDecode(retloan.RespDesc); } } } ViewBag.str = _resultStr; return(View()); }
/// <summary> /// 普通提现汇付后台主动通知 /// </summary> /// <returns></returns> public ActionResult PostGENERALAmt() { string str1 = ""; ReCash m = new ReCash(); m.CmdId = DNTRequest.GetString("CmdId"); m.RespCode = DNTRequest.GetString("RespCode"); m.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); m.MerCustId = DNTRequest.GetString("MerCustId"); m.OrdId = DNTRequest.GetString("OrdId"); m.UsrCustId = DNTRequest.GetString("UsrCustId"); m.TransAmt = DNTRequest.GetString("TransAmt"); m.OpenAcctId = DNTRequest.GetString("OpenAcctId"); m.OpenBankId = DNTRequest.GetString("OpenBankId"); m.FeeAmt = DNTRequest.GetString("FeeAmt"); m.FeeCustId = DNTRequest.GetString("FeeCustId"); m.FeeAcctId = DNTRequest.GetString("FeeAcctId"); m.ServFee = DNTRequest.GetString("ServFee"); m.ServFeeAcctId = DNTRequest.GetString("ServFeeAcctId"); m.RetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl")); m.BgRetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl")); m.MerPriv = DNTRequest.GetString("MerPriv"); m.RespExt = HttpUtility.UrlDecode(DNTRequest.GetString("RespExt")); m.ChkValue = DNTRequest.GetString("ChkValue"); LogInfo.WriteLog("后台取现返回报文:" + FastJSON.toJOSN(m)); //验签 StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.CmdId); chkVal.Append(m.RespCode); chkVal.Append(m.MerCustId); chkVal.Append(m.OrdId); chkVal.Append(m.UsrCustId); chkVal.Append(m.TransAmt); chkVal.Append(m.OpenAcctId); chkVal.Append(m.OpenBankId); chkVal.Append(m.FeeAmt); chkVal.Append(m.FeeCustId); chkVal.Append(m.FeeAcctId); chkVal.Append(m.ServFee); chkVal.Append(m.ServFeeAcctId); chkVal.Append(m.RetUrl); chkVal.Append(m.BgRetUrl); chkVal.Append(m.MerPriv); chkVal.Append(m.RespExt); string msg = chkVal.ToString(); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); //需要指定提交字符串的长度 int len = Encoding.UTF8.GetBytes(msg).Length; StringBuilder sbChkValue = new StringBuilder(256); int ret = DllInterop.VeriSignMsg(merKeyFile, msg, msg.Length, m.ChkValue); // LogInfo.WriteLog("验签返回参数:" + ret.ToString()); StringBuilder str = new StringBuilder(); if (ret == 0) { //提现成功后,得多事务处理账户金额,流水及冻结金额等 if (m.RespCode == "000") { string cachename = m.OrdId + "Cash" + m.UsrCustId; if (Utils.GeTThirdCache(cachename) == 0) { Utils.SetThirdCache(cachename); B_usercenter BUC = new B_usercenter(); M_ReqExt mre = JsonConvert.DeserializeObject <M_ReqExt>(m.RespExt.Replace("[", "").Replace("]", "")); int CashOp = BUC.CashTran(m.OpenAcctId, m.OpenBankId, m.OrdId, m.TransAmt, m.UsrCustId, m.FeeAmt, mre.FeeObjFlag, mre.CashChl); //int CashOp = BUC.CashTran(m.OpenAcctId, m.OpenBankId, m.OrdId, m.TransAmt, m.UsrCustId); if (CashOp > 0) { string sql = "select registerid,username,mobile,UsrCustId,available_balance from hx_member_table where UsrCustId='" + m.UsrCustId + "'"; LogInfo.WriteLog("后台审请取现成功短信sql:" + sql); DataTable dt = DbHelperSQL.GET_DataTable_List(sql); if (dt.Rows.Count > 0) { //短信通知 //尊敬的#USERANEM#,您已成功提现#MONEY#元,账户余额#MONEY1#.请注意查收!【创利投】 string contxt = Utils.GetMSMEmailContext(12, 1); // 获取注册成功邮件内容 StringBuilder sbsms = new StringBuilder(contxt); sbsms = sbsms.Replace("#USERANEM#", dt.Rows[0]["username"].ToString()); sbsms = sbsms.Replace("#MONEY#", m.TransAmt); decimal amt = decimal.Parse(dt.Rows[0]["available_balance"].ToString()) - decimal.Parse(m.TransAmt); sbsms = sbsms.Replace("#MONEY1#", amt.ToString()); string mobile = dt.Rows[0]["mobile"].ToString(); M_td_SMS_record psms = new M_td_SMS_record(); B_td_SMS_record osms = new B_td_SMS_record(); int smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.取现成功.ToString()); psms.phone_number = mobile; psms.sendtime = DateTime.Now; psms.senduserid = int.Parse(dt.Rows[0]["registerid"].ToString()); psms.smstype = smstype; psms.smscontext = sbsms.ToString(); psms.orderid = SendSMS.Send_SMS(mobile, sbsms.ToString()); psms.vcode = ""; osms.Add(psms); DateTime dti = DateTime.Now; M_td_System_message pm = new M_td_System_message(); pm.MReg = int.Parse(dt.Rows[0]["registerid"].ToString()); pm.Mstate = 0; pm.MTitle = "提现成功"; pm.MContext = sbsms.ToString(); pm.PubTime = dti; pm.Mtype = 3; B_usercenter.AddMessage(pm); if (mre.CashChl == "IMMEDIATE" && decimal.Parse(m.TransAmt) <= 200000M) { string retUrl = Utils.GetRe_url("admin/UserCash/RePostCashProcessing"); string bgRetUrl = Utils.GetRe_url("admin/Thirdparty/BgCashProcessing"); BusinessLogicHelper.AutoCheckCash(m.UsrCustId, retUrl, bgRetUrl); } } } } str1 = "RECV_ORD_ID_" + m.OrdId; } } return(Content(str1)); }
/// <summary> /// 自动扣款转账(商户用)接口 商户向用户转帐 /// </summary> /// <param name="UsrCustId">客户号</param> /// <param name="TranAMT">转账金额</param> /// <param name="ReturnUrl">汇付返回主动通知页面如:admin/Thirdparty/BgToUserTransfer</param> /// <returns></returns> public ReTransfer ToUserTransfer(string UsrCustId, decimal TranAMT, string OrdId, string UserAct, string ReturnUrl) { M_Transfer m = new M_Transfer(); ReTransfer retloan = new ReTransfer(); m.Version = "10"; m.CmdId = "Transfer"; m.OrdId = OrdId; m.OutCustId = Utils.GetMerCustID(); m.OutAcctId = "MDT000001"; m.TransAmt = TranAMT.ToString("0.00"); m.InCustId = UsrCustId; m.BgRetUrl = Utils.GetRe_url(ReturnUrl); m.MerPriv = UserAct; StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.Version); chkVal.Append(m.CmdId); chkVal.Append(m.OrdId); chkVal.Append(m.OutCustId); chkVal.Append(m.OutAcctId); chkVal.Append(m.TransAmt); chkVal.Append(m.InCustId); chkVal.Append(m.RetUrl); chkVal.Append(m.BgRetUrl); chkVal.Append(m.MerPriv); string chkv = chkVal.ToString(); string log = "商户向用户转账加签chkv字符:" + chkv; //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr(); //需要指定提交字符串的长度 int len = Encoding.UTF8.GetBytes(chkv).Length; StringBuilder sbChkValue = new StringBuilder(256); //加签 int str = DllInterop.SignMsg(Utils.GetMerId(), merKeyFile, chkv, len, sbChkValue); log += "<br>加签字符:" + str.ToString(); m.ChkValue = sbChkValue.ToString(); log += "<br>提交信息:" + FastJSON.toJOSN(m); log += "<br>ChkValue:" + m.ChkValue; using (var client = new WebClient()) { var values = new NameValueCollection(); values.Add("Version", m.Version); values.Add("CmdId", m.CmdId); values.Add("OrdId", m.OrdId); values.Add("OutCustId", m.OutCustId); values.Add("OutAcctId", m.OutAcctId); values.Add("TransAmt", m.TransAmt); values.Add("InCustId", m.InCustId); values.Add("InAcctId", m.InAcctId); values.Add("RetUrl", m.RetUrl); values.Add("BgRetUrl", m.BgRetUrl); values.Add("MerPriv", m.MerPriv); values.Add("ChkValue", m.ChkValue); string url = Utils.GetChinapnrUrl(); //同步发送form表单请求 byte[] result = client.UploadValues(url, "POST", values); var retStr = Encoding.UTF8.GetString(result); // Response.Write(retStr); log += "<br>自动扣款转账(商户用)返回报文:" + retStr; ReTransfer reg = new ReTransfer(); retloan = (ReTransfer)FastJSON.ToObject(retStr, reg); StringBuilder builder = new StringBuilder(); builder.Append(retloan.CmdId); builder.Append(retloan.RespCode); builder.Append(retloan.OrdId); builder.Append(retloan.OutCustId); builder.Append(retloan.OutAcctId); builder.Append(retloan.TransAmt); builder.Append(retloan.InCustId); builder.Append(retloan.InAcctId); builder.Append(retloan.RetUrl); builder.Append(retloan.BgRetUrl); builder.Append(retloan.MerPriv); var msg = builder.ToString(); log += "<br>商户向用户转账返回参数:" + msg; //验签 string pgPubkFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(pgPubkFile, msg, msg.Length, retloan.ChkValue); log += "<br>商户向用户转账验签ret:" + ret.ToString(); if (ret == 0) { if (retloan.RespCode == "000") { } else { retloan = null; } } } LogInfo.WriteLog(log); return(retloan); }
public ActionResult UserToPlatformMoney(string UsrCustId = "", decimal money = 0, string InCustId = "") { if (string.IsNullOrEmpty(UsrCustId)) { return(Content(StringAlert.Alert("客户号不可以为空!"), "text/html")); } if (string.IsNullOrEmpty(InCustId)) { return(Content(StringAlert.Alert("入账客户号不可以为空!"), "text/html")); } if (money <= 0) { return(Content(StringAlert.Alert("转账金额错误!"), "text/html")); } M_UsrAcctPay m = new M_UsrAcctPay(); m.Version = "10"; m.CmdId = "UsrAcctPay"; m.OrdId = Utils.Createcode(); // m.UsrCustId = "6000060000898051"; m.UsrCustId = Utils.CheckSQLHtml(UsrCustId); m.MerCustId = Utils.GetMerCustID(); m.InAcctId = "MDT000001"; m.InAcctType = "MERDT"; m.RetUrl = Utils.GetRe_url("admin/Recharge/UsrPay"); m.BgRetUrl = Utils.GetRe_url("admin/Thirdparty/BgUsrPay"); //m.TransAmt = "7749.60"; m.TransAmt = money.ToString("0.00"); StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.Version); chkVal.Append(m.CmdId); chkVal.Append(m.OrdId); chkVal.Append(m.UsrCustId); chkVal.Append(m.MerCustId); chkVal.Append(m.TransAmt); chkVal.Append(m.InAcctId); chkVal.Append(m.InAcctType); chkVal.Append(m.RetUrl); chkVal.Append(m.BgRetUrl); string chkv = chkVal.ToString(); LogInfo.WriteLog("加签chkv字符:" + chkv); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr(); //需要指定提交字符串的长度 int len = Encoding.UTF8.GetBytes(chkv).Length; StringBuilder sbChkValue = new StringBuilder(256); //加签 int str = DllInterop.SignMsg(Utils.GetMerId(), merKeyFile, chkv, len, sbChkValue); LogInfo.WriteLog("向平台转帐加签字符:" + str.ToString()); m.ChkValue = sbChkValue.ToString(); LogInfo.WriteLog("向平台转帐提交信息:" + FastJSON.toJOSN(m)); LogInfo.WriteLog("ChkValue:" + m.ChkValue); StringBuilder strz = new StringBuilder(); strz.Append(" <form id=\"formauto\" name=\"formauto\" action=\"" + Utils.GetChinapnrUrl() + "\" method=\"post\">"); strz.Append("<input id=\"Version\" name=\"Version\" type=\"hidden\" value=\"" + m.Version + "\" />"); strz.Append("<input id=\"CmdId\" name=\"CmdId\" type=\"hidden\" value=\"" + m.CmdId + "\" />"); strz.Append("<input id=\"OrdId\" name=\"OrdId\" type=\"hidden\" value=\"" + m.OrdId + "\" />"); strz.Append("<input id=\"UsrCustId\" name=\"UsrCustId\" type=\"hidden\" value=\"" + m.UsrCustId + "\" />"); strz.Append("<input id=\"MerCustId\" name=\"MerCustId\" type=\"hidden\" value=\"" + m.MerCustId + "\" />"); strz.Append("<input id=\"TransAmt\" name=\"TransAmt\" type=\"hidden\" value=\"" + m.TransAmt + "\" />"); strz.Append("<input id=\"InAcctId\" name=\"InAcctId\" type=\"hidden\" value=\"" + m.InAcctId + "\" />"); strz.Append("<input id=\"InAcctType\" name=\"InAcctType\" type=\"hidden\" value=" + m.InAcctType + " />"); strz.Append("<input id=\"RetUrl\" name=\"RetUrl\" type=\"hidden\" value=\"" + m.RetUrl + "\" />"); strz.Append("<input id=\"BgRetUrl\" name=\"BgRetUrl\" type=\"hidden\" value=\"" + m.BgRetUrl + "\" />"); strz.Append("<input id=\"ChkValue\" name=\"ChkValue\" type=\"hidden\" value=\"" + m.ChkValue + "\" />"); strz.Append(" </form>"); strz.Append("<script type=\"text/javascript\">document.getElementById('formauto').submit();</script>"); LogInfo.WriteLog(strz.ToString()); ViewBag.str = strz.ToString(); return(View()); }
public string Register(string Validatecode, string userpassword1, string mobile1, string username1, bool realMobileUser = false) { Utils.SetSYSDateTimeFormat(); string json = ""; //注册奖励 M_Activity_schedule ma = new M_Activity_schedule(); B_Activity_schedule ba = new B_Activity_schedule(); B_member_table o = new B_member_table(); M_member_table p = new M_member_table(); B_bonus_account bb = new B_bonus_account(); M_bonus_account mb = new M_bonus_account(); M_bonus_account_water mbaw = new M_bonus_account_water(); B_bonus_account_water bbaw = new B_bonus_account_water(); string email1 = ""; string strvcode = realMobileUser ? "y" : ck.GetVcode(Validatecode, mobile1); string tid = "";//富爸爸参数uid //Utils.GetCookie("Cooperation", "tid");//渠道来源ID string invcode = Utils.GetInvCode(); // 用户邀请用户关系存在的时候,不走 新渠道机制(channel) #region 道 //渠道的cookie var cc_keyValue = Utils.GetInvCookie("channel"); string cInvitedcode = string.Empty; if (string.IsNullOrEmpty(invcode) && cc_keyValue.Count != 0) { cInvitedcode = cc_keyValue["Invitedcode"]; var channelInvitedCode = ef.hx_Channel.Where(c => c.ChannelName == "fubaba").Select(c => c.Invitedcode).FirstOrDefault(); if (cInvitedcode.Trim() == channelInvitedCode) { tid = cc_keyValue["uid"]; } } #endregion int ch = 0; if (Utils.GetCookie("Cooperation", "ch") != "") { try { ch = int.Parse(Utils.GetCookie("Cooperation", "ch"));//渠道来源 } catch { ch = 0; } } if (ch == 0) { if (invcode != "") { ch = 1; } } if (strvcode != null) { if (strvcode == "y") { string checkMob = ck.checkmobile(mobile1, 0); if (checkMob != "y") { json = @" {""rs"" : ""n"", ""error"" : ""手机号已被注册!""}"; return(json); } p.username = username1; p.password = DESEncrypt.Encrypt(userpassword1, ConfigurationManager.AppSettings["webp"].ToString()); p.mobile = mobile1; p.email = email1; p.usertypes = 0; p.invitedcode = Calculator.Getinvitedcode(); p.ismobile = 1; p.Channelsource = ch; p.Tid = tid; p.channel_invitedcode = cInvitedcode; LogInfo.WriteLog("用户注册内容:" + FastJSON.toJOSN(p) + " IP:" + Utils.GetRealIP()); int uid = o.Add(p); if (uid > 0) { CheckXiCai(p.mobile, cInvitedcode); //if (tid != "") //{ // Utils.GetCoopAPI(tid, uid.ToString(), 1); //} string keys = DESEncrypt.Encrypt(uid.ToString(), ConfigurationManager.AppSettings["webp"].ToString()); string keys1 = DESEncrypt.Encrypt(username1, ConfigurationManager.AppSettings["webp"].ToString()); M_td_SMS_record pm = new M_td_SMS_record(); B_td_SMS_record om = new B_td_SMS_record(); int smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.注册成功.ToString()); string smscontxt = Utils.GetMSMEmailContext(18, 1); // 获取注册成功邮件内容 StringBuilder sbsms = new StringBuilder(smscontxt); string mobile = mobile1; sbsms = sbsms.Replace("#USERANEM#", p.username.ToString()); pm.phone_number = mobile; pm.sendtime = DateTime.Now; pm.senduserid = uid; pm.smstype = smstype; pm.smscontext = sbsms.ToString(); pm.orderid = SendSMS.Send_SMS(mobile, sbsms.ToString()); pm.vcode = ""; om.Add(pm); M_login mlogin = new M_login(); mlogin.userid = uid; mlogin.username = p.username; mlogin.codeno = Utils.SetSessioncode(); int remember = 0; if (Utils.LoginWriteSession(mlogin, remember) > 0) { string sql = "update hx_member_table set lastlogintime='" + DateTime.Now + "',lastloginIP='" + Utils.GetRealIP() + "' where registerid=" + uid.ToString(); LogInfo.WriteLog(sql); DbHelperSQL.ExecuteSql(sql); } #region MyRegion //记录邀请关系 LogInfo.WriteLog("注册:邀请码:" + invcode); if (invcode != "") { string codesql = "SELECT invcode from hx_td_Userinvitation where invpersonid=" + uid.ToString();//查询本人是否已经被邀请注册过 invcode='" + invcode + "' and LogInfo.WriteLog("codesql2:" + codesql); DataTable dtcode = DbHelperSQL.GET_DataTable_List(codesql); if (dtcode.Rows.Count == 0) { M_td_Userinvitation myao = new M_td_Userinvitation(); B_td_Userinvitation dyao = new B_td_Userinvitation(); int yaouids = Utils.GetCodeUid(); myao.invcode = invcode; myao.invtime = DateTime.Now; myao.invpersonid = uid; myao.Invpeopleid = yaouids; myao.InvitesStates = 0; myao.Invitereward = 0; int myaoint = dyao.Add(myao); } } #endregion MyRegion //记录邀请关系 json = @" {""rs"" : ""y"", ""url"" : ""/""}"; string temstr = "/opening_account/Index/" + uid.ToString(); json = json.Replace("/", temstr); return(json); } else { json = @" {""rs"" : ""n"", ""error"" : ""注册失败!""}"; return(json); } } else { json = @" {""rs"" : ""n"", ""error"" : ""验证码不对!""}"; return(json); } } else { json = @" {""rs"" : ""n"", ""error"" : ""验证码不存在或过期!""}"; } return(json); }
/// <summary> /// 交询状态查询 /// </summary> /// <param name="OrdId"></param> /// <param name="OrdDate">格式为 YYYYMMDD,例如:20130307</param> /// <param name="QueryTransType"></param> /// <returns></returns> public bool checktrans(string OrdId, string OrdDate, string QueryTransType = "TENDER") { bool t = false; M_QueryTransStat m = new M_QueryTransStat(); m.Version = "10"; m.CmdId = "QueryTransStat"; m.MerCustId = Utils.GetMerCustID(); m.OrdId = OrdId; m.OrdDate = OrdDate; m.QueryTransType = QueryTransType; StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.Version); chkVal.Append(m.CmdId); chkVal.Append(m.MerCustId); chkVal.Append(m.OrdId); chkVal.Append(m.OrdDate); chkVal.Append(m.QueryTransType); string chkv = chkVal.ToString(); LogInfo.WriteLog("行为:" + QueryTransType + "加签chkv字符:" + chkv); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr(); //需要指定提交字符串的长度 int len = Encoding.UTF8.GetBytes(chkv).Length; StringBuilder sbChkValue = new StringBuilder(256); //加签 int str = DllInterop.SignMsg(Utils.GetMerId(), merKeyFile, chkv, len, sbChkValue); LogInfo.WriteLog("行为:" + QueryTransType + "加签字符:" + str.ToString()); m.ChkValue = sbChkValue.ToString(); LogInfo.WriteLog("行为:" + QueryTransType + "提交信息:" + FastJSON.toJOSN(m)); LogInfo.WriteLog("行为:" + QueryTransType + "ChkValue:" + m.ChkValue); using (var client = new WebClient()) { var values = new NameValueCollection(); values.Add("Version", m.Version); values.Add("CmdId", m.CmdId); values.Add("MerCustId", m.MerCustId); values.Add("OrdId", m.OrdId); values.Add("OrdDate", m.OrdDate); values.Add("QueryTransType", m.QueryTransType); values.Add("ChkValue", m.ChkValue); string url = Utils.GetChinapnrUrl(); //同步发送form表单请求 byte[] result = client.UploadValues(url, "POST", values); var retStr = Encoding.UTF8.GetString(result); // Response.Write(retStr); LogInfo.WriteLog("行为:" + QueryTransType + "交易状态返回报文" + retStr); ReQueryTransStat reg = new ReQueryTransStat(); var retloan = (ReQueryTransStat)FastJSON.ToObject(retStr, reg); StringBuilder builder = new StringBuilder(); builder.Append(retloan.CmdId); builder.Append(retloan.RespCode); builder.Append(retloan.MerCustId); builder.Append(retloan.OrdId); builder.Append(retloan.OrdDate); builder.Append(retloan.QueryTransType); builder.Append(retloan.TransStat); var msg = builder.ToString(); LogInfo.WriteLog("行为:" + QueryTransType + "返回参数:" + msg); //验签 string pgPubkFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(pgPubkFile, msg, msg.Length, retloan.ChkValue); LogInfo.WriteLog("行为:" + QueryTransType + "验签ret:" + ret.ToString()); if (ret == 0) { if (retloan.RespCode == "000") { if (QueryTransType == "TENDER") //投标查询结果 { /*投标 * N--成功 * C-失败 */ if (retloan.TransStat == "N") { t = true; } } else if (QueryTransType == "REPAYMENT" || QueryTransType == "LOANS")//还款 { /*放款,还款 * I--初始 * P--部分成功 */ if (retloan.TransStat == "P") { t = true; } } else if (QueryTransType == "CASH") //取现 { /*S--成功 * F--失败 * H--经办 * R--拒绝 */ if (retloan.TransStat == "S") { t = true; } } else if (QueryTransType == "FREEZE")//冻结解冻交易查询 { /*F – 冻结 * U – 已解冻 */ if (retloan.TransStat == "U") { t = true; } } } else { t = false; } } } return(t); }
/// <summary> /// 投资成功,汇付后台主动通知 /// </summary> /// <returns></returns> public ActionResult BG_investment_success() { int id = 0; string srt = ""; ReInitiativeTender p = new ReInitiativeTender(); id = DNTRequest.GetInt("id", 0); string log = ""; log += "主动通知后台有响应成功!接收到的项目id=" + id; p.CmdId = DNTRequest.GetString("CmdId"); p.RespCode = DNTRequest.GetString("RespCode"); p.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); p.MerCustId = DNTRequest.GetString("MerCustId"); p.OrdId = DNTRequest.GetString("OrdId"); p.OrdDate = DNTRequest.GetString("OrdDate"); p.TransAmt = DNTRequest.GetString("TransAmt"); p.UsrCustId = DNTRequest.GetString("UsrCustId"); p.TrxId = DNTRequest.GetString("TrxId"); p.IsFreeze = DNTRequest.GetString("IsFreeze"); p.FreezeOrdId = DNTRequest.GetString("FreezeOrdId"); p.FreezeTrxId = DNTRequest.GetString("FreezeTrxId"); p.RetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl")); p.BgRetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl")); string merp = DNTRequest.GetString("MerPriv"); if (merp.Length > 0) { p.MerPriv = HttpUtility.UrlDecode(merp); } else { p.MerPriv = merp; } p.RespExt = HttpUtility.UrlDecode(DNTRequest.GetString("RespExt")); p.ChkValue = DNTRequest.GetString("ChkValue"); StringBuilder chkVal = new StringBuilder(); chkVal.Append(p.CmdId); chkVal.Append(p.RespCode); chkVal.Append(p.MerCustId); chkVal.Append(p.OrdId); chkVal.Append(p.OrdDate); chkVal.Append(p.TransAmt); chkVal.Append(p.UsrCustId); chkVal.Append(p.TrxId); chkVal.Append(p.IsFreeze); chkVal.Append(p.FreezeOrdId); chkVal.Append(p.FreezeTrxId); chkVal.Append(p.RetUrl); chkVal.Append(p.BgRetUrl); chkVal.Append(p.MerPriv); chkVal.Append(p.RespExt); string chkv = chkVal.ToString(); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, p.ChkValue); log += "<br>投标后台主动投标返回报文:" + FastJSON.toJOSN(p); string sql = ""; int invcount = 0; //记录用户是否是首次投资 #region 验签 if (ret == 0) { if (p.RespCode == "000" || p.RespCode == "322" || p.RespCode == "534" || p.RespCode == "360" || p.RespCode == "099") { string cachename = p.OrdId + "InvestWeb" + p.UsrCustId; if (Utils.GeTThirdCache(cachename) == 0) { Utils.SetThirdCache(cachename); if (p.FreezeTrxId != "") { sql = "select ordstate from hx_Bid_records where ordstate =0 and OrdId='" + p.OrdId + "'"; DataTable dts = DbHelperSQL.GET_DataTable_List(sql); if (dts.Rows.Count > 0) { //同步处理用户金额 B_usercenter BUC = new B_usercenter(); int d = BUC.ReInvest_success(p.UsrCustId, p.FreezeOrdId, p.TransAmt, p.FreezeTrxId, p.OrdId, p.MerPriv); log += "<br>后台投标:id" + id.ToString() + "返回唯一冻结标识:" + p.FreezeTrxId + "事务执行结果:" + d.ToString(); if (d > 0) { sql = "select targetid,bid_records_id, borrowing_title,investor_registerid ,username,mobile,invitationcode,investment_amount,life_of_loan,unit_day,borrowing_balance,bonusAmt from V_hx_Bid_records_borrowing_target where OrdId='" + p.OrdId + "'"; DataTable dt = DbHelperSQL.GET_DataTable_List(sql); if (dt.Rows.Count > 0) { decimal investAmt = decimal.Parse(dt.Rows[0]["investment_amount"].ToString()); string OrdId = p.OrdId; int registerid = int.Parse(dt.Rows[0]["investor_registerid"].ToString()); ViewBag.userid = registerid; string targetid = dt.Rows[0]["targetid"].ToString(); #region 待提取为公共方法 #region MyRegion 系统消息 DateTime dti = DateTime.Now; M_td_System_message pm = new M_td_System_message(); pm.MReg = registerid; pm.Mstate = 0; pm.MTitle = "投资成功"; pm.MContext = "尊敬的用户" + dt.Rows[0]["username"].ToString() + ":您好!恭喜您成功投资了项目【" + dt.Rows[0]["borrowing_title"].ToString() + "】,投资金额是:" + investAmt + "。如有问题可咨询创利投的客服!谢谢!"; pm.PubTime = dti; pm.Mtype = 1; B_usercenter.AddMessage(pm); #endregion #region MyRegion //短信通知 string contxt = Utils.GetMSMEmailContext(15, 1); // 获取注册成功邮件内容 StringBuilder sbsms = new StringBuilder(contxt); sbsms = sbsms.Replace("#USERANEM#", dt.Rows[0]["username"].ToString()); sbsms = sbsms.Replace("#PID#", targetid); sbsms = sbsms.Replace("#MONEY#", investAmt.ToString()); string mobile = dt.Rows[0]["mobile"].ToString(); M_td_SMS_record psms = new M_td_SMS_record(); B_td_SMS_record osms = new B_td_SMS_record(); int smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.投资成功.ToString()); psms.phone_number = mobile; psms.sendtime = DateTime.Now; psms.senduserid = registerid; psms.smstype = smstype; psms.smscontext = sbsms.ToString(); psms.orderid = SendSMS.Send_SMS(mobile, sbsms.ToString()); psms.vcode = ""; osms.Add(psms); #endregion #region 远程调用生成合同??? 稍后替换为本地方法调用 微信端可远程调用 string postString = "action=MUserPDF&data=" + targetid.ToString() + "&uc=" + registerid.ToString() + "&OrdId=" + OrdId; string sr = Utils.PostWebRequest(Utils.GetRemote_url("pdf/index"), postString, Encoding.UTF8); #endregion #region 道合作 第一投标调用接口??? B_member_table bmt = new B_member_table(); M_member_table mmt = new M_member_table(); mmt = bmt.GetModel(registerid); if (mmt.Tid != null && mmt.Channelsource == 1) { if (B_usercenter.GetInvestCountByUserid(mmt.registerid) == 1) { string ret3 = Utils.GetCoopAPI(mmt.Tid, investAmt.ToString("0.00"), 2); log += "<br>前台渠道合作第一次返回结果:" + ret3 + " 用户id:" + mmt.registerid + " 订单id " + OrdId; } } #endregion #endregion 待提取为公共方法 //发放奖励 ActFacade act = new ActFacade(); act.SendBonusAfterInvest(dt, EnumCommon.E_hx_ActivityTable.E_ActTargetPlatform.web); #region 线 投资六月专享标一元抢Iphone 2016年9月11日 9点 至2016年9月30日 if (false) { DateTime nowdate = DateTime.Now; DateTime startdate = new DateTime(2016, 09, 11, 9, 00, 00); DateTime enddate = new DateTime(2016, 09, 30, 23, 59, 59); if (nowdate > startdate && nowdate < enddate) { log += "<br>PC端【一元抢Iphone】"; log += "<br>标的期限:" + dt.Rows[0]["life_of_loan"].ToString(); if (dt.Rows[0]["unit_day"].ToString() == "1" && dt.Rows[0]["life_of_loan"].ToString() == "6")//是否六月标 { log += "<br>用户注册时间:" + mmt.Registration_time.ToString(); if (mmt.Registration_time > new DateTime(2016, 09, 11, 0, 0, 0)) { B_GrabIphone gi = new B_GrabIphone(); bool isCount = gi.Exists(mmt.registerid);//查询是否存在该用户 log += "<br> 用户ID:" + mmt.registerid + ";查询是否存在该用户:" + isCount; if (isCount != true) { M_GrabIphone model = new M_GrabIphone(); model.RegrsterID = mmt.registerid; model.Color = ""; model.Addtime = nowdate; model.LuckDrawState = 0; model.WinningState = 0; model.WinningTime = nowdate; model.TargetID = int.Parse(dt.Rows[0]["targetid"].ToString()); model.BidRecordsID = int.Parse(dt.Rows[0]["bid_records_id"].ToString()); model.InvestmentAmount = dt.Rows[0]["investment_amount"].ToString(); gi.Add(model); //增加一条数据 int ljcount = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["GrabIphone"].ToString()); //获取启动抽奖人数 List <M_GrabIphone> giList = gi.GetModelList(ljcount, "LuckDrawState=0", "ID"); //获取当前阶段投资人数 if (giList != null) { log += "<br>当前阶段投资人数:" + giList.Count; if (giList.Count >= ljcount) { bool bo = gi.UpdateLuckDrawState();//批量更新抽奖状态 log += "<br> 批量更新抽奖状态:" + bo; if (bo == true) { int count = giList.Count; int index = new Random().Next(count); M_GrabIphone randowitem = giList[index]; if (randowitem != null) { log += "<br> 获奖用户ID:" + randowitem.RegrsterID; bool co = gi.Update("", 1, DateTime.Now, randowitem.RegrsterID);//更新中奖用户状态 log += "<br> 更新中奖用户状态:" + co; } } } } } } } } } #endregion } } } srt = "RECV_ORD_ID_" + p.OrdId; } }/*缓存检查结束位置*/ } } LogInfo.WriteLog(log); #endregion return(Content(srt)); }
//汇付模拟发起的请求,没有携带用户的cookie,造成邀请丢失,邀请关系逻辑迁移至注册成功 /// <summary> /// 注册成功汇付返回通知 /// </summary> /// <returns></returns> public ActionResult Succ_Registered() { int it = -10000; string username = ""; string useremail = ""; ReUserRegister m = new ReUserRegister(); m.CmdId = DNTRequest.GetString("CmdId"); m.RespCode = DNTRequest.GetString("RespCode"); m.RespDesc = DNTRequest.GetString("RespDesc"); m.MerCustId = DNTRequest.GetString("MerCustId"); m.UsrId = DNTRequest.GetString("UsrId"); m.UsrCustId = DNTRequest.GetString("UsrCustId"); m.BgRetUrl = DNTRequest.GetString("BgRetUrl"); m.TrxId = DNTRequest.GetString("TrxId"); m.RetUrl = DNTRequest.GetString("RetUrl"); m.MerPriv = DNTRequest.GetString("MerPriv"); m.IdType = DNTRequest.GetString("IdType"); m.IdNo = DNTRequest.GetString("IdNo"); m.UsrMp = DNTRequest.GetString("UsrMp"); useremail = DNTRequest.GetString("UsrEmail"); m.UsrEmail = useremail; username = HttpUtility.UrlDecode(DNTRequest.GetString("UsrName")); m.UsrName = username; m.ChkValue = DNTRequest.GetString("ChkValue"); string log = "注册开户返回报文:" + FastJSON.toJOSN(m); StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.CmdId); chkVal.Append(m.RespCode); chkVal.Append(m.MerCustId); chkVal.Append(m.UsrId); chkVal.Append(m.UsrCustId); chkVal.Append(m.BgRetUrl); chkVal.Append(m.TrxId); chkVal.Append(m.RetUrl); chkVal.Append(m.MerPriv); string chkv = chkVal.ToString(); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, m.ChkValue); log += ";ret:" + ret; if (ret == 0) { B_member_table ob = new B_member_table(); M_member_table pm = new M_member_table(); if (m.RespCode == "000") { //为避免重复调用,增加缓存校验 string cachename = "UserRegister" + m.TrxId; if (Utils.GeTThirdCache(cachename) == 0) { Utils.SetThirdCache(cachename); M_bonus_account_water mbaw = new M_bonus_account_water(); B_bonus_account_water bbaw = new B_bonus_account_water(); B_usercenter b = new B_usercenter(); it = b.Succ_Reg(m); log += ";汇付开户成功后进行用户数据更新返回:" + it; if (it > 0) { pm = ob.GetModel(Utils.GetUserSplit(m.UsrId)); ViewBag.registerid = pm.registerid; //新人注册奖励 ActFacade act = new ActFacade(); log += ";注册ID:" + pm.registerid; act.SendBonusAfterRegister(pm.registerid, EnumCommon.E_hx_ActivityTable.E_ActTargetPlatform.web); } else { /*第三方成功,本地服务器操作失败*/ } } } } else { log += "验签不成功"; /*验签不成功*/ } LogInfo.WriteLog(log); return(View(m)); }
/// <summary> /// 活动企业向用户转账 /// </summary> /// <returns></returns> public ActionResult ToUserTransfer() { // Thread.Sleep(6000); string str = ""; ReTransfer p = new ReTransfer(); p.CmdId = DNTRequest.GetString("CmdId"); p.RespCode = DNTRequest.GetString("RespCode"); p.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); p.OrdId = DNTRequest.GetString("OrdId"); p.OutCustId = DNTRequest.GetString("OutCustId"); p.OutAcctId = DNTRequest.GetString("OutAcctId"); p.TransAmt = DNTRequest.GetString("TransAmt"); p.InCustId = DNTRequest.GetString("InCustId"); p.InAcctId = DNTRequest.GetString("InAcctId"); p.RetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl")); p.BgRetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl")); p.MerPriv = DNTRequest.GetString("MerPriv"); p.ChkValue = DNTRequest.GetString("ChkValue"); StringBuilder builder = new StringBuilder(); builder.Append(p.CmdId); builder.Append(p.RespCode); builder.Append(p.OrdId); builder.Append(p.OutCustId); builder.Append(p.OutAcctId); builder.Append(p.TransAmt); builder.Append(p.InCustId); builder.Append(p.InAcctId); builder.Append(HttpUtility.UrlDecode(p.RetUrl)); builder.Append(HttpUtility.UrlDecode(p.BgRetUrl)); builder.Append(p.MerPriv); string chkv = builder.ToString(); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, p.ChkValue); string log = "后台平台向用户活动转账后"; log += "<br>1台验签:" + ret.ToString(); log += "<br>1台主动投标返回报文:" + FastJSON.toJOSN(p); LogInfo.WriteLog(log); if (ret == 0) { if (p.RespCode == "000") { #region 验签缓存处理 string cachename = p.OrdId + "ToUserTransfer" + p.InCustId; if (Utils.GeTThirdCache(cachename) == 0) { Utils.SetThirdCache(cachename); B_usercenter BUC = new B_usercenter(); int bid_records_id = DbHelperSQL.Execint(" select amtproid from hx_UserAct where OrderID='" + p.OrdId + "' and UseState=5"); int ic = BUC.UpateActToUserTransfer(p, bid_records_id); if (ic > 0) { string sql = "SELECT registerid,username,mobile from hx_member_table where UsrCustId='" + p.InCustId + "'"; DataTable dt = DbHelperSQL.GET_DataTable_List(sql); if (dt.Rows.Count > 0) { int ActID = int.Parse(p.MerPriv); hx_ActivityTable hat = ef.hx_ActivityTable.Where(c => c.ActID == ActID).FirstOrDefault(); #region 流水信息 /* * B_usercenter ors = new B_usercenter(); * decimal di = ors.GetUsridAvailable_balance(int.Parse(dt.Rows[0]["registerid"].ToString())); * // di = di + decimal.Parse(hua.Amt.ToString()); * StringBuilder strSql = new StringBuilder(); * strSql.Append("insert into hx_Capital_account_water("); * strSql.Append("membertable_registerid,income,expenditure,time_of_occurrence,account_balance,types_Finance,createtime,keyid,remarks)"); * strSql.Append(" values ("); * strSql.Append("" + int.Parse(dt.Rows[0]["registerid"].ToString()) + "," + decimal.Parse(p.TransAmt.ToString()) + ",0,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + di + "," + (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.现金奖励.ToString()) + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',0,'" + "现金奖励" + "')"); * * DbHelperSQL.RunSql(strSql.ToString()); * * strSql.Clear(); */ #endregion #region 奖励流水 M_bonus_account_water mbaw = new M_bonus_account_water(); B_bonus_account_water bbaw = new B_bonus_account_water(); DateTime dte = DateTime.Now; mbaw.bonus_account_id = int.Parse(hat.ActID.ToString()); mbaw.membertable_registerid = int.Parse(dt.Rows[0]["registerid"].ToString()); mbaw.income = decimal.Parse(p.TransAmt); mbaw.expenditure = 0.00M; mbaw.time_of_occurrence = DateTime.Now; mbaw.award_description = hat.ActName + "奖励已汇入个人账户"; mbaw.water_type = 0; bbaw.Add(mbaw); #endregion #region MyRegion 系统消息 DateTime dti = DateTime.Now; M_td_System_message pm = new M_td_System_message(); pm.MReg = int.Parse(dt.Rows[0]["registerid"].ToString()); pm.Mstate = 0; pm.MTitle = hat.ActName; pm.MContext = "尊敬的用户" + dt.Rows[0]["username"].ToString() + ":您好!恭喜您成功投资了项目,现金奖励 " + p.TransAmt + "元。如有问题可咨询创利投的客服!"; pm.PubTime = dti; pm.Mtype = 2; B_usercenter.AddMessage(pm); #endregion } } } #endregion str = "RECV_ORD_ID_" + p.OrdId.ToString(); } else { } } return(Content(str)); }
public ActionResult Index(RequestParam <RequestCash> reqst) { LoggerHelper.Info(reqst); ResultInfo <string> res = new ResultInfo <string>("99999"); int userId = ConvertHelper.ParseValue(reqst.body.userId.ToString(), 0); //用户id decimal Amt = reqst.body.transAmt; //提现金额 int usrBindCardId = ConvertHelper.ParseValue(reqst.body.usrBindCardId.ToString(), 0); //提现卡id decimal servf = 0.00M; string orderid = Settings.Instance.OrderCode; B_member_table b = new B_member_table(); M_member_table p = new M_member_table(); M_Cash mc = new M_Cash(); M_ReqExt mr = new M_ReqExt(); p = b.GetModel(userId); MemberLogic _logic = new MemberLogic(); var result = _logic.SelectUserBindCards(usrBindCardId); if (result == null || result.Count < 0) { LoggerHelper.Info("提现失败,用户关联的银行卡不存在:" + JsonHelper.Entity2Json(reqst)); return(Content("提现失败,用户关联的银行卡不存在!")); } if (!_logic.IsAllowWithdrawalCash(usrBindCardId, reqst.body.withdrawalType)) { LoggerHelper.Info("提现失败,用户关联的银行卡不支持此类型的取现请求:" + JsonHelper.Entity2Json(reqst)); return(Content("提现失败,用户关联的银行卡不支持此类型的取现请求!")); } MemberBankEntity ubc = result.FirstOrDefault(); if (ubc.UsrCustId == p.UsrCustId) { mc.Version = "20"; mc.CmdId = "Cash"; mc.MerCustId = Settings.Instance.MerCustId; mc.OrdId = orderid; mc.UsrCustId = p.UsrCustId; mc.TransAmt = Amt.ToString("0.00"); /*普通取现不收会员手续费*/ mc.ServFee = ""; mc.ServFeeAcctId = Settings.Instance.MerDt; mc.OpenAcctId = ubc.OpenAcctId; mc.RetUrl = Settings.Instance.GetCallbackUrl("/Cash/Index/CashCallback"); mc.BgRetUrl = Settings.Instance.GetCallbackUrl("/Cash/Index/CashBgCallback"); mc.Remark = ""; mc.CharSet = "UTF-8"; mc.MerPriv = "chuanglitou"; //if (reqst.body.withdrawalType == 2) // mr.FeeObjFlag = "U"; //客户承担提现手费续 //else mr.FeeObjFlag = "M"; //商家承担提现手费续 mr.FeeAcctId = Settings.Instance.MerDt; //reqst.body.withdrawalType = 1; switch (reqst.body.withdrawalType) { case 2: mr.CashChl = "IMMEDIATE"; break; case 1: mr.CashChl = "FAST"; break; case 0: default: mr.CashChl = "GENERAL"; //一般取现 break; } //mr.CashChl = "GENERAL"; //一般取现 // mr.CashChl = "FAST"; //快速取现 // mr.CashChl = "IMMEDIATE"; // 即时取现 mc.ReqExt = "[" + FastJSON.toJOSN(mr) + "]"; StringBuilder chkVal = new StringBuilder(); chkVal.Append(mc.Version); chkVal.Append(mc.CmdId); chkVal.Append(mc.MerCustId); chkVal.Append(mc.OrdId); chkVal.Append(mc.UsrCustId); chkVal.Append(mc.TransAmt); chkVal.Append(mc.ServFee); chkVal.Append(mc.ServFeeAcctId); chkVal.Append(mc.OpenAcctId); chkVal.Append(mc.RetUrl); chkVal.Append(mc.BgRetUrl); chkVal.Append(mc.Remark); chkVal.Append(mc.MerPriv); chkVal.Append(mc.ReqExt); string chkv = chkVal.ToString(); LoggerHelper.Info("取现chkv字符:" + chkv); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Settings.Instance.MerPr; //需要指定提交字符串的长度 int len = Encoding.UTF8.GetBytes(chkv).Length; StringBuilder sbChkValue = new StringBuilder(256); //加签 int str = DllInterop.SignMsg(Settings.Instance.MerId, merKeyFile, chkv, len, sbChkValue); mc.ChkValue = sbChkValue.ToString(); if (str == 0) { M_td_UserCash mu = new M_td_UserCash(); B_td_UserCash mo = new B_td_UserCash(); mu.registerid = p.registerid; mu.UsrCustId = p.UsrCustId; mu.TransAmt = decimal.Parse(mc.TransAmt); mu.FeeAmt = servf; mu.OrdId = mc.OrdId; mu.OrdIdTime = DateTime.Now; mu.OrdIdState = 0; mu.FeeObjFlag = mr.FeeObjFlag; mo.Add(mu); } LoggerHelper.Info("加签字符:" + str); LoggerHelper.Info("提现提交表单:" + JsonHelper.Entity2Json(mc)); return(View(mc)); } else { LoggerHelper.Info("提现失败,用户提现的银行卡的关联帐户和当前用户关联的银行卡帐户不一致:" + JsonHelper.Entity2Json(reqst)); return(Content("提现失败,用户提现的银行卡的关联帐户和当前用户关联的银行卡帐户不一致!")); } }
public string Register(string Validatecode, string userpassword1, string mobile1, string username1, bool realMobileUser = false) { Utils.SetSYSDateTimeFormat(); string json = ""; //注册奖历 M_Activity_schedule ma = new M_Activity_schedule(); B_Activity_schedule ba = new B_Activity_schedule(); B_member_table o = new B_member_table(); M_member_table p = new M_member_table(); B_bonus_account bb = new B_bonus_account(); M_bonus_account mb = new M_bonus_account(); M_bonus_account_water mbaw = new M_bonus_account_water(); B_bonus_account_water bbaw = new B_bonus_account_water(); string email1 = ""; string strvcode = realMobileUser ? "y" : ck.GetVcode(Validatecode, mobile1); //string strvcode = "y"; if ((Settings.Instance.SiteDomain.IndexOf(PublicURL.NewWXUrl) >= 0)) { strvcode = ck.GetVcodeWX(Validatecode, mobile1); } string tid = Utils.GetCookie("Cooperation", "tid"); int ch = 0; string invcode = Utils.GetInvCode(); #region 道 //渠道的cookie var cc_keyValue = Utils.GetInvCookie("channel"); string cInvitedcode = string.Empty; if (string.IsNullOrEmpty(invcode) && cc_keyValue.Count != 0) { cInvitedcode = cc_keyValue["Invitedcode"]; } #endregion if (Utils.GetCookie("Cooperation", "ch") != "") { try { ch = int.Parse(Utils.GetCookie("Cooperation", "ch")); } catch { ch = 0; } } if (ch == 0) { if (invcode != "") { ch = 3; } else { ch = 2; } } if (realMobileUser || strvcode != null) { if (realMobileUser || strvcode == "y") { string checkMob = ck.checkmobile(mobile1, 0); if (checkMob != "y") { json = @" {""rs"" : ""n"", ""error"" : ""手机号已被注册!""}"; return(json); } p.username = username1; p.password = DESEncrypt.Encrypt(userpassword1, ConfigurationManager.AppSettings["webp"].ToString()); p.mobile = mobile1; p.email = email1; p.usertypes = 0; p.invitedcode = Calculator.Getinvitedcode(); p.ismobile = 1; p.Channelsource = ch; p.Tid = tid; p.channel_invitedcode = cInvitedcode; LogInfo.WriteLog("用户注册内容:" + FastJSON.toJOSN(p) + " IP:" + Utils.GetRealIP()); int uid = o.Add(p);//注册成功返回会员ID if (uid > 0) { //记录用户信息到活动流量发放表里 2016.10.21-31日 //string CookCode = Utils.GetCookie("CookCode"); //if (!string.IsNullOrWhiteSpace(CookCode)) //{ // if (CookCode== "liumi") // { // AddReceiveInfo(uid); // } //} if (tid != "") { // Utils.GetCoopAPI(tid, uid.ToString(), 1); } string keys = DESEncrypt.Encrypt(uid.ToString(), ConfigurationManager.AppSettings["webp"].ToString()); string keys1 = DESEncrypt.Encrypt(username1, ConfigurationManager.AppSettings["webp"].ToString()); M_td_SMS_record pm = new M_td_SMS_record(); B_td_SMS_record om = new B_td_SMS_record(); int smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.注册成功.ToString()); string smscontxt = Utils.GetMSMEmailContext(18, 1); // 获取注册成功邮件内容 StringBuilder sbsms = new StringBuilder(smscontxt); string mobile = mobile1; sbsms = sbsms.Replace("#USERANEM#", p.username.ToString()); pm.phone_number = mobile; pm.sendtime = DateTime.Now; pm.senduserid = uid; pm.smstype = smstype; pm.smscontext = sbsms.ToString(); pm.orderid = SendSMS.Send_SMS(mobile, sbsms.ToString()); pm.vcode = ""; om.Add(pm); M_login mlogin = new M_login(); mlogin.userid = uid; mlogin.username = p.username; mlogin.codeno = Utils.SetSessioncode(); int remember = 0; FormsAuthentication.SignOut(); Utils.AddLoginCache(p.username, mlogin); string sql = "update hx_member_table set lastlogintime='" + DateTime.Now + "',lastloginIP='" + Utils.GetRealIP() + "' where registerid=" + uid.ToString(); DbHelperSQL.ExecuteSql(sql); #region MyRegion //记录邀请关系 LogInfo.WriteLog("注册:邀请码:" + invcode); if (invcode != "") { string codesql = "SELECT invcode from hx_td_Userinvitation where invpersonid=" + uid.ToString();//查询本人是否已经被邀请注册过 invcode='" + invcode + "' and LogInfo.WriteLog("codesql2:" + codesql); DataTable dtcode = DbHelperSQL.GET_DataTable_List(codesql); if (dtcode.Rows.Count == 0) { M_td_Userinvitation myao = new M_td_Userinvitation(); B_td_Userinvitation dyao = new B_td_Userinvitation(); int yaouids = Utils.GetCodeUid(); myao.invcode = invcode; myao.invtime = DateTime.Now; myao.invpersonid = uid; myao.Invpeopleid = yaouids; myao.InvitesStates = 0; myao.Invitereward = 0; int myaoint = dyao.Add(myao); } } #endregion MyRegion //记录邀请关系 json = @" {""rs"" : ""y"", ""url"" : ""/index.html"",""uid"":" + uid + "}"; string temstr = "/opening_account/Index/" + uid.ToString(); json = json.Replace("/index.html", temstr); return(json); } else { json = @" {""rs"" : ""n"", ""error"" : ""注册失败!""}"; return(json); } } else { json = @" {""rs"" : ""n"", ""error"" : ""验证码不对!""}"; return(json); } } else { json = @" {""rs"" : ""n"", ""error"" : ""验证码不存在或过期!""}"; } return(json); }
public ActionResult BgCashProcessing() { // Response.BufferOutput = true; // System.Threading.Thread.Sleep(1000); string str = ""; ReCashAudit m = new ReCashAudit(); m.CmdId = DNTRequest.GetString("CmdId"); m.RespCode = DNTRequest.GetString("RespCode"); m.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); m.MerCustId = DNTRequest.GetString("MerCustId"); m.OrdId = DNTRequest.GetString("OrdId"); m.UsrCustId = DNTRequest.GetString("UsrCustId"); m.TransAmt = DNTRequest.GetString("TransAmt"); m.OpenAcctId = DNTRequest.GetString("OpenAcctId"); m.OpenBankId = DNTRequest.GetString("OpenBankId"); m.AuditFlag = DNTRequest.GetString("AuditFlag"); m.FeeAmt = DNTRequest.GetString("FeeAmt"); m.FeeCustId = DNTRequest.GetString("FeeCustId"); m.FeeAcctId = DNTRequest.GetString("FeeAcctId"); m.RetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl")); m.BgRetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl")); m.MerPriv = HttpUtility.UrlDecode(DNTRequest.GetString("MerPriv")); m.ChkValue = DNTRequest.GetString("ChkValue"); LogInfo.WriteLog("后台取现审核返回参数:" + FastJSON.toJOSN(m)); StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.CmdId); chkVal.Append(m.RespCode); chkVal.Append(m.MerCustId); chkVal.Append(m.OrdId); chkVal.Append(m.UsrCustId); chkVal.Append(m.TransAmt); chkVal.Append(m.OpenAcctId); chkVal.Append(m.OpenBankId); chkVal.Append(m.AuditFlag); chkVal.Append(m.RetUrl); chkVal.Append(m.BgRetUrl); chkVal.Append(m.MerPriv); string msg = chkVal.ToString(); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); //需要指定提交字符串的长度 int len = Encoding.UTF8.GetBytes(msg).Length; StringBuilder sbChkValue = new StringBuilder(256); int ret = DllInterop.VeriSignMsg(merKeyFile, msg, msg.Length, m.ChkValue); LogInfo.WriteLog("后台验签返回参数:" + ret.ToString()); #region 核验签结果 if (ret == 0) { if (m.RespCode == "000" || m.RespCode == "999" || m.RespCode == "406") { System.Threading.Thread.Sleep(500); string cachename = m.OrdId + "Cash" + m.UsrCustId + m.TransAmt.ToString(); if (Utils.GeTThirdCache(cachename) == 0) { Utils.SetThirdCache(cachename); //提现成功后,得多事务处理账户金额,流水等 B_usercenter BUC = new B_usercenter(); M_Capital_account_water aw = new M_Capital_account_water(); if (BUC.Su_CashProcessing(m, aw) > 0) { str = "RECV_ORD_ID_" + m.OrdId; LogInfo.WriteLog("后台取款审核成功" + str); } else { LogInfo.WriteLog("后台取款审核事误操作失败"); } } str = "RECV_ORD_ID_" + m.OrdId; } else { LogInfo.WriteLog("后台提现失败"); } } else { LogInfo.WriteLog("后台验签失败"); } #endregion return(Content(str)); }
/// <summary> /// 12月份元旦活动转账专用 获取活动信息 短信通知部分需要更改 /// </summary> /// <param name="mc"></param> /// <param name="TrAMT"></param> /// <param name="TransAmt"></param> public void YuandaiToUserTransfer(M_CashAwards mc, decimal TrAMT, decimal TransAmt) { M_Transfer m = new M_Transfer(); m.Version = "10"; m.CmdId = "Transfer"; // m.OrdId = Utils.Createcode(); m.OrdId = mc.OrdId.ToString(); m.OutCustId = Utils.GetMerCustID(); m.OutAcctId = "MDT000001"; m.TransAmt = mc.Amounts.ToString("0.00"); m.InCustId = mc.UsrCustId; m.BgRetUrl = Utils.GetRe_url("Thirdparty/ToUserTransfer.aspx"); m.MerPriv = mc.proid.ToString(); StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.Version); chkVal.Append(m.CmdId); chkVal.Append(m.OrdId); chkVal.Append(m.OutCustId); chkVal.Append(m.OutAcctId); chkVal.Append(m.TransAmt); chkVal.Append(m.InCustId); chkVal.Append(m.RetUrl); chkVal.Append(m.BgRetUrl); chkVal.Append(m.MerPriv); string chkv = chkVal.ToString(); LogInfo.WriteLog("12月份元旦活动平台向用户活动转账加签chkv字符:" + chkv); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr(); //需要指定提交字符串的长度 int len = Encoding.UTF8.GetBytes(chkv).Length; StringBuilder sbChkValue = new StringBuilder(256); //加签 int str = DllInterop.SignMsg(Utils.GetMerId(), merKeyFile, chkv, len, sbChkValue); LogInfo.WriteLog("12月份元旦活动平台向用户活动转账加签字符:" + str.ToString()); m.ChkValue = sbChkValue.ToString(); LogInfo.WriteLog("12月份元旦活动平台向用户活动转账提交信息:" + FastJSON.toJOSN(m)); LogInfo.WriteLog("ChkValue:" + m.ChkValue); using (var client = new WebClient()) { var values = new NameValueCollection(); values.Add("Version", m.Version); values.Add("CmdId", m.CmdId); values.Add("OrdId", m.OrdId); values.Add("OutCustId", m.OutCustId); values.Add("OutAcctId", m.OutAcctId); values.Add("TransAmt", m.TransAmt); values.Add("InCustId", m.InCustId); values.Add("InAcctId", m.InAcctId); values.Add("RetUrl", m.RetUrl); values.Add("BgRetUrl", m.BgRetUrl); values.Add("MerPriv", m.MerPriv); values.Add("ChkValue", m.ChkValue); string url = Utils.GetChinapnrUrl(); //同步发送form表单请求 byte[] result = client.UploadValues(url, "POST", values); var retStr = Encoding.UTF8.GetString(result); // Response.Write(retStr); LogInfo.WriteLog("12月份元旦活动自动扣款转账(商户用)返回报文" + retStr); ReTransfer reg = new ReTransfer(); var retloan = (ReTransfer)FastJSON.ToObject(retStr, reg); StringBuilder builder = new StringBuilder(); builder.Append(retloan.CmdId); builder.Append(retloan.RespCode); builder.Append(retloan.OrdId); builder.Append(retloan.OutCustId); builder.Append(retloan.OutAcctId); builder.Append(retloan.TransAmt); builder.Append(retloan.InCustId); builder.Append(retloan.InAcctId); builder.Append(HttpUtility.UrlDecode(retloan.RetUrl)); builder.Append(HttpUtility.UrlDecode(retloan.BgRetUrl)); builder.Append(retloan.MerPriv); var msg = builder.ToString(); LogInfo.WriteLog("12月份元旦活动平台向用户活动转账返回参数:" + msg); //验签 string pgPubkFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(pgPubkFile, msg, msg.Length, retloan.ChkValue); LogInfo.WriteLog("12月份元旦活动平台向用户活动转账验签ret:" + ret.ToString()); if (ret == 0) { if (retloan.RespCode == "000") { /* * string sql = "update hx_CashAwards set OrdIdstate=3 where OrdIdstate=1 and OrdId=" + retloan.OrdId + " and proid =" + retloan.MerPriv; * DbHelperSQL.RunSql(sql); * LogInfo.WriteLog("平台向用户活动转账验签更新"+ sql); */ // Response.Write(retloan.RespCode + " <br> "); B_usercenter BUC = new B_usercenter(); int dint = BUC.UpateAwa(retloan); LogInfo.WriteLog("12月份元旦活动事务执行返回:" + dint.ToString()); if (dint > 0) { B_member_table dmt = new B_member_table(); string sql = "SELECT registerid,username,mobile from hx_member_table where UsrCustId='" + retloan.InCustId + "'"; DataTable dt = DbHelperSQL.GET_DataTable_List(sql); if (dt.Rows.Count > 0) { //活动奖历 M_Activity_schedule ma = new M_Activity_schedule(); B_Activity_schedule ba = new B_Activity_schedule(); B_bonus_account bb = new B_bonus_account(); M_bonus_account mb = new M_bonus_account(); M_bonus_account_water mbaw = new M_bonus_account_water(); B_bonus_account_water bbaw = new B_bonus_account_water(); DateTime dte = DateTime.Now; // ma = ba.GetModel(16); //测试平台 ma = ba.GetModel(15); //获取奖励对象 mb.activity_schedule_id = ma.activity_schedule_id; mb.membertable_registerid = int.Parse(dt.Rows[0]["registerid"].ToString()); mb.activity_schedule_name = ma.activity_schedule_name; mb.amount_of_reward = decimal.Parse(retloan.TransAmt); mb.use_lower_limit = ma.use_lower_limit; mb.reward = ma.reward; mb.start_date = dte; mb.end_date = dte; mb.entry_time = dte; mb.reward_state = 3; int bbid = bb.Add(mb); if (bbid > 0) //奖励记录成功后插入明细记录 { mbaw.bonus_account_id = bbid; mbaw.membertable_registerid = mb.membertable_registerid; mbaw.income = mb.amount_of_reward; mbaw.expenditure = 0.00M; mbaw.time_of_occurrence = mb.entry_time; // mbaw. mbaw.award_description = "已汇入个人账户"; mbaw.water_type = 0; bbaw.Add(mbaw); //短信通知 #region MyRegion //短信通知 string contxt = Utils.GetMSMEmailContext(20, 1); // 获取注册成功邮件内容 StringBuilder sbsms = new StringBuilder(contxt); sbsms = sbsms.Replace("#USERANEM#", dt.Rows[0]["username"].ToString()); sbsms = sbsms.Replace("#MONEY#", TrAMT.ToString("0.00")); sbsms = sbsms.Replace("#AMTM#", TransAmt.ToString("0.00")); string mobile = dt.Rows[0]["mobile"].ToString(); M_td_SMS_record psms = new M_td_SMS_record(); B_td_SMS_record osms = new B_td_SMS_record(); int smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.活动奖励.ToString()); psms.phone_number = mobile; psms.sendtime = DateTime.Now; psms.senduserid = int.Parse(dt.Rows[0]["registerid"].ToString()); psms.smstype = smstype; psms.smscontext = sbsms.ToString(); psms.orderid = SendSMS.Send_SMS(mobile, sbsms.ToString()); psms.vcode = ""; osms.Add(psms); #endregion } #region MyRegion 系统消息 DateTime dti = DateTime.Now; M_td_System_message pm = new M_td_System_message(); pm.MReg = int.Parse(dt.Rows[0]["registerid"].ToString()); pm.Mstate = 0; pm.MTitle = "投资成功现金奖励"; pm.MContext = "尊敬的用户" + dt.Rows[0]["username"].ToString() + ":您好!恭喜您成功投资了项目,现金奖励 " + retloan.TransAmt + "元。如有问题可咨询创利投的客服!"; pm.PubTime = dti; B_usercenter.AddMessage(pm); #endregion } LogInfo.WriteLog("12月份元旦活动 平台向用户活动转账验签更新成功,需要写入消息"); } } else { //Response.Write(HttpUtility.UrlDecode(retloan.)); } } } }
public ActionResult BgUsrPay() { string str = ""; ReUsrAcctPay m = new ReUsrAcctPay(); m.CmdId = DNTRequest.GetString("CmdId"); m.RespCode = DNTRequest.GetString("RespCode"); m.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); m.OrdId = DNTRequest.GetString("OrdId"); m.UsrCustId = DNTRequest.GetString("UsrCustId"); m.MerCustId = DNTRequest.GetString("MerCustId"); m.TransAmt = DNTRequest.GetString("TransAmt"); m.InAcctId = DNTRequest.GetString("InAcctId"); m.InAcctType = DNTRequest.GetString("InAcctType"); m.RetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl")); m.BgRetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl")); m.MerPriv = DNTRequest.GetString("MerPriv"); m.ChkValue = DNTRequest.GetString("ChkValue"); StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.CmdId); chkVal.Append(m.RespCode); chkVal.Append(m.OrdId); chkVal.Append(m.UsrCustId); chkVal.Append(m.MerCustId); chkVal.Append(m.TransAmt); chkVal.Append(m.InAcctId); chkVal.Append(m.InAcctType); chkVal.Append(m.RetUrl); chkVal.Append(m.BgRetUrl); chkVal.Append(m.MerPriv); string chkv = chkVal.ToString(); string logstr = "RECV_ORD_ID_" + m.OrdId; //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, m.ChkValue); LogInfo.WriteLog("用户向平台商户号转账返回信息:" + FastJSON.toJOSN(m)); if (ret == 0) { if (m.RespCode == "000") { string cachename = m.OrdId + "BgUsrPay" + m.UsrCustId; if (Utils.GeTThirdCache(cachename) == 0) { Utils.SetThirdCache(cachename); string sql = "update hx_member_table set available_balance=available_balance-" + m.TransAmt + " where UsrCustId='" + m.UsrCustId + "'"; DbHelperSQL.RunSql(sql); #region 流水信息 sql = "SELECT registerid,username,mobile from hx_member_table where UsrCustId='" + m.UsrCustId + "'"; System.Data.DataTable dt = DbHelperSQL.GET_DataTable_List(sql); if (dt.Rows.Count > 0) { B_usercenter ors = new B_usercenter(); decimal di = ors.GetUsridAvailable_balance(int.Parse(dt.Rows[0]["registerid"].ToString())); // di = di + decimal.Parse(hua.Amt.ToString()); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into hx_Capital_account_water("); strSql.Append("membertable_registerid,income,expenditure,time_of_occurrence,account_balance,types_Finance,createtime,keyid,remarks)"); strSql.Append(" values ("); strSql.Append("" + int.Parse(dt.Rows[0]["registerid"].ToString()) + ",0," + decimal.Parse(m.TransAmt) + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + (di - decimal.Parse(m.TransAmt)) + "," + (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.用户向平台划账.ToString()) + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',0,'" + "用户向平台划账" + "')"); DbHelperSQL.RunSql(strSql.ToString()); strSql.Clear(); } #endregion //Response.Write(logstr + "转账成功!"); LogInfo.WriteLog(logstr + "用户向平台商户号转账成功:" + sql); } } } else { LogInfo.WriteLog(m.UsrCustId + "用户向平台商户号转账后台失败:"); } return(Content(logstr)); }
/// <summary> /// 汇付绑卡回调 /// </summary> /// <returns></returns> public ActionResult Bgthirdpartybindbank() { string srt = ""; ReUserBindCard m = new ReUserBindCard(); m.CmdId = DNTRequest.GetString("CmdId"); m.RespCode = DNTRequest.GetString("RespCode"); m.RespDesc = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc")); m.MerCustId = DNTRequest.GetString("MerCustId"); m.OpenAcctId = DNTRequest.GetString("OpenAcctId"); m.OpenBankId = DNTRequest.GetString("OpenBankId"); m.UsrCustId = DNTRequest.GetString("UsrCustId"); m.TrxId = DNTRequest.GetString("TrxId"); m.BgRetUrl = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl")); m.MerPriv = HttpUtility.UrlDecode(DNTRequest.GetString("MerPriv")); m.ChkValue = DNTRequest.GetString("ChkValue"); StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.CmdId); chkVal.Append(m.RespCode); chkVal.Append(m.MerCustId); chkVal.Append(m.OpenAcctId); chkVal.Append(m.OpenBankId); chkVal.Append(m.UsrCustId); chkVal.Append(m.TrxId); chkVal.Append(m.BgRetUrl); chkVal.Append(m.MerPriv); string chkv = chkVal.ToString(); string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, m.ChkValue); string log = ""; log += "签名返回结果:" + ret.ToString(); log += "<br>绑卡报文:" + FastJSON.toJOSN(m); LogInfo.WriteLog(log); if (ret == 0) { if (m.RespCode == "000") { LogInfo.WriteLog("进入处理:UsrCustId" + m.UsrCustId); M_UsrBindCard p = new M_UsrBindCard(); B_UsrBindCard o = new B_UsrBindCard(); // p.registerid = 0; p.UsrCustId = m.UsrCustId; p.OpenAcctId = m.OpenAcctId; p.OpenBankId = m.OpenBankId; if (o.Exists(p.UsrCustId)) { p.defCard = 0; } else { p.defCard = 1; } LogInfo.WriteLog("卡状态:" + p.defCard.ToString()); bool df = o.Add(p); LogInfo.WriteLog("绑卡卡数据写入:" + df); string sql = "update hx_member_table set isbankcard=1 where UsrCustId='" + m.UsrCustId + "'"; DbHelperSQL.ExecuteSql(sql); srt = "RECV_ORD_ID_" + m.TrxId; LogInfo.WriteLog("卡绑定操作签名成功" + srt); } else { LogInfo.WriteLog("卡绑定操作签名失败"); } } else { LogInfo.WriteLog("签名失败"); } return(Content(srt)); }
public ActionResult Su_Repayment() { Utils.SetSYSDateTimeFormat(); chuangtouEntities ef = new chuangtouEntities(); string str = ""; ReRepayment Re = new ReRepayment(); Re.CmdId = DNTRequest.GetString("CmdId"); Re.RespCode = DNTRequest.GetString("RespCode"); Re.MerCustId = DNTRequest.GetString("MerCustId"); Re.ProId = DNTRequest.GetString("ProId"); Re.OrdId = DNTRequest.GetString("OrdId"); Re.OrdDate = DNTRequest.GetString("OrdDate"); Re.OutCustId = DNTRequest.GetString("OutCustId"); Re.SubOrdId = DNTRequest.GetString("SubOrdId"); Re.SubOrdDate = DNTRequest.GetString("SubOrdDate"); Re.OutAcctId = DNTRequest.GetString("OutAcctId"); Re.TransAmt = DNTRequest.GetString("TransAmt"); Re.PrincipalAmt = DNTRequest.GetString("PrincipalAmt"); Re.InterestAmt = DNTRequest.GetString("InterestAmt"); Re.Fee = DNTRequest.GetString("Fee"); Re.InCustId = DNTRequest.GetString("InCustId"); Re.InAcctId = DNTRequest.GetString("InAcctId"); Re.FeeObjFlag = DNTRequest.GetString("FeeObjFlag"); Re.DzObject = DNTRequest.GetString("DzObject"); Re.BgRetUrl = DNTRequest.GetString("BgRetUrl"); Re.MerPriv = DNTRequest.GetString("MerPriv"); Re.RespExt = DNTRequest.GetString("RespExt"); LogInfo.WriteLog("后台还款返回报文:" + FastJSON.toJOSN(Re)); string version = "20"; if (string.IsNullOrEmpty(Re.TransAmt) || Re.TransAmt == "0.00") { version = "30"; } StringBuilder builder = new StringBuilder(); builder.Append(Re.CmdId); builder.Append(Re.RespCode); builder.Append(Re.MerCustId); if (version == "30") { builder.Append(Re.ProId); } builder.Append(Re.OrdId); builder.Append(Re.OrdDate); builder.Append(Re.OutCustId); builder.Append(Re.SubOrdId); builder.Append(Re.SubOrdDate); builder.Append(Re.OutAcctId); if (version == "30") { builder.Append(Re.PrincipalAmt); builder.Append(Re.InterestAmt); } else { builder.Append(Re.TransAmt); } builder.Append(Re.Fee); builder.Append(Re.InCustId); builder.Append(Re.InAcctId); builder.Append(Re.FeeObjFlag); if (version == "30") { builder.Append(Re.DzObject); } builder.Append(HttpUtility.UrlDecode(Re.BgRetUrl)); builder.Append(Re.MerPriv); builder.Append(HttpUtility.UrlDecode(Re.RespExt)); // builder.Append(Re.ChkValue); var msg = builder.ToString(); if (version == "30") { msg = Utils.MD5(msg); } string pgPubkFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(pgPubkFile, msg, msg.Length, Re.ChkValue); LogInfo.WriteLog("后台验签 ret= " + ret.ToString()); if (ret == 0) { if (Re.RespCode == "000" || Re.TransAmt == "0.00") { string cachename = "Repayment" + Re.OrdId; if (Utils.GeTThirdCache(cachename) == 0) { Utils.SetThirdCache(cachename); B_member_table o = new B_member_table(); M_member_table p = new M_member_table(); M_member_table p2 = new M_member_table(); M_Capital_account_water baw = new M_Capital_account_water(); V_borrowing_Bid_records_income_statement item = new V_borrowing_Bid_records_income_statement(); int income_statement_id = int.Parse(Re.MerPriv); item = ef.V_borrowing_Bid_records_income_statement.AsNoTracking().Where(ps => ps.income_statement_id == income_statement_id).FirstOrDefault(); p = o.GetModel(int.Parse(item.borrower_registerid.ToString())); //借款人用户对象 baw.membertable_registerid = p.registerid; baw.income = 0.00M; baw.expenditure = decimal.Parse(Re.TransAmt); baw.time_of_occurrence = DateTime.Now; baw.account_balance = p.available_balance - baw.expenditure; //面要得么帐户余额 baw.types_Finance = (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.还款.ToString()); baw.createtime = DateTime.Now; baw.keyid = 0; baw.remarks = Re.OrdId + "," + Re.OrdDate; M_Capital_account_water iaw = new M_Capital_account_water(); //投资人流水对象 p2 = o.GetModel(int.Parse(item.investor_registerid.ToString())); //投资人用户对象 iaw.membertable_registerid = p2.registerid; iaw.income = decimal.Parse(Re.TransAmt); iaw.expenditure = 0.00M; iaw.time_of_occurrence = DateTime.Now; iaw.account_balance = p2.available_balance + iaw.income; //面要得么帐户余额 iaw.types_Finance = (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.借款人还款.ToString()); iaw.createtime = DateTime.Now; iaw.keyid = 0; iaw.remarks = Re.OrdId + "," + Re.OrdDate; int targetid = int.Parse(item.targetid.ToString()); //判断是否为最后一期还款,并进行相应状态处理 hx_repayment_plan plan = (from a in ef.hx_repayment_plan where a.targetid == targetid select a).OrderByDescending(a => a.current_period).Take(1).FirstOrDefault(); var lastcur = plan.current_period; //判断是否是最后一期,如果是对本金处理。得直接用最后一期还款金额减去本金,这样就解决多出本金问题 bool lastrepamt = false; if (item.current_investment_period.ToString() == lastcur.ToString()) { lastrepamt = true; } //需要更新投资记录表已还款金额 B_usercenter BUC = new B_usercenter(); decimal PrincipalInterest = decimal.Parse(item.Principal.ToString()) + decimal.Parse(item.interestpayment.ToString()); //本金加利息 decimal PInterest = decimal.Parse(item.interestpayment.ToString()); //利息 Re.MerPriv = DateTime.Parse(item.interest_payment_date.ToString()).ToString("yyyy-MM-dd"); //传入还款日期 int bucd = BUC.Repayment_Successfully(Re, baw, iaw, lastrepamt, PrincipalInterest, PInterest); if (bucd > 0) { // 尊敬#UserName#,您投资的第#PID#号标第#ORDER#期还款已到帐,本次已成功还款#MONEY#元.欢迎继续投资!【创利投】 #region 短信通知 //短信通知 string contxt = Utils.GetMSMEmailContext(11, 1); // 获取注册成功邮件内容 StringBuilder sbsms = new StringBuilder(contxt); sbsms = sbsms.Replace("#USERANEM#", item.username.ToString()); sbsms = sbsms.Replace("#PID#", item.targetid.ToString()); sbsms = sbsms.Replace("#ORDER#", item.current_investment_period.ToString()); sbsms = sbsms.Replace("#MONEY#", item.repayment_amount.ToString()); string mobile = item.mobile.ToString(); M_td_SMS_record psms = new M_td_SMS_record(); B_td_SMS_record osms = new B_td_SMS_record(); int smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.投资回款.ToString()); psms.phone_number = mobile; psms.sendtime = DateTime.Now; psms.senduserid = int.Parse(item.investor_registerid.ToString()); psms.smstype = smstype; psms.smscontext = sbsms.ToString(); psms.orderid = SendSMS.Send_SMS(mobile, sbsms.ToString()); psms.vcode = ""; osms.Add(psms); #endregion #region 系统消息 //系统消息 DateTime dti = DateTime.Now; M_td_System_message pm = new M_td_System_message(); pm.MReg = int.Parse(item.investor_registerid.ToString()); pm.Mstate = 0; pm.MTitle = "投资回款"; // pm.MContext = "尊敬的用户" + dt.Rows[0]["username"].ToString() + ":您好!恭喜您成功投资了项目【" + dt.Rows[0]["borrowing_title"].ToString() + "】,投资金额是:" + dt.Rows[0]["investment_amount"].ToString() + "。如有问题可咨询创利投的客服!谢谢!"; pm.MContext = sbsms.ToString(); pm.PubTime = dti; pm.Mtype = 2; B_usercenter.AddMessage(pm); #endregion #region 更新标的状态为还还清 ///更新标的状态为还还清 if (item.current_investment_period.ToString() == lastcur.ToString()) { //更新标的状态为还还清 string sql = "update hx_borrowing_target set tender_state=5 where targetid=" + item.targetid.ToString() + ""; DbHelperSQL.ExecuteSql(sql); sql = "update hx_Bid_records set payment_status =1 where bid_records_id=" + item.bid_records_id.ToString(); DbHelperSQL.ExecuteSql(sql); } #endregion //Response.Write("还款验签成功!"); } else { //Response.Write("还款更新失败!" + bucd.ToString()); } } str = "RECV_ORD_ID_" + Re.OrdId; LogInfo.WriteLog(str + "后台还款成功"); } else { string cc = Utils.GetReturnCode(Int32.Parse(Re.RespCode)); if (cc.Contains("还款金额超过还款总额") || cc.Contains("重复的还款请求")) { B_member_table o = new B_member_table(); M_member_table p = new M_member_table(); M_member_table p2 = new M_member_table(); M_Capital_account_water baw = new M_Capital_account_water(); V_borrowing_Bid_records_income_statement item = new V_borrowing_Bid_records_income_statement(); int income_statement_id = int.Parse(Re.MerPriv); item = ef.V_borrowing_Bid_records_income_statement.AsNoTracking().Where(ps => ps.income_statement_id == income_statement_id).FirstOrDefault(); p = o.GetModel(int.Parse(item.borrower_registerid.ToString())); //借款人用户对象 baw.membertable_registerid = p.registerid; baw.income = 0.00M; baw.expenditure = decimal.Parse(Re.TransAmt); baw.time_of_occurrence = DateTime.Now; baw.account_balance = p.available_balance - baw.expenditure; //面要得么帐户余额 baw.types_Finance = (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.还款.ToString()); baw.createtime = DateTime.Now; baw.keyid = 0; baw.remarks = Re.OrdId + "," + Re.OrdDate; M_Capital_account_water iaw = new M_Capital_account_water(); //投资人流水对象 p2 = o.GetModel(int.Parse(item.investor_registerid.ToString())); //投资人用户对象 iaw.membertable_registerid = p2.registerid; iaw.income = decimal.Parse(Re.TransAmt); iaw.expenditure = 0.00M; iaw.time_of_occurrence = DateTime.Now; iaw.account_balance = p2.available_balance + iaw.income; //面要得么帐户余额 iaw.types_Finance = (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.借款人还款.ToString()); iaw.createtime = DateTime.Now; iaw.keyid = 0; iaw.remarks = Re.OrdId + "," + Re.OrdDate; int targetid = int.Parse(item.targetid.ToString()); //判断是否为最后一期还款,并进行相应状态处理 hx_repayment_plan plan = (from a in ef.hx_repayment_plan where a.targetid == targetid select a).OrderByDescending(a => a.current_period).Take(1).FirstOrDefault(); var lastcur = plan.current_period; //判断是否是最后一期,如果是对本金处理。得直接用最后一期还款金额减去本金,这样就解决多出本金问题 bool lastrepamt = false; if (item.current_investment_period.ToString() == lastcur.ToString()) { lastrepamt = true; } //需要更新投资记录表已还款金额 B_usercenter BUC = new B_usercenter(); decimal PrincipalInterest = decimal.Parse(item.Principal.ToString()) + decimal.Parse(item.interestpayment.ToString()); //本金加利息 decimal PInterest = decimal.Parse(item.interestpayment.ToString()); //利息 Re.MerPriv = DateTime.Parse(item.interest_payment_date.ToString()).ToString("yyyy-MM-dd"); //传入还款日期 int bucd = BUC.Repayment_Successfully(Re, baw, iaw, lastrepamt, PrincipalInterest, PInterest); if (bucd > 0) { // 尊敬#UserName#,您投资的第#PID#号标第#ORDER#期还款已到帐,本次已成功还款#MONEY#元.欢迎继续投资!【创利投】 #region 短信通知 //短信通知 string contxt = Utils.GetMSMEmailContext(11, 1); // 获取注册成功邮件内容 StringBuilder sbsms = new StringBuilder(contxt); sbsms = sbsms.Replace("#USERANEM#", item.username.ToString()); sbsms = sbsms.Replace("#PID#", item.targetid.ToString()); sbsms = sbsms.Replace("#ORDER#", item.current_investment_period.ToString()); sbsms = sbsms.Replace("#MONEY#", item.repayment_amount.ToString()); string mobile = item.mobile.ToString(); M_td_SMS_record psms = new M_td_SMS_record(); B_td_SMS_record osms = new B_td_SMS_record(); int smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.投资回款.ToString()); psms.phone_number = mobile; psms.sendtime = DateTime.Now; psms.senduserid = int.Parse(item.investor_registerid.ToString()); psms.smstype = smstype; psms.smscontext = sbsms.ToString(); psms.orderid = SendSMS.Send_SMS(mobile, sbsms.ToString()); psms.vcode = ""; osms.Add(psms); #endregion #region 系统消息 //系统消息 DateTime dti = DateTime.Now; M_td_System_message pm = new M_td_System_message(); pm.MReg = int.Parse(item.investor_registerid.ToString()); pm.Mstate = 0; pm.MTitle = "投资回款"; // pm.MContext = "尊敬的用户" + dt.Rows[0]["username"].ToString() + ":您好!恭喜您成功投资了项目【" + dt.Rows[0]["borrowing_title"].ToString() + "】,投资金额是:" + dt.Rows[0]["investment_amount"].ToString() + "。如有问题可咨询创利投的客服!谢谢!"; pm.MContext = sbsms.ToString(); pm.PubTime = dti; pm.Mtype = 2; B_usercenter.AddMessage(pm); #endregion #region 更新标的状态为还还清 ///更新标的状态为还还清 if (item.current_investment_period.ToString() == lastcur.ToString()) { //更新标的状态为还还清 string sql = "update hx_borrowing_target set tender_state=5 where targetid=" + item.targetid.ToString() + ""; DbHelperSQL.ExecuteSql(sql); sql = "update hx_Bid_records set payment_status =1 where bid_records_id=" + item.bid_records_id.ToString(); DbHelperSQL.ExecuteSql(sql); } #endregion //Response.Write("还款验签成功!"); } else { //Response.Write("还款更新失败!" + bucd.ToString()); } } //Response.Write("出现错误! " + Utils.GetReturnCode(Int32.Parse(Re.RespCode))); /* * string cc = Utils.GetReturnCode(Int32.Parse(Re.RespCode)); * * * if (cc.Contains("还款金额超过还款总额") || cc.Contains("重复的还款请求")) * { * * B_member_table o = new B_member_table(); * M_member_table p = new M_member_table(); * M_member_table p2 = new M_member_table(); * M_Capital_account_water baw = new M_Capital_account_water(); * V_borrowing_Bid_records_income_statement item = new V_borrowing_Bid_records_income_statement(); * int income_statement_id = int.Parse(Re.MerPriv); * item = ef.V_borrowing_Bid_records_income_statement.AsNoTracking().Where(ps => ps.income_statement_id == income_statement_id).FirstOrDefault(); * p = o.GetModel(int.Parse(item.borrower_registerid.ToString())); //借款人用户对象 * * * int ic = ef.hx_income_statement.Where(c => c.bid_records_id == item.bid_records_id && c.targetid == item.targetid && c.orderid== Re.OrdId).Update(c => new hx_income_statement { payment_status = 1, repayment_period = DateTime.Now }); * * if (ic > 0) * { * int userid = int.Parse(item.borrower_registerid.ToString()); * UserInfoData ud = new UserInfoData(); * ReQueryBalanceBg retloan = ud.Querybalance(userid); * * if (retloan.RespCode == "000") * { * // sql = "update hx_member_table set available_balance=" + decimal.Parse(retloan.AvlBal) + " ,frozen_sum=" + decimal.Parse(retloan.FrzBal) + " where registerid=" + userid.ToString() + ""; * * //sql = "update hx_member_table set available_balance=" + decimal.Parse(retloan.AvlBal) + " where registerid=" + userid.ToString() + ""; * * //DbHelperSQL.RunSql(sql); * B_usercenter bu = new B_usercenter(); * bu.DataSync(retloan, userid.ToString()); * * * * * } * } */ } } return(Content(str)); }
public ActionResult CashProcessingMore(string str) { string json = ""; if (string.IsNullOrEmpty(str)) { json = @"{""ret"":0,""msg"":""参数错误""}"; } string strCount = ""; string bid = str; string[] s = bid.Split(new char[] { ',' }); string sqllist = ""; for (int i = 0; i < s.Length; i++) { sqllist = sqllist + "'" + s[i] + "',"; } if (sqllist.Contains(",")) { bid = Utils.ClearLastChar(sqllist); } int orstate = 1; sqllist = " select registerid,UserCashId,OrdId,OrdIdState,TransAmt,BankName,OpenBankId,OpenAcctId,UsrCustId,realname,Reason,Remarks,available_balance from V_UserCash_Bank "; sqllist += " where UserCashId in (" + bid + ")"; DataTable dt = DbHelperSQL.GET_DataTable_List(sqllist); int succ = 0, lost = 0; for (int i = 0; i < dt.Rows.Count; i++) { M_CashAudit mc = new M_CashAudit(); mc.Version = "10"; mc.CmdId = "CashAudit"; mc.MerCustId = Utils.GetMerCustID(); mc.OrdId = dt.Rows[i]["OrdId"].ToString(); mc.UsrCustId = dt.Rows[i]["UsrCustId"].ToString(); mc.TransAmt = dt.Rows[i]["TransAmt"].ToString(); //判定用户在审核期间内把卡号 移除或取消绑定 或 绑定 状态等于0 string bindCardSql = " SELECT * FROM hx_UsrBindCardC WHERE UsrCustId='{0}' AND OpenAcctId='{1}' "; bindCardSql = string.Format(bindCardSql, dt.Rows[i]["UsrCustId"].ToString(), dt.Rows[i]["OpenAcctId"].ToString()); DataTable bcDt = DbHelperSQL.GET_DataTable_List(bindCardSql); if (bcDt == null || bcDt.Rows.Count == 0) { orstate = 4; } if (orstate == 4) { mc.AuditFlag = "R"; } else { mc.AuditFlag = "S"; } // mc.BgRetUrl = ""; mc.BgRetUrl = Utils.GetRe_url("admin/Thirdparty/BgCashProcessing"); mc.MerPriv = "chuanglitou"; StringBuilder chkVal = new StringBuilder(); chkVal.Append(mc.Version); chkVal.Append(mc.CmdId); chkVal.Append(mc.MerCustId); chkVal.Append(mc.OrdId); chkVal.Append(mc.UsrCustId); chkVal.Append(mc.TransAmt); chkVal.Append(mc.AuditFlag); // chkVal.Append(mc.RetUrl); chkVal.Append(mc.BgRetUrl); chkVal.Append(mc.MerPriv); string chkv = chkVal.ToString(); LogInfo.WriteLog("批量取现审核chkv字符:" + chkv); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr(); //需要指定提交字符串的长度 int len = Encoding.UTF8.GetBytes(chkv).Length; StringBuilder sbChkValue = new StringBuilder(256); //加签 int strer = DllInterop.SignMsg(Utils.GetMerId(), merKeyFile, chkv, len, sbChkValue); mc.ChkValue = sbChkValue.ToString(); LogInfo.WriteLog("批量取现审核提交信息:" + FastJSON.toJOSN(mc)); using (var client = new WebClient()) { var values = new NameValueCollection(); values.Add("Version", mc.Version); values.Add("CmdId", mc.CmdId); values.Add("MerCustId", mc.MerCustId); values.Add("OrdId", mc.OrdId); values.Add("UsrCustId", mc.UsrCustId); values.Add("TransAmt", mc.TransAmt); values.Add("AuditFlag", mc.AuditFlag); values.Add("BgRetUrl", mc.BgRetUrl); values.Add("MerPriv", mc.MerPriv); values.Add("ChkValue", mc.ChkValue); string url = Utils.GetChinapnrUrl(); //同步发送form表单请求 byte[] result = client.UploadValues(url, "POST", values); var retStr = Encoding.UTF8.GetString(result); // Response.Write(retStr); // LogInfo.WriteLog("批量取现审同步form表单请求" + retStr); ReCashAudit ReCa = new ReCashAudit(); var Re = (ReCashAudit)FastJSON.ToObject(retStr, ReCa); LogInfo.WriteLog("批量取现审返回报文:" + FastJSON.toJOSN(Re)); StringBuilder builder = new StringBuilder(); builder.Append(Re.CmdId); builder.Append(Re.RespCode); builder.Append(Re.MerCustId); builder.Append(Re.OrdId); builder.Append(Re.UsrCustId); builder.Append(Re.TransAmt); builder.Append(Re.OpenAcctId); builder.Append(Re.OpenBankId); builder.Append(Re.AuditFlag); builder.Append(HttpUtility.UrlDecode(Re.BgRetUrl)); builder.Append(Re.MerPriv); var msg = builder.ToString(); LogInfo.WriteLog("批量取现审验签文明:" + msg); //验签 string pgPubkFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(pgPubkFile, msg, msg.Length, Re.ChkValue); LogInfo.WriteLog("批量取现审验签 ret= " + ret.ToString()); if (ret == 0) { //更新数据库 string sql = ""; if (orstate == 1) { sql = "update hx_td_UserCash set Remarks='' where UserCashId=" + dt.Rows[i]["UserCashId"].ToString(); DbHelperSQL.RunSql(sql); } else if (orstate == 3) { sql = "update hx_td_UserCash set Remarks='',OrdIdState=3 ,OperTime='" + DateTime.Now.ToString() + "' where UserCashId=" + dt.Rows[i]["UserCashId"].ToString(); DbHelperSQL.RunSql(sql); } else if (orstate == 4) { // sql = "update hx_td_UserCash set Remarks='" + Utils.CheckSQLHtml(model.Remarks) + "', Reason='" + Utils.CheckSQLHtml(model.Reason) + "',OrdIdState=4 ,OperTime='" + DateTime.Now.ToString() + "' where UserCashId=" + UserCashId.ToString(); // sql += ";update hx_member_table set available_balance=available_balance+" + dt.Rows[0]["TransAmt"].ToString() + ",frozen_sum=frozen_sum-" + dt.Rows[0]["TransAmt"].ToString() + " where registerid=" + dt.Rows[0]["registerid"].ToString(); // DbHelperSQL.RunSql(sql); // return Content(StringAlert.Alert("取现未通过,金额已退还!", "/admin/UserCash/CashProcessing?UserCashId=" + model.UserCashId)); } if (Re.RespCode == "000" || Re.RespCode == "999" || Re.RespCode == "406") { string cachename = Re.OrdId + "Cash" + Re.UsrCustId + Re.TransAmt.ToString(); if (Utils.GeTThirdCache(cachename) == 0) { Utils.SetThirdCache(cachename); //提现成功后,得多事务处理账户金额,流水等 B_usercenter BUC = new B_usercenter(); M_Capital_account_water aw = new M_Capital_account_water(); if (BUC.Su_CashProcessing(Re, aw) > 0) { strCount += Re.OrdId + " 取款审核成功<br /> "; LogInfo.WriteLog("后台取款审核成功:" + str); succ = succ + 1; } else { lost = lost + 1; strCount += Re.OrdId + " 取款审核失败<br /> "; LogInfo.WriteLog("后台取款审核事误操作失败"); } } } else { lost = lost + 1; strCount += Re.OrdId + " 取款审核失败 (" + Re.RespCode + ")<br /> "; LogInfo.WriteLog("后台提现失败" + Re.RespCode); } } else { // Response.Write(Re.UsrCustId + "取款审核验签失败 原因: " + Re.RespDesc + " <br>"); } } } json = @"{""ret"":1,""msg"":""<div style='margin: 9px;line-height:20px;'>批量复核操作成功 RR</div>"" }"; string sfd = succ.ToString() + "笔成功, " + lost.ToString() + "失败<br />" + strCount + " "; json = json.Replace("RR", sfd); return(Content(json, "text/json")); }