public ActionResult Save(Fin_Draw DataBase) { JsonHelp json = new JsonHelp() { }; var Pwd2 = Common.CryptHelper.DESCrypt.Encrypt(Request["Pwd2"]); int weeknow = Convert.ToInt32(DateTime.Today.DayOfWeek); string tixian = DB.XmlConfig.XmlSite.DrawName; if (tixian.IndexOf(weeknow.ToString()) == -1) { json.Msg = "暂未到提现时间";; json.IsSuccess = false; } else { DataBase.DrawState = "未发放"; DataBase.CreateTime = DateTime.Now; var member = DB.Member_Info.FindEntity(CurrentUser.Id); DataBase.BankAccount = string.IsNullOrEmpty(member.BankAccount) ? member.BankCode : member.BankAccount; DataBase.BankAddress = member.BankAddress; DataBase.BankCode = member.BankCode; DataBase.BankName = member.BankName; DataBase.OpenBank = member.OpenBank; DB.Fin_Draw.Save(Pwd2, DataBase); if (json.IsSuccess) { json.ReUrl = ControllerPath + "/Index"; } } return(Json(json)); }
public ActionResult ToDraw(decimal DrawAmount = 0, string PayPwd = "") { try { PayPwd = Common.CryptHelper.DESCrypt.Encrypt(PayPwd); var model = DB.Member_Info.FindEntity(CurrentUser.MemberId); var entity = new Fin_Draw(); entity.DrawState = "未发放"; entity.CreateTime = DateTime.Now; entity.BankName = model.BankName; entity.BankAccount = model.BankAccount; entity.BankCode = model.BankCode; entity.OpenBank = model.OpenBank; entity.DrawAmount = DrawAmount; entity.ServiceCenterCode = ""; entity.CreateTime = DateTime.Now; entity.MemberId = model.MemberId; entity.MemberCode = model.Code; entity.NickName = model.NickName; entity.Comment = ""; DB.Fin_Draw.Save(PayPwd, entity); return(Success("操作成功")); } catch (Exception ex) { return(Error(ex)); } }
/// <summary> /// 提现成功消息 /// </summary> /// <param name="model"></param> /// <param name="openid"></param> public void Send_DrawSuccess(Fin_Draw model, string openid, string openUrl) { string json = new { touser = openid, template_id = "pkVbcnEmaGqMeowKl2y9SY8poWQjmF6xD2oUmw86igw", url = openUrl, topcolor = "#FF0000", data = new { first = new { color = "#173177", value = "您好,您有一条提现成功到账通知" }, keyword1 = new { color = "#0000ff", value = model.DrawAmount.Value.ToString("0.##") }, keyword2 = new { color = "#173177", value = model.CreateTime.Value.ToString("yyyy-MM-dd HH:ss") }, keyword3 = new { color = "#0000ff", value = model.Amount.Value.ToString("0.##") }, keyword4 = new { color = "#173177", value = model.BankCode }, remark = new { color = "#173177", value = "请及时核对银行账单" } } }.ToJsonString(); string result = NetHelper.Post(GetUrl(), json); JObject obj = JObject.Parse(result); if ((int)obj["errcode"] != 0) { throw new Exception("发送提现消息失败:" + result); } }
// GET: Test public ActionResult Index() { //模板消息--提现成功 try { MsgMessage _msg = new MsgMessage(); Fin_Draw model = DB.Fin_Draw.Where(q => q.DrawId == 1).FirstOrDefault(); _msg.Send_DrawSuccess(model, "oUEId1rfKD_Kbhpwqgn7mm24owSM", $"http://{Request.Url.Host}/Member_Finance/Draw/Index"); return(Content("发送成功")); } catch (Exception ex) { return(View(ex.Message)); } }
/// <summary> /// 提现失败消息 /// </summary> /// <param name="model"></param> /// <param name="openid"></param> public void Send_DrawError(Fin_Draw model, string openid, string openUrl) { string json = new { touser = openid, template_id = "Lz04xXz3Lp5j7_U86mZo1ETRs9tF-Y_HhR7izDBIKso", url = openUrl, topcolor = "#D7D8DA", data = new { first = new { color = "#173177", value = "您好,您有一条提现失败通知" }, keyword1 = new { color = "#173177", value = model.DrawAmount.Value.ToString("0.##") }, keyword2 = new { color = "#173177", value = model.CreateTime.Value.ToString("yyyy-MM-dd HH:ss") }, keyword3 = new { color = "#173177", value = model.Summary }, remark = new { color = "#173177", value = "如有疑问请联系管理员" } } }.ToJsonString(); string result = NetHelper.Post(GetUrl(), json); JObject obj = JObject.Parse(result); if ((int)obj["errcode"] != 0) { throw new Exception("发送提现消息失败:" + result); } }
public ActionResult Detail(string id, string commentForm) { var m = DB.Member_Info.FindEntity(CurrentUser.Id); var model = new Fin_Draw() { MemberCode = m.Code, MemberId = m.MemberId, NickName = m.NickName, ServiceCenterCode = m.ServiceCenterCode, ServiceCenterId = m.ServiceCenterId, BankAccount = m.BankAccount, BankCode = m.BankCode, BankAddress = m.BankAddress, BankName = m.BankName, OpenBank = m.OpenBank }; ViewBag.Commission = m.Commission; if (!string.IsNullOrEmpty(id)) { model = DB.Fin_Draw.FindEntity(Convert.ToInt32(id)); } return(View(model)); }
public bool Save(string Pwd2, Fin_Draw entity) { JsonHelp json = new JsonHelp() { Status = "n", Msg = "保存失败" }; using (var tran = DB.Fin_Draw.BeginTransaction) { try { int weeknow = Convert.ToInt32(DateTime.Today.DayOfWeek); string tixian = DB.XmlConfig.XmlSite.DrawName; if (tixian.IndexOf(weeknow.ToString()) == -1) { //json.Msg = "每周" + DB.XmlConfig.XmlSite.DrawName + "提现"; ; throw new Exception("暂未到提现时间"); } #region 检查支付密码是否正确,提款金额是否超限, 检验提现金额,最小提现金额与提现倍数等 var model = DB.Member_Info.FindEntity(entity.MemberId); if (string.IsNullOrEmpty(model.BankCode) || string.IsNullOrEmpty(model.BankAccount) || string.IsNullOrEmpty(model.BankName)) { throw new Exception("请完善银行信息"); } if (model.IsLockDraw == true) { throw new Exception("此会员已锁定提现功能!"); } if (model != null && model.Pwd2 == Pwd2) { if (entity.DrawAmount <= 0) { throw new Exception("提现金额要大于0!"); } if (entity.DrawAmount > model.Coins) { throw new Exception("提现金额不能大于奖金!"); } var min = DB.XmlConfig.XmlSite.MinAmount; //提现最小金额 var Multiple = DB.XmlConfig.XmlSite.Multiple; //提现金额是这个的整数倍 if (entity.DrawAmount < min) { throw new Exception("最小提现金额" + min + "!"); } if (entity.DrawAmount % Multiple != 0) { throw new Exception("提现倍数为" + Multiple + "!"); } //计算税金 var DrawPoundage = DB.XmlConfig.XmlSite.DrawPoundage; entity.Poundage = entity.DrawAmount * DrawPoundage / 100M; entity.Amount = entity.DrawAmount - entity.Poundage; if (entity.DrawId == 0) { if (Insert(entity)) { //更新会员表的收益, model.Coins -= entity.DrawAmount; DB.Fin_LiuShui.AddLS(model.MemberId, -entity.DrawAmount.Value, "提现申请", "奖金"); DB.Member_Info.Update(model); //添加操作日志 DB.SysLogs.setMemberLog(Enums.EventType.Add, string.Format("提现申请已提交,操作人:[{0}],金额:[{1}],操作成功", entity.NickName, entity.Amount)); } } else { if (Update(entity)) { json.Status = "y"; json.Msg = "操作成功"; json.ReUrl = "/Member_Finance/Draw/Index"; //添加操作日志 DB.SysLogs.setMemberLog(Enums.EventType.Edit, string.Format("修改提现申请已提交,操作人:[{0}],金额:[{1}],操作成功", entity.NickName, entity.Amount)); } } } else { throw new Exception("支付密码错误!"); } tran.Complete(); return(true); #endregion } catch (Exception ex) { DB.Rollback(); throw ex; } } }