private void SendSMS(string SendText, string Mobile, SysSet SS) { SMSLog SMSLog = new SMSLog(); SMSLog.SendText = SendText; SMSLog.Mobile = Mobile; SysAgent SA = BasicAgent.GetTopAgent(Entity); SMSLog.SendSMS(SS, SA, Entity); }
public JsonResult GetCode(string Tel, byte CType) { if (Tel.IsNullOrEmpty()) { return(Json(new { code = 1, msg = "手机号不能为空" })); } if (CType != 5) { return(Json(new { code = 1, msg = " 非法操作" })); } //验证是否重复 SysAdmin Old = Entity.SysAdmin.FirstOrDefault(n => n.UserName == Tel); if (Old != null) { return(Json(new { code = 1, msg = "“联系手机号”已在系统中存在,无法开通管理员!" })); } if (Entity.UserBlackList.FirstOrDefault(UBL => UBL.CardNumber == Tel && UBL.State == 1) != null) { return(Json(new { code = 1, msg = "暂不支持您的手机号入网!" })); } SysSet ss = new SysSet(); ss.SMSEnd = BasicSet.SMSEnd; ss.SMSActives = BasicSet.SMSActives; DateTime Today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); //失效之前获取验证码 IList <SMSCode> List = Entity.SMSCode.Where(n => n.UId == BasicAgent.Id && n.Mobile == Tel && n.CType == CType && n.State == 1).ToList(); foreach (var p in List) { p.State = 0; } Entity.SaveChanges(); //生成验证码 string Code = Utils.RandomSMSCode(6); SMSCode SSC = new SMSCode(); SSC.CType = CType; SSC.UId = BasicAgent.Id; SSC.Mobile = Tel; SSC.Code = Code; SSC.AddTime = DateTime.Now; SSC.State = 1; Entity.SMSCode.AddObject(SSC); Entity.SaveChanges(); var topAgent = BasicAgent.GetTopAgent(this.Entity); //发送验证码 SSC.SendSMS(ss, topAgent, Entity); return(Json(new { code = 2, msg = "ok" })); }
public void AddNew(ApplyCredit ApplyCredit, int BankId, string IDcard) { IList <SMSCode> List = Entity.SMSCode.Where(n => n.UId == BasicUsers.Id && n.Mobile == ApplyCredit.Mobile && n.CType == 1 && n.State == 1).ToList(); foreach (var p in List) { p.State = 0; } Entity.SaveChanges(); IList <SysAgent> parentAgents = BasicAgent.GetAgentsById(Entity); string Agents = "|"; foreach (var item in parentAgents) { Agents += item.Id + "|"; } ApplyCreditCard AC = new ApplyCreditCard() { AgentId = BasicAgent.Id, BankId = BankId, Uid = BasicUsers.Id, FirstAgentAmount = 0, FirstAgentAmountState = 0, UserName = ApplyCredit.TrueName, UserMobile = ApplyCredit.Mobile, UserIdCard = IDcard, FirstAgentId = BasicAgent.GetTopAgent(Entity).Id, Relation = Agents, OrderNum = DateTime.Now.ToString("yyyyMMddHHmmssfff"), SettlementAmount = 0, SettlementState = 0, AddTime = DateTime.Now, State = 1 }; //已审核之前的状态不添加第二条数据 包括已审核的状态 if (Entity.ApplyCreditCard.FirstOrDefault(ACC => ACC.BankId == BankId && ACC.UserIdCard == IDcard && ACC.State < 3) == null) { Entity.ApplyCreditCard.AddObject(AC); Entity.SaveChanges(); } //ApplyCredit AC = new ApplyCredit(); //AC = Request.ConvertRequestToModel<ApplyCredit>(AC, ApplyCredit); //AC.BankId = BankId; //AC.UId = BasicUsers.Id; //AC.AId = 0; //AC.State = 1; //AC.AddTime = DateTime.Now; //AC.AgentId = BasicAgent.Id; //AC.AgentAId = AdminUser.Id; //AC.PayState = 0; //AC.AgentPay = 0; ////这里是利润计算========== //AC.Amoney = 0;//获取价格 //AC.AIdMoney = AC.Amoney;//总利润 //AC.AgentMoney = 0;//分支机构佣金设置为0,待分润计算后再写入 //AC.Company = ""; //AC.CompanyNature = ""; //AC.SheBao = ""; //AC.HasSheBao = 0; //AC.Marry = 0; //AC.HasCar = 0; //AC.HasCredit = 0; //Entity.ApplyCredit.AddObject(AC); //Entity.SaveChanges(); Response.Write("<script>location.href=\"" + Entity.BasicBank.FirstOrNew(b => b.Id == BankId).CreditCardUrl + "\";</script>"); }