// 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="id">Drawid</param> /// <param name="type">发放类型 1发放 2驳回</param> /// <returns></returns> public JsonHelp Issue(int id, int type, string userId, string userName, string summary) { JsonHelp json = new JsonHelp() { Status = "n", Msg = "操作失败" }; using (var tran = DB.Fin_Draw.BeginTransaction) { try { var Draw = FindEntity(p => p.DrawId == id); if (Draw.DrawState == "已发放" || Draw.DrawState == "已驳回") { json.Msg = "提现已审核,不能重复审核"; return(json); } Member_Info member = DB.Member_Info.FindEntity(Draw.MemberId); if (type == 1) { Draw.DrawState = "已发放"; Draw.ConfirmTime = DateTime.Now; Draw.ConfirmEmpId = userId; Draw.ConfirmEmpName = userName; if (Update(Draw)) { json.Status = "y"; json.Msg = "发放成功"; DB.SysLogs.setAdminLog(Enums.EventType.Edit, string.Format("提现发放成功,提现人:[{0}],提现金额:[{1}]", Draw.MemberCode, Draw.DrawAmount)); tran.Complete(); //发送模板通知 if (member != null && string.IsNullOrEmpty(member.OpenID) == false) { MsgMessage _msg = new MsgMessage(); _msg.Send_DrawSuccess(Draw, member.OpenID, $"http://{HttpContext.Current.Request.Url.Host}/Member_Finance/Draw/Index"); } } } else if (type == 2) { member.Coins = member.Coins + Draw.DrawAmount; DB.Fin_LiuShui.AddLS(member.MemberId, Draw.DrawAmount.Value, "提现驳回", "奖金"); if (DB.Member_Info.Update(member)) { Draw.DrawState = "已驳回"; Draw.ConfirmTime = DateTime.Now; Draw.ConfirmEmpId = userId; Draw.ConfirmEmpName = userName; Draw.Summary = summary; Update(Draw); json.Status = "y"; json.Msg = "驳回成功"; DB.SysLogs.setAdminLog(Enums.EventType.Edit, string.Format("提现已驳回,提现人:[{0}],提现金额:[{1}]", Draw.MemberCode, Draw.DrawAmount)); tran.Complete(); //发送模板通知 if (member != null && string.IsNullOrEmpty(member.OpenID) == false) { MsgMessage _msg = new MsgMessage(); _msg.Send_DrawError(Draw, member.OpenID, $"http://{HttpContext.Current.Request.Url.Host}/Member_Finance/Draw/Index"); } } } } catch (Exception e) { DB.Rollback(); LogHelper.Error("发放资金出错:" + e.Message); } } return(json); }