/// <summary> /// 查询数据列表 /// </summary> /// <param name="awardType"></param> /// <param name="pageIndex"></param> private void DataBind(int awardType, string ActivityName, int pageIndex) { chuangtouEntities ef = new chuangtouEntities(); pageid = pageIndex; B_LuckDraw bllLuckDraw = new B_LuckDraw(); List <M_LuckData> dataList = bllLuckDraw.GetLuckDraw(awardType, ActivityName, pageIndex, pagesize, out RecordCount); //IPagedList<M_LuckData> dataListd= //计算总页数 pagecount = (RecordCount - 1) / pagesize + 1; if (pageid <= 0) { pageid = 1; } //生成分页字符串 pagenumbers = "共" + pagecount + "页 共" + RecordCount + "条 " + Utils.GetPageNumbers(pageid, pagecount, "LuckDrawData?awardType=" + awardType, 6, "page").ToString(); pagenumbers = pagenumbers + "跳转到第 <input name=\"page1\" id=\"page1\" type=\"text\" style=\"width: 26px\" /> <span class=\"button white small\" style=\"cursor:pointer;\" onclick=\"page()\">转跳</span> "; StringBuilder builder = new StringBuilder(); foreach (M_LuckData item in dataList) { builder.Append("<tr>"); builder.AppendFormat("<td class=\"txtb20 c\">{0}</td>", item.AwardName); //奖品名称 builder.AppendFormat("<td class=\"txtb20 c\">{0}</td>", item.UserName); //获奖会员 builder.AppendFormat("<td class=\"txtb40 c\">{0}</td>", item.AwardTime.ToString("yyyy-MM-dd HH:mm")); //中奖时间 builder.AppendFormat("<td class=\"txtb40 c\">{0}</td>", item.ActivityName); //活动名称 builder.AppendFormat("<td class=\"txtb20 c\">{0}</td>", item.AwardType == (int)EnumHelp.LuckDrawEnum.E_AwardType.type0 ? "<a class=\"opt\" style=\"display:inline\" actionData=\"" + item.ID + "\" title=\"审核\">审核</a>" : (item.AwardType == (int)EnumHelp.LuckDrawEnum.E_AwardType.type4 ? "已发放" : "")); //操作 builder.Append("</tr>"); } ViewBag.PageData = pagenumbers; ViewBag.TBData = builder.ToString(); }
/// 增加文章点击量 public void ProcessRequest(HttpContext context) { int id = Convert.ToInt32(context.Request.QueryString["id"]); if (id != 0) { chuangtouEntities TF = new chuangtouEntities(); hx_td_about_news ha = TF.hx_td_about_news.Where(p => p.newid == id).FirstOrDefault(); if (ha != null) { ha.ClickCount = (ha.ClickCount == null ? 0 : ha.ClickCount) + 1; TF.SaveChanges(); } } }
private bool disposedValue = false; // 要检测冗余调用 protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: 释放托管状态(托管对象)。 System.GC.Collect(); } ef.Dispose(); ef = null; // TODO: 释放未托管的资源(未托管的对象)并在以下内容中替代终结器。 // TODO: 将大型字段设置为 null。 disposedValue = true; } }
/// <summary> /// 获取可用的抽奖次数 /// </summary> /// <returns></returns> private int GetCanUseTimes(ref bool hadUsed) { chuangtouEntities ef = new chuangtouEntities(); int userID = Settings.Instance.CurrentUserId; if (userID < 1) { return(0); } B_member_table bllUser = new B_member_table(); M_member_table user = bllUser.GetModel(userID); if (user == null || user.registerid <= 0) { return(0); } int cut = 0; //如果用户是新用户且已经实名认证,则抽奖次数加一 if (user.Registration_time > _activityTime && !string.IsNullOrWhiteSpace(user.UsrCustId)) { cut += 1; } //用户邀请好友,好友实名注册且投资的人数 B_td_Userinvitation bllUserInvitation = new B_td_Userinvitation(); int tcuc = bllUserInvitation.GetTotalCanUseCount(_activityTime, userID); if (tcuc > 0) { cut += tcuc; } int awardID = ConfigHelper.GetConfigInt("GrabCash"); int usedCount = ef.hx_UserAct.Where(c => c.ActID == awardID && c.registerid == userID).Count(); hadUsed = usedCount > 0; if (hadUsed) { cut -= usedCount; } return(cut); }
public bool SendCash(int actID, int Registerid) { bool t = false; chuangtouEntities ef = new chuangtouEntities(); hx_ActivityTable hat = new ActFacade().GetActivityModel(actID); //GetActTableInfo(ActTypeId, ActUser, 1); if (hat != null) { //判是否过期 if (hat.ActStarttime <= DateTime.Now && DateTime.Now <= hat.ActEndtime) { string ActRule = hat.ActRule; List <MAmtList> mlist = new List <MAmtList>(); JavaScriptSerializer js = new JavaScriptSerializer(); //MActCash mc = new MActCash(); Mcoupon mcp = new Mcoupon(); mcp = js.Deserialize <Mcoupon>(ActRule); //mlist = js.Deserialize<List<MAmtList>>(ActRule); //检查分发奖励是否超过顶限,如果超过直接跳过 //int TopNum = B_usercenter.GetTopNum(hat.ActID); //项目已经发放的金额 //decimal totalAmt = B_usercenter.GetTopAmtCount(hat.ActID); //第一次投资获取对应奖励 decimal actamt = mcp.cash;//GetActAmt(mc, InvestAmt, TopNum); //if (mc.TopAmt > totalAmt && mc.TopNum > TopNum) //{ t = true; if (actamt > 0)//大于 0里写入对应的奖励数据 { hx_UserAct hua = new hx_UserAct(); hua.ActTypeId = hat.ActTypeId; hua.registerid = Registerid; hua.RewTypeID = hat.RewTypeID; hua.ActID = hat.ActID; hua.Amt = actamt; hua.Uselower = 0.00M; hua.Usehight = 0.00M; hua.AmtEndtime = DateTime.Parse(hat.ActEndtime.ToString()).AddMonths(1); hua.AmtUses = 1; //没指定情况下默认为单独使用 hua.UseState = 5; //现金未转账 hua.UseTime = DateTime.Now; hua.AmtProid = 0; //未使用默认为0 hua.ISSmsOne = 0; hua.IsSmsThree = 0; hua.isSmsFifteen = 0; hua.IsSmsSeven = 0; hua.isSmsSixteen = 0; hua.OrderID = decimal.Parse(Utils.Createcode()); hua.Createtime = DateTime.Now; hua.Title = hat.ActName; hua.UseLifeLoan = ""; ef.hx_UserAct.Add(hua); int i = ef.SaveChanges(); if (i > 0) { //录入成功,后进行转账操作 //1.获取用户对向 M_member_table p = new M_member_table(); B_member_table o = new B_member_table(); p = o.GetModel(Registerid); if (p != null) { //2.调用商户向用户转账接口 Transfer tf = new Transfer(); ReTransfer retf = tf.ToUserTransfer(p.UsrCustId, actamt, hua.OrderID.ToString(), hua.ActID.ToString(), "/Thirdparty/ToUserTransfer"); if (retf != null) { if (retf.RespCode == "000") { //3.事务处理操作账户及插入流水 #region 验签缓存处理 string cachename = retf.OrdId + "ToUserTransfer" + retf.InCustId; if (Utils.GeTThirdCache(cachename) == 0) { Utils.SetThirdCache(cachename); B_usercenter BUC = new B_usercenter(); int ic = BUC.UpateActToUserTransfer(retf, 0); //用户余更新 if (ic > 0) { string sql = "SELECT registerid,username,mobile from hx_member_table where UsrCustId='" + retf.InCustId + "'"; DataTable dt = DbHelperSQL.GET_DataTable_List(sql); if (dt.Rows.Count > 0) { /*短信接口*/ #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(hua.Amt.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(hua.ActID.ToString()); mbaw.membertable_registerid = int.Parse(dt.Rows[0]["registerid"].ToString()); mbaw.income = decimal.Parse(retf.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() + ":您好!恭喜您成功" + hat.ActName + ",现金奖励 " + retf.TransAmt + "元。如有问题可咨询创利投的客服!"; pm.PubTime = dti; B_usercenter.AddMessage(pm); #endregion } } t = true; } #endregion } } } } } //} } } return(t); }
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)); }
/// <summary> /// 发放奖励 /// </summary> /// <param name="activity"></param> /// <param name="registerID"></param> private void DrawBonus(hx_ActivityTable activity, int registerID) { chuangtouEntities ef = new chuangtouEntities(); 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;//当前时间截点 //hx_ActivityTable act = ef.hx_ActivityTable.Where(c => c.ActID == activity.ActID).FirstOrDefault();//添加奖励类型 if (activity.ActEndtime >= dte && activity.ActStarttime <= dte) { Mcoupon mcp = new Mcoupon(); JavaScriptSerializer js = new JavaScriptSerializer(); mcp = js.Deserialize <Mcoupon>(activity.ActRule); hx_UserAct hua = new hx_UserAct(); hua.ActTypeId = activity.ActTypeId; hua.registerid = registerID; hua.RewTypeID = activity.RewTypeID; hua.ActID = activity.ActID; hua.Amt = mcp.cash; hua.Uselower = mcp.Msplitarr == null || mcp.Msplitarr.Count <= 0 ? 0 : mcp.Msplitarr[0].startAmt; hua.Usehight = mcp.Msplitarr == null || mcp.Msplitarr.Count <= 0 ? 0 : mcp.Msplitarr[0].endAmt; hua.AmtEndtime = activity.ActEndtime; hua.AmtUses = mcp.Uses; //没指定情况下默认为单独使用 hua.UseState = 0; //现金未转账 hua.AmtProid = 0; //未使用默认为0 hua.ISSmsOne = 0; hua.IsSmsThree = 0; hua.isSmsFifteen = 0; hua.IsSmsSeven = 0; hua.isSmsSixteen = 0; hua.Createtime = DateTime.Now; ef.hx_UserAct.Add(hua); int i = ef.SaveChanges(); mb.activity_schedule_id = activity.ActID; mb.membertable_registerid = registerID; mb.activity_schedule_name = activity.ActName; mb.amount_of_reward = decimal.Parse(hua.Amt.ToString()); mb.use_lower_limit = Convert.ToDecimal(hua.Uselower); mb.reward = 0; mb.start_date = Convert.ToDateTime(hua.Createtime); mb.end_date = Convert.ToDateTime(hua.AmtEndtime); mb.entry_time = dte; int bbid = bb.Add(mb); if (bbid > 0) //奖励记录成功后插入明细记录 { mbaw.bonus_account_id = bbid; mbaw.membertable_registerid = registerID; mbaw.income = decimal.Parse(hua.Amt.ToString()); mbaw.expenditure = 0.00M; mbaw.time_of_occurrence = DateTime.Now; mbaw.award_description = activity.ActName; mbaw.water_type = 0; bbaw.Add(mbaw); } } }
/// <summary> /// 提现自动审核 /// </summary> /// <param name="UsrCustId"></param> /// <param name="retUrl"></param> /// <param name="bgRetUrl"></param> public static void AutoCheckCash(string UsrCustId, string retUrl, string bgRetUrl) { chuangtouEntities ef = new chuangtouEntities(); var user = ef.hx_member_table.Where(c => c.UsrCustId == UsrCustId).FirstOrDefault(); if (user == null) { LogInfo.WriteLog("用户提现,自动审核异常:用户不存在!UsrCustID为:" + UsrCustId); return; } var userCash = ef.hx_td_UserCash.Where(c => c.registerid == user.registerid && (c.OrdIdState == 0 || c.OrdIdState == 1)).OrderByDescending(c => c.UserCashId).FirstOrDefault(); if (userCash == null) { LogInfo.WriteLog("用户提现,自动审核异常:用户提现记录不存在!registerid为:" + user.registerid); return; } var model = ef.V_UserCash_Bank.Where(p => p.UserCashId == userCash.UserCashId).SingleOrDefault(); if (model == null) { LogInfo.WriteLog("用户提现,自动审核异常:用户提现记录不存在!UserCashId为:" + userCash.UserCashId); return; } V_UserCash_Bank vub = new V_UserCash_Bank() { available_balance = model.available_balance, OrdIdState = 1,//model.OrdIdState,//审核通过 UsrCustId = model.UsrCustId, BankName = model.BankName, FeeAmt = model.FeeAmt, FeeObjFlag = model.FeeObjFlag, mobile = model.mobile, OpenAcctId = model.OpenAcctId, OpenBankId = model.OpenBankId, OperTime = model.OperTime, OrdId = model.OrdId, OrdIdTime = model.OrdIdTime, realname = model.realname, Reason = model.Reason, registerid = model.registerid, Remarks = model.Remarks, TransAmt = model.TransAmt, TransState = model.TransState, UserCashId = model.UserCashId, useridentity = model.useridentity, username = model.username, usertypes = model.usertypes }; StringBuilder strz = new StringBuilder(); int state = 0; M_CashAudit mc = new M_CashAudit(); //string retUrl = Utils.GetRe_url("admin/UserCash/RePostCashProcessing"); //string bgRetUrl = Utils.GetRe_url("admin/Thirdparty/BgCashProcessing"); bool postRes = postCashHelper(vub, ref state, ref mc, retUrl, bgRetUrl); if (!postRes && state == 0) { //return Content(StringAlert.Alert("取现强制未通过!", "/admin/UserCash/CashProcessing?UserCashId=" + model.UserCashId)); } else if (postRes) { string url = Utils.GetChinapnrUrl(); StringBuilder strBuilder = new StringBuilder(); strBuilder.AppendFormat("Version={0}", mc.Version); strBuilder.AppendFormat("&CmdId={0}", mc.CmdId); strBuilder.AppendFormat("&MerCustId={0}", mc.MerCustId); strBuilder.AppendFormat("&OrdId={0}", mc.OrdId); strBuilder.AppendFormat("&UsrCustId={0}", mc.UsrCustId); strBuilder.AppendFormat("&TransAmt={0}", mc.TransAmt); strBuilder.AppendFormat("&AuditFlag={0}", mc.AuditFlag); strBuilder.AppendFormat("&RetUrl={0}", mc.RetUrl); strBuilder.AppendFormat("&BgRetUrl={0}", mc.BgRetUrl); strBuilder.AppendFormat("&MerPriv={0}", mc.MerPriv); strBuilder.AppendFormat("&ChkValue={0}", mc.ChkValue); string html = Http.Post(url, strBuilder.ToString()); Dictionary <string, string> resdic = new Dictionary <string, string>(); string reg = "<input name=.*/>"; Regex regex = new Regex(reg); var macs = regex.Matches(html); foreach (Match mac in macs) { string[] input = mac.Value.Replace("'", "\"").Split('\"'); resdic.Add(input[1], input[7]); } ReCashAudit m = new ReCashAudit() { AuditFlag = resdic["AuditFlag"], BgRetUrl = resdic["BgRetUrl"], MerCustId = resdic["MerCustId"], ChkValue = resdic["ChkValue"], CmdId = resdic["CmdId"], FeeAcctId = resdic["FeeAcctId"], FeeAmt = resdic["FeeAmt"], FeeCustId = resdic["FeeCustId"], MerPriv = resdic["MerPriv"], OpenAcctId = resdic["OpenAcctId"], OpenBankId = resdic["OpenBankId"], OrdId = resdic["OrdId"], RespCode = resdic["RespCode"], RespDesc = resdic["RespDesc"], RetUrl = resdic["RetUrl"], TransAmt = resdic["TransAmt"], UsrCustId = resdic["UsrCustId"] }; LogInfo.WriteLog("自动审核审核数据回调:" + JsonConvert.SerializeObject(m)); RePostCashHelper(m); } }