public ActionResult ChangeMobile(SmsInputModel smsModel) { StudentInfoBll studentInfoBll = new StudentInfoBll(); var isExsit = studentInfoBll.IsExistPhone(smsModel.Phone); if (isExsit) { return(Json(new JsonSimpleResponse() { State = false, ErrorMsg = "该手机号已存在" })); } if (SmsCookie.GetSmsCode == null || !SmsCookie.GetSmsCode.Check(smsModel.Phone, smsModel.SmsCode)) { return(new JsonResult() { Data = AjaxResponse.Fail(SmsErrorEnum.PhoneCodeFault) }); } studentInfoBll.UpdateMobile(GetCurrentUser().StudentId, smsModel.Phone); return(Json(new JsonSimpleResponse() { State = true, ErrorMsg = "操作成功" })); }
public ActionResult AddStudentInfo(StudentInfoInputModel inputModel) { try { StudentInfoBll studentInfoBll = new StudentInfoBll(); Bas_Student student = new Bas_Student(); student.Bst_Id = GetCurrentUser().StudentId; student.Bst_NickName = inputModel.NickName; student.Bst_Name = inputModel.Name; student.Bst_Sex = inputModel.Sex; student.Bst_Birthday = inputModel.Birthday.CompareTo(Convert.ToDateTime("0001-01-01")) == 0?Convert.ToDateTime("1900-01-01"): inputModel.Birthday; student.Bst_Grade = inputModel.Grade; student.Bst_StudySchool = inputModel.StudySchool; student.Bst_Province = inputModel.Bst_Province; student.Bst_City = inputModel.Bst_City; student.Bst_County = inputModel.Bst_County; student.Bst_Address = inputModel.Address; if (!string.IsNullOrEmpty(inputModel.HeadPhoto)) { student.Bst_Avatar = Upload(inputModel.HeadPhoto).FileUrl; } studentInfoBll.Update(student); return(RedirectToAction("StudentInfo")); } catch (Exception ex) { throw ex; } }
public ActionResult Index() { StudentInfoBll studentBll = new StudentInfoBll(); var studentInfo = studentBll.GetStudentInfo(GetCurrentUser().StudentId); var viewModel = studentInfo.ConvertTo <StudentInfoViewModel>(); return(View(viewModel)); }
/// <summary> /// 订单详情页 /// </summary> /// <param name="id">订单Id</param> /// <returns></returns> public ActionResult OrderDetail(int id = 0) { if (id == 0) { //跳转到订单列表页 return(RedirectToAction("OwnOrderList")); } int studentId = GetCurrentUser().StudentId; StudentOrderBll studentOrderBll = new StudentOrderBll(); DtoSelectCenterOrderResult courseOrderResult = studentOrderBll.GetOrderInfoForDetail(studentId, id); OrderDetailViewModel model = courseOrderResult.ConvertTo <OrderDetailViewModel>(); decimal?baseVoucherAmount = model.OrderVoucherPayList?.FirstOrDefault(v => v.PayType != (int)StudentOrderPaymnentTypeEnum.优惠券_校区券_支付)?.Amount; model.BaseVoucherAmount = baseVoucherAmount.HasValue ? baseVoucherAmount.Value : 0; decimal?schoolVoucherAmount = model.OrderVoucherPayList?.FirstOrDefault(v => v.PayType == (int)StudentOrderPaymnentTypeEnum.优惠券_校区券_支付)?.Amount; model.SchoolVoucherAmount = schoolVoucherAmount.HasValue ? schoolVoucherAmount.Value : 0; //防止用户未点击支付按钮,订单表没计算应付金额 if (model.PayAmount == 0) { model.PayAmount = model.OrderAmount - model.BaseVoucherAmount - model.SchoolVoucherAmount; model.PayAmount = model.PayAmount > 0 ? model.PayAmount : 0; } if (model.OrderStatus == (int)StudentOrderStatus.待支付 || model.OrderStatus == (int)StudentOrderStatus.支付中 || model.OrderStatus == (int)StudentOrderStatus.已支付) { model.IsHaveThisCourse = true; } else { //查询用户是否已购买此课程 var oriOrder = studentOrderBll.GetFinishOrder(studentId, model.CourseId); if (oriOrder != null && oriOrder.Yod_Id > 0) { model.IsHaveThisCourse = true; } else { model.IsHaveThisCourse = false; } } StudentInfoBll studentInfoBll = new StudentInfoBll(); DtoStudentInfo student = studentInfoBll.GetStudentInfo(studentId); Regex regex = new Regex(@"(\d{3})\d{4}(\d{4})"); model.StudentAccount = regex.Replace(student.Bst_Phone, "$1****$2"); model.SchoolName = student.SchoolName; if (string.IsNullOrEmpty(model.CourseImage)) { model.CourseImage = defaultCourseImg; } return(View(model)); }
public ActionResult IsBindFaceLogin() { StudentInfoBll studentInfoBll = new StudentInfoBll(); var isBind = studentInfoBll.IsBindFaceLogin(GetCurrentUser().StudentId); return(Json(new JsonSimpleResponse() { State = isBind })); }
public ActionResult FindPassword(string password) { StudentInfoBll studentInfoBll = new StudentInfoBll(); studentInfoBll.FindPassword(GetCurrentUser().StudentId, password); return(Json(new JsonSimpleResponse() { State = true, ErrorMsg = "操作成功" })); }
public ActionResult GetStudentLogin(int pageIndex, int pageSize) { StudentInfoBll studentInfoBll = new StudentInfoBll(); PagingObject paging = new PagingObject(pageIndex, pageSize); var studentLogins = studentInfoBll.GetStudentLogin(paging, GetCurrentUser().StudentId); var viewModels = studentLogins.ConvertTo <List <StudentLoginViewModel> >(Code.Json.PropertyNamePrefixAction.Remove); var table = AbhsTableFactory.Create <StudentLoginViewModel>(viewModels, paging.TotalCount); return(Json(table, JsonRequestBehavior.AllowGet)); }
public ActionResult CheckLogin(LoginInputModel inputModel) { if (string.IsNullOrEmpty(inputModel.PassportKey.Trim()) || string.IsNullOrEmpty(inputModel.Password.Trim())) { return(new JsonResult() { Data = AjaxResponse.Fail(SmsErrorEnum.InputNotNull) }); } if (!string.IsNullOrEmpty(inputModel.SmsCode)) { if (WebHelper.GetCookie("abhs_verifycode") != Encrypt.MD5(inputModel.SmsCode.ToLower())) { return(new JsonResult() { Data = AjaxResponse.Fail(SmsErrorEnum.AuthCodeError) }); } } //LogonUserAccessCheckPolicy checkPolicy = new LogonUserAccessCheckPolicy( // AccessCheckKeyEnum.Chinese_StudentLoginCode_Check, // inputModel.PassportKey, // 60, // 3); //var status = checkPolicy.CheckAdvanced(); int code = 0; //if (status >= AccessCheckEnum.PreLimited) //{ // code = (int)AccessCheckEnum.Limited; //} StudentInfoBll studentInfoBll = new StudentInfoBll(); inputModel.Password = Encrypt.GetMD5Pwd(inputModel.Password); var student = studentInfoBll.Login(inputModel.PassportKey, inputModel.Password); if (student != null) { var sumStudent = studentInfoBll.GetSumStudentTip(student.Bsp_StudentId); LoginInfo info = sumStudent.ConvertTo <LoginInfo>(); LoginStudent.Info = JsonConvert.SerializeObject(info); return(Json(new JsonSimpleResponse() { State = true, ErrorCode = 1, ErrorMsg = "登录成功" })); } return(Json(new JsonResponse <int>() { State = false, ErrorCode = code, Data = -1, ErrorMsg = "账号或密码错误" })); }
public ActionResult UpdatePassword(string oldPassword, string newPassword) { StudentInfoBll studentInfoBll = new StudentInfoBll(); var result = studentInfoBll.UpdatePassword(GetCurrentUser().StudentId, oldPassword, newPassword); if (result == -1) { return(Json(new JsonSimpleResponse() { State = true, ErrorMsg = "操作失败", ErrorCode = -1 })); } return(Json(new JsonSimpleResponse() { State = true, ErrorMsg = "操作成功", ErrorCode = result })); }
public ActionResult BindFace(FaceRegisterRequest request) { FaceRecognitionResponse response = BaiduApiBll.FaceRegister(request.ImgPath, request.ImgType, GetCurrentUser().StudentId.ToString(), request.UserInfo); if (response.error_code == 0) { StudentInfoBll studentInfoBll = new StudentInfoBll(); studentInfoBll.AddStudentPassport(GetCurrentUser().StudentId, StudentAccountSourceEnum.人脸识别, response.result.face_token, ""); return(Json(new JsonResponse <FaceRecognitionResponse>() { Data = response, ErrorCode = 1, ErrorMsg = "绑定成功" })); } return(Json(new JsonResponse <FaceRecognitionResponse>() { Data = response, ErrorCode = 0, ErrorMsg = "绑定失败" })); }
public ActionResult UpdatePwd(RegisterInputModel inputModel) { if (SmsCookie.GetSmsCode == null || !SmsCookie.GetSmsCode.Check(inputModel.Phone, inputModel.SmsCode)) { return(new JsonResult() { Data = AjaxResponse.Fail(SmsErrorEnum.PhoneCodeFault) }); } StudentInfoBll studentInfoBll = new StudentInfoBll(); studentInfoBll.UpdatePasswordByPhone(inputModel.Phone, inputModel.Password); return(Json(new JsonSimpleResponse() { State = true, ErrorMsg = "操作成功", ErrorCode = 1 })); }
public ActionResult UpdateFace(FaceRegisterRequest request) { StudentInfoBll studentInfoBll = new StudentInfoBll(); var response = BaiduApiBll.FaceUpdate(request.ImgPath, request.ImgType, GetCurrentUser().StudentId.ToString(), request.UserInfo); if (response.error_code == 0) { var result = studentInfoBll.UpdatePassportKey(GetCurrentUser().StudentId, response.result.face_token); return(Json(new JsonResponse <FaceRecognitionResponse>() { Data = response, ErrorCode = 1, ErrorMsg = "操作成功" })); } return(Json(new JsonResponse <FaceRecognitionResponse>() { Data = response, ErrorCode = 0, ErrorMsg = "操作失败" })); }
public ActionResult DeleteFace(SmsInputModel smsModel) { if (SmsCookie.GetSmsCode == null || !SmsCookie.GetSmsCode.Check(smsModel.Phone, smsModel.SmsCode)) { return(new JsonResult() { Data = AjaxResponse.Fail(SmsErrorEnum.PhoneCodeFault) }); } StudentInfoBll studentInfoBll = new StudentInfoBll(); studentInfoBll.UpdateStatus(GetCurrentUser().StudentId, StudentAccountStatusEnum.禁用); return(Json(new JsonSimpleResponse() { State = true, ErrorMsg = "操作成功" })); }
public ActionResult GetOwnCashVoucher(StuOwnVoucherSearch search) { StudentInfoBll studentInfoBll = new StudentInfoBll(); var device = ""; device = clsCommon.CheckAgent(); PagingObject paging = new PagingObject(); paging.PageIndex = search.PageIndex; if (device.Contains("iPad")) { paging.PageSize = 6; } else { paging.PageSize = 9; } var studentCashVoucher = studentInfoBll.GetOwnCashVoucher(paging, GetCurrentUser().StudentId, search.Status); List <StudentCashVoucherViewModel> viewModels = studentCashVoucher.ConvertTo <List <StudentCashVoucherViewModel> >(); return(Json(new { Data = viewModels, PageSize = paging.PageSize, TotalRecord = paging.TotalCount }, JsonRequestBehavior.AllowGet)); }
public ActionResult StudentLogin(string sign, string t, int courseId) { TimeSpan span = new TimeSpan(Convert.ToInt64(t)) - new TimeSpan(DateTime.Now.Ticks); if (span.TotalSeconds > 60) { throw new Exception(); } string rightsign = Encrypt.MD5Hash(t, "8j0pf"); if (rightsign != sign) { throw new Exception(); } StudentInfoBll studentInfoBll = new StudentInfoBll(); var student = studentInfoBll.GetBySchoolId(); var sumStudent = studentInfoBll.GetSumStudentTip(student.Bst_Id); LoginInfo info = sumStudent.ConvertTo <LoginInfo>(); LoginStudent.Info = JsonConvert.SerializeObject(info); return(new RedirectResult($"/Course/PreviewCourse/{courseId}")); }
public ActionResult FaceLogin(FaceRegisterRequest request) { FaceRecognitionResponse response = BaiduApiBll.FaceLogin(request.ImgPath, request.ImgType); //状态码不为0或者识别得分小于80,验证失败 if (response.error_code > 0 || response.result.user_list.FirstOrDefault().score < 80) { var errorCode = -1; //状态码为18,QPS超限额 if (response.error_code == 18) { errorCode = -2; } return(Json(new JsonResponse <FaceRecognitionResponse>() { State = false, ErrorCode = errorCode, Data = response, ErrorMsg = "登录失败,请稍后再试" })); } StudentInfoBll studentInfoBll = new StudentInfoBll(); var studentPassport = studentInfoBll.GetStudentPassport(response.result.user_list.FirstOrDefault().user_id._ToInt32(), StudentAccountSourceEnum.人脸识别); if (studentPassport != null) { var sumStudent = studentInfoBll.GetSumStudentTip(studentPassport.Bsp_StudentId); LoginInfo info = sumStudent.ConvertTo <LoginInfo>(); LoginStudent.Info = JsonConvert.SerializeObject(info); return(Json(new JsonSimpleResponse() { State = true, ErrorCode = 1, ErrorMsg = "登录成功" })); } return(Json(new JsonSimpleResponse() { State = false, ErrorCode = -1, ErrorMsg = "登录失败" })); }
public ActionResult MobileCodeLogin(LoginInputModel inputModel) { if (string.IsNullOrEmpty(inputModel.Phone.Trim()) || string.IsNullOrEmpty(inputModel.SmsCode.Trim())) { return(new JsonResult() { Data = AjaxResponse.Fail(SmsErrorEnum.InputNotNull) }); } if (SmsCookie.GetSmsCode == null || !SmsCookie.GetSmsCode.Check(inputModel.Phone, inputModel.SmsCode)) { return(new JsonResult() { Data = AjaxResponse.Fail(SmsErrorEnum.PhoneCodeFault) }); } StudentInfoBll studentInfoBll = new StudentInfoBll(); var result = studentInfoBll.MobileLogin(inputModel.Phone); if (result != null) { var sumStudent = studentInfoBll.GetSumStudentTip(result.Bsp_StudentId); LoginInfo info = sumStudent.ConvertTo <LoginInfo>(); LoginStudent.Info = JsonConvert.SerializeObject(info); return(Json(new JsonSimpleResponse() { State = true, ErrorMsg = "登录成功", ErrorCode = 1 })); } return(Json(new JsonSimpleResponse() { State = false, ErrorMsg = "登录失败", ErrorCode = -1 })); }
public ActionResult BindFace(FaceBindInputModel inputModel) { if (SmsCookie.GetSmsCode == null || !SmsCookie.GetSmsCode.Check(inputModel.Phone, inputModel.SmsCode)) { return(new JsonResult() { Data = AjaxResponse.Fail(SmsErrorEnum.PhoneCodeFault) }); } StudentInfoBll studentInfoBll = new StudentInfoBll(); var studentPassort = studentInfoBll.GetByPassportKey(inputModel.Phone); if (studentPassort == null) { return(Json(new JsonResponse <int>() { State = false, ErrorCode = -1, ErrorMsg = "用户名不存在" })); } FaceRecognitionResponse response = BaiduApiBll.FaceRegister(inputModel.Image, inputModel.ImageType, studentPassort.Bsp_StudentId.ToString(), ""); if (response.error_code == 0) { studentInfoBll.AddStudentPassport(studentPassort.Bsp_StudentId, StudentAccountSourceEnum.人脸识别, response.result.face_token, ""); return(Json(new JsonResponse <FaceRecognitionResponse>() { Data = response, ErrorCode = 1, ErrorMsg = "绑定成功" })); } return(Json(new JsonResponse <FaceRecognitionResponse>() { Data = response, ErrorCode = 0, ErrorMsg = "绑定失败" })); }
public ActionResult GetSumStudentInfo() { StudentInfoBll studentInfoBll = new StudentInfoBll(); if (GetCurrentUser() == null) { return(RedirectToAction("LoginIndex", "Login")); } DtoSumStudentTip sumStudent = studentInfoBll.GetSumStudentTip(GetCurrentUser().StudentId); var lastLoginTime = WebHelper.GetCookie("LastLoginTime"); if (string.IsNullOrEmpty(lastLoginTime)) { sumStudent.PrevLoginTime = ""; } else { sumStudent.PrevLoginTime = Encrypt.DecryptQueryString(lastLoginTime); } return(Json(new JsonResponse <DtoSumStudentTip>() { State = true, ErrorMsg = "查询成功", Data = sumStudent }, JsonRequestBehavior.AllowGet)); }
public ActionResult Register(RegisterInputModel inputModel) { if (string.IsNullOrEmpty(inputModel.Phone.Trim())) { return(Json(new JsonSimpleResponse() { ErrorCode = -5, ErrorMsg = "请输入手机号" })); } if (string.IsNullOrEmpty(inputModel.SmsCode.Trim())) { return(Json(new JsonSimpleResponse() { ErrorCode = -6, ErrorMsg = "请输入手机验证码" })); } if (string.IsNullOrEmpty(inputModel.Name.Trim())) { return(Json(new JsonSimpleResponse() { ErrorCode = -7, ErrorMsg = "请输入姓名" })); } if (inputModel.Grade <= 0) { return(Json(new JsonSimpleResponse() { ErrorCode = -8, ErrorMsg = "请选择年级" })); } if (SmsCookie.GetSmsCode == null || !SmsCookie.GetSmsCode.Check(inputModel.Phone, inputModel.SmsCode)) { return(new JsonResult() { Data = AjaxResponse.Fail(SmsErrorEnum.PhoneCodeFault) }); } StudentInfoBll studentInfoBll = new StudentInfoBll(); var isExist = studentInfoBll.IsExistPhone(inputModel.Phone); if (isExist) { return(Json(new JsonSimpleResponse() { ErrorCode = -9, ErrorMsg = "手机号已存在" })); } inputModel.Password = Encrypt.GetMD5Pwd(inputModel.Password); DtoStudentRegister register = inputModel.ConvertTo <DtoStudentRegister>(); int studentId = studentInfoBll.Register(register); if (studentId > 0) { DtoSumStudentTip sumStudent = studentInfoBll.GetSumStudentTip(studentId); LoginInfo info = sumStudent.ConvertTo <LoginInfo>(); LoginStudent.Info = JsonConvert.SerializeObject(info); return(Json(new JsonSimpleResponse() { State = true, ErrorMsg = "注册成功", ErrorCode = 1 })); } return(Json(new JsonSimpleResponse() { State = false, ErrorMsg = "注册失败", ErrorCode = -1 })); }
public override void Handle() { CourseStudyPractiseMessage msgObject = JsonConvert.DeserializeObject <CourseStudyPractiseMessage>(message); SumStudentBll bll = new SumStudentBll(); StudentStudyBll studyBll = new StudentStudyBll(); Yw_StudentCourseProgress progress = studyBll.GetProgressByStudentCourse(msgObject.StudentId, msgObject.CourseId); if (progress == null) { throw new AbhsException(ErrorCodeEnum.StudentCourseProgressNotFound, AbhsErrorMsg.ConstStudentCourseProgressNotFound, msgObject.StudentId + "," + msgObject.CourseId); } bool newDay = false; Sum_StudyFactDaily daily = bll.GetDailyData(msgObject.StudentId, progress.Yps_ClassId, msgObject.AsOfDate.Date); if (daily == null) { newDay = true; daily = new Sum_StudyFactDaily(); daily.Ssd_StudentId = msgObject.StudentId; daily.Ssd_SchoolId = progress.Yps_SchoolId; daily.Ssd_ClassId = progress.Yps_ClassId; daily.Ssd_Date = msgObject.AsOfDate.Date; daily.Ssd_UpdateTime = DateTime.Now; daily.Ssd_StudySeconds = msgObject.StudySeconds; daily.Ssd_IncomeCoins = msgObject.GetCoins; daily.Ssd_SubjectCount = msgObject.SubjectCount; daily.Ssd_PracticeCount = 1; daily.Ssd_ExperiencePoints = msgObject.GetCoins; } else { daily.Ssd_UpdateTime = DateTime.Now; daily.Ssd_StudySeconds = daily.Ssd_StudySeconds + msgObject.StudySeconds; daily.Ssd_IncomeCoins = daily.Ssd_IncomeCoins + msgObject.GetCoins; daily.Ssd_SubjectCount = daily.Ssd_SubjectCount + msgObject.SubjectCount; daily.Ssd_PracticeCount = daily.Ssd_PracticeCount + 1; daily.Ssd_ExperiencePoints = daily.Ssd_ExperiencePoints + msgObject.GetCoins; } bll.SaveDailyData(daily); Dictionary <DateCycleTypeEnum, Sum_StudyFactDateCycle> dic = bll.FetchOrCreateCycleData(msgObject.StudentId, progress.Yps_ClassId, msgObject.AsOfDate.Date); foreach (KeyValuePair <DateCycleTypeEnum, Sum_StudyFactDateCycle> item in dic) { item.Value.Sdc_StudentId = msgObject.StudentId; item.Value.Sdc_SchoolId = progress.Yps_SchoolId; item.Value.Sdc_ClassId = progress.Yps_ClassId; item.Value.Sdc_UpdateTime = DateTime.Now; item.Value.Sdc_StudySeconds = item.Value.Sdc_StudySeconds + msgObject.StudySeconds; item.Value.Sdc_IncomeCoins = item.Value.Sdc_IncomeCoins + msgObject.GetCoins; item.Value.Sdc_SubjectCount = item.Value.Sdc_SubjectCount + msgObject.SubjectCount; item.Value.Sdc_PracticeCount = item.Value.Sdc_PracticeCount + 1; item.Value.Sdc_ExperiencePoints = item.Value.Sdc_ExperiencePoints + msgObject.GetCoins; item.Value.Sdc_StudyDayCount = newDay ? item.Value.Sdc_StudyDayCount + 1 : item.Value.Sdc_StudyDayCount; bll.SaveCycleData(item.Value); } if (newDay) { int dayCount = bll.GetStudyDayCountOfStudent(msgObject.StudentId); StudentInfoBll infoBll = new StudentInfoBll(); infoBll.UpdateStudyDayCountOfStudent(msgObject.StudentId, dayCount); } }