public IActionResult GetUserInfo() { YS_User_Enter info = null; string accountName = string.Empty; int accountId = 0; List <Claim> list = this.User.Claims.ToList(); if (list != null && list.Count > 0) { accountId = list[0].Value.ToInt32(); accountName = list[1].Value.ToString(); } MessageDataResult _json = new MessageDataResult(); var accountUser = _currencyService.DbAccess().Queryable <YS_Account_User>().Where(y => y.Account_Name.Equals(accountName) && y.Status == 0).First(); if (accountUser != null && !string.IsNullOrEmpty(accountUser.Mobile)) { info = _currencyService.DbAccess().Queryable <YS_User_Enter>().Where(p => p.Mobile == accountUser.Mobile && p.Status == 0).First(); } _json.status = 200; _json.msg = "操作成功"; _json.data = info; return(Json(_json)); }
public IActionResult SaveYSUser([FromBody] EnterYsUserQuery data) { string accountName = string.Empty; int accountId = 0; List <Claim> list = this.User.Claims.ToList(); if (list != null && list.Count > 0) { accountId = list[0].Value.ToInt32(); accountName = list[1].Value.ToString(); } MessageDataResult _json = new MessageDataResult(); if (data != null) { var accountUser = _currencyService.DbAccess().Queryable <YS_Account_User>().Where(y => y.Account_Name.Equals(accountName) && y.Status == 0).First(); if (accountUser != null && !string.IsNullOrEmpty(accountUser.Mobile)) { var userinfo = _currencyService.DbAccess().Queryable <YS_User_Enter>().Where(p => p.Mobile == accountUser.Mobile && p.Status == 0).First(); //如果初级驳回则重新更新 if (userinfo.AuditStatus == (int)ApiUserAuditEnum.AuditFaill) { if (!accountUser.Mobile.Equals(data.Mobile)) { _json.status = 0; _json.msg = "输入手机号码请和原来保持一致"; return(Json(_json)); } //获取验证码 var verifyCodeInfo = _currencyService.DbAccess().Queryable <YS_VerifyCode_Record>().Where(p => p.Mobile == data.Mobile && p.Status == 0).OrderBy(x => x.CreateTime, SqlSugar.OrderByType.Desc).First(); if (verifyCodeInfo == null || string.IsNullOrEmpty(data.VerifyCode)) { _json.status = 0; _json.msg = "验证码不能为空"; return(Json(_json)); } if (verifyCodeInfo != null && !verifyCodeInfo.VerifyCode.Equals(data.VerifyCode)) { _json.status = 0; _json.msg = "验证码不正确!请重新输入"; return(Json(_json)); } int result = _currencyService.DbAccess().Updateable <YS_User_Enter>(item => new YS_User_Enter() { UpdateTime = DateTime.Now, UserName = data.UserName, AuditStatus = (int)ApiUserAuditEnum.WatingAudit, Enter_OrganIzation = data.Enter_OrganIzation, History_Max_Listen = data.History_Max_Listen, History_Max_Reder = data.History_Max_Reder, History_Max_Talk = data.History_Max_Talk, History_Max_Total = data.History_Max_Total, History_Max_Write = data.History_Max_Write, Last_Max_Total = data.Last_Max_Total, Last_Max_Listen = data.Last_Max_Listen, Last_Max_Reder = data.Last_Max_Reder, Last_Max_Talk = data.Last_Max_Talk, Last_Max_Write = data.Last_Max_Write, ID_Card_Back = data.ID_Card_Back, ID_Card_Front = data.ID_Card_Front, IsChecked = data.IsChecked }).Where(y => y.UsersID == userinfo.UsersID).ExecuteCommand(); if (result > 0) { _json.status = 200; _json.msg = "提交数据成功,请等待后台再次确认"; } else { _json.status = 0; _json.msg = "提交数据失败!数据异常"; } } //初级审核通过或者终极审核被驳回则更新第二段数据 if (userinfo.AuditStatus == (int)ApiUserAuditEnum.AuditSuccess || userinfo.AuditStatus == (int)ApiUserAuditEnum.AuditUltimateFaill) { int result = _currencyService.DbAccess().Updateable <YS_User_Enter>() .SetColumns(item => new YS_User_Enter() { IsFirst = data.IsFirst, Last_Score_Img_Url = data.Last_Score_Img_Url, Last_Join_Time = data.Last_Join_Time, Sign_Contract = data.Sign_Contract, Join_Address = data.Join_Address, Join_date = data.Join_date, ScoreRange = data.ScoreRange, ExaminationPlace = data.ExaminationPlace, Certificate_Img_Url = data.Certificate_Img_Url, UpdateTime = DateTime.Now, AuditStatus = (int)ApiUserAuditEnum.UploadSuccess }).Where(c => c.UsersID == userinfo.UsersID).ExecuteCommand(); if (result > 0) { _json.status = 200; _json.msg = "上传数据成功,请等待后台再次确认"; } else { _json.status = 0; _json.msg = "上传数据失败!数据异常"; } } } else { //获取验证码 var verifyCodeInfo = _currencyService.DbAccess().Queryable <YS_VerifyCode_Record>().Where(p => p.Mobile == data.Mobile && p.Status == 0).OrderBy(x => x.CreateTime, SqlSugar.OrderByType.Desc).First(); var userinfo = _currencyService.DbAccess().Queryable <YS_User_Enter>().Where(p => p.Mobile == data.Mobile && p.Status == 0).First(); if (userinfo != null) { _json.status = 0; _json.msg = "该手机号码已注册!请更换手机号码"; return(Json(_json)); } if (verifyCodeInfo == null || string.IsNullOrEmpty(data.VerifyCode)) { _json.status = 0; _json.msg = "验证码不能为空"; return(Json(_json)); } if (verifyCodeInfo != null && !verifyCodeInfo.VerifyCode.Equals(data.VerifyCode)) { _json.status = 0; _json.msg = "验证码不正确!请重新输入"; return(Json(_json)); } var result = _currencyService.DbAccess().UseTran(() => { YS_User_Enter model = new YS_User_Enter(); model.CreateTime = DateTime.Now; model.UpdateTime = DateTime.Now; model.Mobile = data.Mobile; model.UserName = data.UserName; model.AuditStatus = (int)ApiUserAuditEnum.WatingAudit; model.Enter_OrganIzation = data.Enter_OrganIzation; model.History_Max_Listen = data.History_Max_Listen; model.History_Max_Reder = data.History_Max_Reder; model.History_Max_Talk = data.History_Max_Talk; model.History_Max_Total = data.History_Max_Total; model.History_Max_Write = data.History_Max_Write; model.Last_Max_Total = data.Last_Max_Total; model.Last_Max_Listen = data.Last_Max_Listen; model.Last_Max_Reder = data.Last_Max_Reder; model.Last_Max_Talk = data.Last_Max_Talk; model.Last_Max_Write = data.Last_Max_Write; model.ID_Card_Back = data.ID_Card_Back; model.ID_Card_Front = data.ID_Card_Front; model.IsChecked = data.IsChecked; _currencyService.DbAccess().Insertable <YS_User_Enter>(model).ExecuteCommand(); //注册并绑定手机 _currencyService.DbAccess().Updateable <YS_Account_User>().SetColumns(item => new YS_Account_User() { Mobile = data.Mobile, IsUseed = 1 }).Where(y => y.Account_Name.Equals(accountName)).ExecuteCommand(); }); if (result.IsSuccess) { _json.status = 200; _json.msg = "保存成功!请等待后台审核"; } } } else { _json.status = 0; _json.msg = "请把报名相关信息填写完整。"; } return(Json(_json)); }