public void PrepaymentSubmit() { Guid projectId = WEBRequest.GetFormGuid("ProjectId"); string payPwd = WEBRequest.GetFormString("TranPwd"); Guid userId = WebUserAuth.UserId.Value; if (userId == null || userId == Guid.Empty) { this.PrintJson("-3", "对不起,您还未登录!"); return; } if (GlobalUtils.IsOpenCGT) { TuanDai.CgtCallbackUrl.Model.ModelRequest.PreReturnMoney reqMode = new TuanDai.CgtCallbackUrl.Model.ModelRequest.PreReturnMoney(); reqMode.UserId = userId.ToString(); List <Guid> listProject = new List <Guid>(); listProject.Add(projectId); reqMode.ProjectIds = listProject; string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.Prepayment); PrintJson("8888", url); } else { ProjectBLL bll = new ProjectBLL(); string errorMsg = bll.PrepaymentSubmit(projectId, userId, payPwd); if (errorMsg != "") { this.PrintJson("-2", errorMsg); return; } //TuanDai.WXApiWeb.Common.SubscribeMsgHelper msghelper = new Common.SubscribeMsgHelper(); //推送提前还款信息到App //msghelper.AsyncSubscribeUserToMsg(projectId); //向所有投资者发送短信通知用户提前还款 //msghelper.SyncSendPhoneMsgToSubcribeUsers(projectId); SyncSendPhoneMsgToSubcribeUsers(projectId); SysLogHelper.WriteTraceLog("提前还款", "用户Id:" + userId.ToText() + " ProjectId:" + projectId.ToText()); this.PrintJson("1", ""); return; } }
//确认申请转让 public void SubmitTransaction() { Guid subscribeId = Guid.Empty; Guid.TryParse(Context.Request["sid"], out subscribeId); int transferShares = 0; int.TryParse(Context.Request["shares"], out transferShares); decimal transferPrice = 0; decimal.TryParse(Context.Request["price"], out transferPrice); Guid userId = WebUserAuth.UserId.Value; string payPwd = Context.Request["ppwd"]; payPwd = Tool.Encryption.MD5(payPwd); UserBasicInfoInfo userBasicEntity = new UserBLL().GetUserBasicInfoModelById(userId); if (userBasicEntity == null) { PrintJson("-31", "登录已过期或未登录"); return; } if (!GlobalUtils.IsOpenCGT && !string.IsNullOrEmpty(payPwd) && userBasicEntity.PayPwd != payPwd) { PrintJson("-32", "交易密码错误"); return; } if (string.IsNullOrEmpty(userBasicEntity.TelNo)) { PrintJson("-33", "手机号码未认证"); return; } string headImage = userBasicEntity.HeadImage; try { if (headImage.ToText().IsEmpty()) { //var whereParams = new Dapper.DynamicParameters(); Random rnd = new Random(); int rndNum = rnd.Next(1, 28); string rndminNum = rndNum.ToString(); if (rndNum < 10) { rndminNum = "0" + rndminNum; } headImage = GlobalUtils.TuanDaiURL + "/img/avatar/tdface/tdface" + rndminNum + ".jpg"; new TuanDai.PortalSystem.BLL.UserBLL().UpdateUserHeadImage(headImage, userId); //string strSQL = string.Format(@"update UserBasicInfo set HeadImage=@HeadImage where id=@userId"); //whereParams.Add("@HeadImage", headImageURL); //whereParams.Add("@userId", userId); ////using (SqlConnection conn = new SqlConnection(TuanDai.Config.BaseConfig.ConnectionString)) ////{ //// conn.Open(); //// conn.Execute(strSQL, whereParams); //// conn.Close(); //// conn.Dispose(); ////} //PublicConn.ExecuteTD(PublicConn.DBWriteType.UserWrite, strSQL, ref whereParams); } } catch (Exception ex) { SysLogHelper.WriteErrorLog("申请转让,更新头像异常", "用户:" + userId + "异常:" + ex.Message); } if (GlobalUtils.IsOpenCGT && GlobalUtils.IsOpenCgtTrans) { var reqMode = new TuanDai.CgtCallbackUrl.Model.ModelRequest.SanBiaoTransactionRequest { Channel = "MOBILE", UserId = userId.ToString(), subscribeId = subscribeId, transferPrice = transferPrice, transferShares = transferShares, headImageURL = headImage, Version = GlobalUtils.Version }; string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.ApplyZqzr); PrintJson("8888", url); } else { int outputStatus = 0; string msg = string.Empty; new TuanDai.PortalSystem.BLL.SubScriberansferBLL().ApplicationTransfer(subscribeId, string.Empty, transferShares, transferPrice, userId, out outputStatus, out msg); if (outputStatus == 0) { PrintJson("0", "申请转让失败"); } else { PrintJson(outputStatus.ToString(), msg); } } }
public void ApplyFTBTransfer() { Guid userid = WebUserAuth.UserId.Value; if (userid == Guid.Empty) { PrintJson("-99", "登陆超时"); } TuanDai.PortalSystem.BLL.UserBLL userbll = new TuanDai.PortalSystem.BLL.UserBLL(); TuanDai.PortalSystem.Model.UserBasicInfoInfo model = userbll.GetUserBasicInfoModelById(userid); if (model == null) { PrintJson("-98", "用户不存在"); } if ((model.uStatus ?? 0) != 1) { PrintJson("-10", "用户已被冻结"); } Guid weOrderId = WEBRequest.GetFormGuid("WeOrderId"); if (weOrderId == Guid.Empty) { PrintJson("-9", "We订单不存在"); } decimal applyAmount = WEBRequest.GetFormString("ApplyAmount").ToDecimal(0); if (applyAmount <= 0) { PrintJson("-1", "申请的退出本金必须大于0"); } if (applyAmount % 1 != 0) { PrintJson("-1", "请输入大于0的整数金额"); } if (GlobalUtils.IsOpenCGT) { var reqMode = new CgtCallbackUrl.Model.ModelRequest.ApplyFTBTransferRequest { WeOrderId = weOrderId, TransferAmount = applyAmount }; string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.FTBPreExit); PrintJson("8888", url); } else { //验证交易密码 var bll = new UserSettingBLL(); var usersetting = bll.GetUserSettingInfo(userid); if (usersetting != null) { #region if (usersetting.PayPwdErrorDate.HasValue) { DateTime date1 = Convert.ToDateTime(usersetting.PayPwdErrorDate.Value.ToString("yyyy/MM/dd")); DateTime date2 = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); if (date1 == date2 && usersetting.PayPwdErrorCount >= 5) { PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作"); } if (date1 != date2 && usersetting.PayPwdErrorCount > 1) { usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; } } string PayPwd = Tool.Encryption.MD5(Context.Request["TranPwd"]); if (PayPwd != model.PayPwd) { //记录登录错误次数 if (usersetting.PayPwdErrorCount == null) { usersetting.PayPwdErrorCount = 0; } usersetting.PayPwdErrorCount += 1; usersetting.PayPwdErrorDate = DateTime.Now; //db.SaveChanges(); bll.UpdateUserSettingInfo(usersetting); if (usersetting.PayPwdErrorCount == 5) { PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作"); } else { PrintJson("-15", "交易密码错误,您还剩下" + (5 - usersetting.PayPwdErrorCount).ToString() + "次机会"); } } else { //清除错误记录 usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; bll.UpdateUserSettingInfo(usersetting); } #endregion } int status = 0; string strError = ""; TuanDai.PortalSystem.BLL.WeFTBBLL webll = new TuanDai.PortalSystem.BLL.WeFTBBLL(); webll.ApplyFTBRansom(weOrderId, applyAmount, out status, out strError); PrintJson(status.ToString(), strError); } }
/// <summary> /// We计划分期宝申请赎回 /// </summary> public void ApplyWeFqbTransfer() { Guid userid = WebUserAuth.UserId.Value; if (userid == Guid.Empty) { PrintJson("-99", "登陆超时"); } TuanDai.PortalSystem.BLL.UserBLL userbll = new TuanDai.PortalSystem.BLL.UserBLL(); TuanDai.PortalSystem.Model.UserBasicInfoInfo model = userbll.GetUserBasicInfoModelById(userid); if (model == null) { PrintJson("-98", "用户不存在"); } if ((model.uStatus ?? 0) != 1) { PrintJson("-10", "用户已被冻结"); } Guid weOrderId = WEBRequest.GetFormGuid("WeOrderId"); if (weOrderId == Guid.Empty) { PrintJson("-9", "We订单不存在"); } if (GlobalUtils.IsOpenCGT) { var reqMode = new CgtCallbackUrl.Model.ModelRequest.ApplyWeFQBTransferRequest { WeOrderId = weOrderId }; string url = CgtCallBackConfig.GetCgtTradePwdUrl(reqMode, CgtCallBackConfig.CgtCallBackType.WeFqbPreExit); PrintJson("8888", url); } else { //验证交易密码 var bll = new UserSettingBLL(); var usersetting = bll.GetUserSettingInfo(userid); if (usersetting != null) { if (usersetting.PayPwdErrorDate.HasValue) { DateTime date1 = Convert.ToDateTime(usersetting.PayPwdErrorDate.Value.ToString("yyyy/MM/dd")); DateTime date2 = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); if (date1 == date2 && usersetting.PayPwdErrorCount >= 5) { PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作"); } if (date1 != date2 && usersetting.PayPwdErrorCount > 1) { usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; } } string PayPwd = Tool.Encryption.MD5(Context.Request["TranPwd"]); if (PayPwd != model.PayPwd) { //记录登录错误次数 if (usersetting.PayPwdErrorCount == null) { usersetting.PayPwdErrorCount = 0; } usersetting.PayPwdErrorCount += 1; usersetting.PayPwdErrorDate = DateTime.Now; //db.SaveChanges(); bll.UpdateUserSettingInfo(usersetting); if (usersetting.PayPwdErrorCount == 5) { PrintJson("-151", "交易密码已错误5次,请24小时后再进行此操作"); } else { PrintJson("-15", "交易密码错误,您还剩下" + (5 - usersetting.PayPwdErrorCount).ToString() + "次机会"); } } else { //清除错误记录 usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; //db.SaveChanges(); bll.UpdateUserSettingInfo(usersetting); } } int status = 0; TuanDai.PortalSystem.BLL.WeOrderBLL webll = new TuanDai.PortalSystem.BLL.WeOrderBLL(); webll.ApplyWeFqbRansom(weOrderId, out status); if (status == 1) { PrintJson("1", "申请转让成功"); } else { string errMsg = ""; switch (status) { case 0: errMsg = "系统异常"; break; case 2: errMsg = "不是We计划分期宝"; break; case 3: errMsg = "回款中状态不允许赎回"; break; case 4: errMsg = "持有时间必须超过3个月"; break; case 5: errMsg = "只有投标中的We计划才能转让"; break; } PrintJson("0", errMsg); } } }