/// <summary> /// 已参与用户 /// </summary> /// <returns></returns> public List <M_GrabIphone> getCYLIst() { B_GrabIphone gi = new B_GrabIphone(); List <M_GrabIphone> giList = gi.GetModelList(30, "", "ID desc"); return(giList); }
/// <summary> /// 已中奖用户 /// </summary> /// <returns></returns> public List <M_GrabIphone> getZJLIst() { B_GrabIphone gi = new B_GrabIphone(); List <M_GrabIphone> giList = gi.GetModelList(20, "WinningState=1", "ID desc"); return(giList); }
/// <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)); }