/// <summary> /// 重置密码(done) /// </summary> public Response Execute(string request) { var req = JsonConvert.DeserializeObject <Request <User> >(request); var user = req.Entities.FirstOrDefault(); if (user.ValCode.IsNullOrEmpty() || user.Password.IsNullOrEmpty()) { return(ResultHelper.Fail("请输入新密码和验证码。")); } var valCode = SystemHelper.GetValCode(user.Mobile); if (valCode == null || user.ValCode != valCode.Code) { return(ResultHelper.Fail("验证码错误。")); } var dbuser = UserHelper.GetUserByMobile(user.Mobile); if (dbuser == null) { return(ResultHelper.Fail("你的手机号没有注册,请先注册")); } var cmd = CommandHelper.CreateText(FetchType.Execute, "UPDATE UserAccount SET Password=@password WHERE Mobile=@Mobile "); cmd.Params.Add("@Mobile", user.Mobile); cmd.Params.Add("@password", user.Password); return(DbContext.GetInstance().Execute(cmd)); }
public Response SaveCoursePersonInfoList(CoachCourse obj) { Response rsp = new Response(); List <EntityBase> entites = new List <EntityBase>(); foreach (CoachCoursePersonInfo item in obj.CoursePersonInfoList) { item.CourseId = obj.Id; item.IsSignIn = false; //检测此学员是否有悦动力账户 if (!string.IsNullOrEmpty(item.StudentMobile)) { var ydlUser = UserHelper.GetUserByMobile(item.StudentMobile);//通过手机号反查悦动力账户 if (ydlUser != null) { item.YdlUserId = ydlUser.Id;//此学员在悦动力有账户, 保存其id , 方便后续关联 } } item.RowState = RowState.Added; item.TrySetNewEntity(); entites.Add(item); } if (entites.Count > 0) { rsp = DbContext.GetInstance().Execute(CommandHelper.CreateSave(entites)); } return(rsp); }
public Response Execute(string request) { var req = JsonConvert.DeserializeObject <Request <User> >(request); var user = req.Entities.FirstOrDefault(); user.WeiXinUnionId = ""; if (user.Mobile.IsNullOrEmpty()) { return(ResultHelper.Fail("请输入手机。")); } //先检查手机号是否已注册 User userdb = UserHelper.GetUserByMobile(user.Mobile); if (userdb != null) { return(ResultHelper.Fail("手机号已注册, 不能再注册")); } //最后注册 return(RegisterUser(user)); }