public JsonEnsureChangePositionEntity EnsureChangePosition() { JsonEnsureChangePositionEntity result = new JsonEnsureChangePositionEntity(); long id = CommonHelper.GetPostValue("id").ToLong(-1); int status = CommonHelper.GetPostValue("status").ToInt(-1); if (id == -1 || status == -1) { result.ErrorCode = "E001"; result.ErrorMessage = "获得信息不全!"; return(result); } T_BG_ChangeUserPosition changeUserPosition = _bgChangeUserPositionService.GetByChangeUserPositionId(id); if (changeUserPosition == null) { result.ErrorCode = "E002"; result.ErrorMessage = "未发现调动信息!"; return(result); } if (changeUserPosition.Status == 1) { result.ErrorCode = "E002"; result.ErrorMessage = "用户已经完成调动!"; return(result); } changeUserPosition.PassUserId = LoginHelper.UserId; changeUserPosition.PassUserName = LoginHelper.UserName; changeUserPosition.PassDateTime = DateTime.Now; changeUserPosition.Status = status; if (_bgChangeUserPositionService.Update(changeUserPosition)) { T_BG_User user = _bgUserService.GetUserById(changeUserPosition.UserId); user.ShopID = changeUserPosition.NewShopId.ToInt(-1); user.AreaId = changeUserPosition.NewAreaId; bool suc = _bgUserService.Update(user); if (suc) { result.ErrorCode = "E000"; result.ErrorMessage = "成功!"; return(result); } else { logger.ErrorFormat("调动员工更新员工新位置信息失败,请处理员工信息:userid={0};user.ShopID={1};user.AreaId={2};登录用户id={3}", user.ID, user.ShopID, user.AreaId, LoginHelper.UserId); result.ErrorCode = "E003"; result.ErrorMessage = "更新员工数据失败!"; } } else { result.ErrorCode = "E003"; result.ErrorMessage = "更新调动数据失败!"; } return(result); }
/// <summary> /// 登陆后台设置Cookie /// </summary> /// <param name="bgUser"></param> public static void SetBgUserCookie(T_BG_User bgUser) { CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserID, bgUser.ID.ToString()); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserName, bgUser.Name); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserRealName, bgUser.RealName); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserEmail, bgUser.Email); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserRoleID, bgUser.RoleID.ToString()); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserShopID, bgUser.ShopID.ToString()); }
public bool Update(T_BG_User user) { try { return(_bgUserRepository.Update(user)); } catch (Exception) { return(false); } }
public bool Add(T_BG_User user) { try { return(_bgUserRepository.Add(user) > 0); } catch (Exception) { return(false); } }
public JsonResult AddUser() { JsonUserAddUserEntity json = new JsonUserAddUserEntity(); string name = CommonHelper.GetPostValue("username"); string password = CommonHelper.GetPostValue("password"); string realname = CommonHelper.GetPostValue("realname"); string phone = CommonHelper.GetPostValue("phone"); string email = CommonHelper.GetPostValue("email"); int roleid = CommonHelper.GetPostValue("roleid").ToInt(-1); int areaid = CommonHelper.GetPostValue("areaid").ToInt(-1); int shopid = CommonHelper.GetPostValue("shopid").ToInt(-1); int departmentId = CommonHelper.GetPostValue("departmentId").ToInt(-1); if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(password) || roleid < 0 || areaid < 0 || shopid < 0 || departmentId < 0) { json.ErrorCode = "E001"; json.ErrorMessage = "参数不全!"; return(Json(json)); } name = HttpUtility.UrlDecode(name); realname = HttpUtility.UrlDecode(realname); T_BG_User user = new T_BG_User(); user.Phone = phone; user.Name = name; user.RealName = realname; user.PassWord = password; user.Email = email; user.RoleID = roleid; user.ShopID = shopid; user.Status = 0; user.AddTime = DateTime.Now; user.IsDel = 0; user.DepartmentId = departmentId; user.AreaId = areaid; bool result = _bgUserService.Add(user); if (result) { json.ErrorCode = "E000"; json.ErrorMessage = "添加成功!"; } else { json.ErrorCode = "E002"; json.ErrorMessage = "添加失败!"; } return(Json(json)); }
/// <summary> /// 登陆后台设置Cookie /// </summary> /// <param name="bgUser"></param> public static void SetBgUserCookie(T_BG_User bgUser) { CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserID, bgUser.ID.ToString()); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserName, bgUser.Name); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserRealName, bgUser.RealName); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserEmail, bgUser.Email); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserRoleID, bgUser.RoleID.ToString()); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserShopID, bgUser.ShopID.ToString()); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserPositionId, bgUser.PositionId.ToString()); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserDepartmentId, bgUser.DepartmentId.ToString()); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserAreaId, bgUser.AreaId.ToString()); CookieHelper.SetSessionCookie(SessionDomain, CommonVariables.LoginCookiebgUserLvl, bgUser.Lvl.ToString()); }
public JsonApproveEmployPassEntity ApproveEmployPass() { JsonApproveEmployPassEntity result = new JsonApproveEmployPassEntity(); long id = CommonHelper.GetPostValue("id").ToLong(-1); int status = CommonHelper.GetPostValue("status").ToInt(-1); if (id < 0 || status < 0) { result.ErrorCode = "E001"; result.ErrorMessage = "获得信息不全!"; return(result); } T_BG_User user = _bgUserService.GetUserById(id); if (user == null) { result.ErrorCode = "E002"; result.ErrorMessage = "该角色已经被删除!"; return(result); } if (user.Status != 0) { result.ErrorCode = "E004"; result.ErrorMessage = "该角色已经修改,请刷新页面!"; return(result); } user.Status = status; user.ApproveTime = DateTime.Now; user.ApproveName = LoginHelper.UserName; bool success = _bgUserService.Update(user); if (success) { result.ErrorCode = "E000"; result.ErrorMessage = "成功"; } else { result.ErrorCode = "E003"; result.ErrorMessage = "更新失败!"; } return(result); }
public JsonResult Pass() { JsonUserPassEntity json = new JsonUserPassEntity(); long id = CommonHelper.GetPostValue("id").ToLong(-1L); int state = CommonHelper.GetPostValue("state").ToInt(0); if (id < 0) { json.ErrorCode = "E001"; json.ErrorMessage = "参数不全!"; return(Json(json)); } T_BG_User user = _bgUserService.GetUserById(id); if (user == null) { json.ErrorCode = "E002"; json.ErrorMessage = "未获得该对象,请刷新页面!"; return(Json(json)); } user.Status = state; user.ApproveName = LoginHelper.UserName; user.ApproveTime = DateTime.Now; bool result = _bgUserService.Update(user); if (result) { json.ErrorCode = "E000"; json.ErrorMessage = "成功!"; } else { json.ErrorCode = "E002"; json.ErrorMessage = "失败,请刷新页面!"; } return(Json(json)); }
public JsonResult LoginValidate() { string sourceUrl = CommonHelper.GetPostValue("url"); if (!string.IsNullOrEmpty(sourceUrl)) { ViewBag.SourceUrl = sourceUrl; } sourceUrl = Server.UrlDecode(sourceUrl); string username = CommonHelper.GetPostValue("username"); string password = CommonHelper.GetPostValue("password"); //string mRemember = CommonHelper.GetPostValue("remember"); LoginValidateEntity entity = new LoginValidateEntity(); if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { entity.ErrorCode = "E0011"; entity.ErrorMessage = ErrorInfoHelper.GetErrorValue(entity.ErrorCode); return(Json(entity, JsonRequestBehavior.AllowGet)); } string ip = IPHelper.GetLoginIp(System.Web.HttpContext.Current.Request); var rSaCryptoService = new RSACryptoService(ProductConfigHelper.ThinkTankJsEncryptPrivateKeyForCSharp, ProductConfigHelper.ThinkTankJsEncryptPublickKeyForCSharp); string strDecryptUsername = rSaCryptoService.Decrypt(username); string strDecryptPassword = rSaCryptoService.Decrypt(password); try { T_BG_User user = _bgUserService.GetUser(strDecryptUsername, strDecryptPassword); if (user != null) { if (user.Status == 0) { entity.ErrorCode = "E0003"; } else if (user.Status == 1) { string address = LoginHelper.GetMaxMindOmniData(ip); T_BG_LoginLog loginLog = new T_BG_LoginLog { LogUserID = user.ID, IP = ip, Address = address, LogTime = DateTime.Now, IsLogIn = true }; long result = _bgLoginLogService.Add(loginLog); entity.ErrorCode = result > 0 ? "E0001" : "E0007"; LoginHelper.SetBgUserCookie(user); entity.ToUrl = string.IsNullOrEmpty(sourceUrl) ? DomainUrlHelper.PublicMessagePath + "/Login/Index" : sourceUrl; } else if (user.Status == 2) { entity.ErrorCode = "E0004"; } else if (user.Status == 3) { entity.ErrorCode = "E0005"; } else { entity.ErrorCode = "E0006"; } entity.ErrorMessage = ErrorInfoHelper.GetErrorValue(entity.ErrorCode); } } catch (Exception) { entity.ErrorCode = "E0008"; entity.ErrorMessage = ErrorInfoHelper.GetErrorValue(entity.ErrorCode); } return(Json(entity, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 添加或者修改用户 /// </summary> /// <returns></returns> public JsonResult AddOrUpdateUser() { JsonUserAddUserEntity json = new JsonUserAddUserEntity(); string realname = CommonHelper.GetPostValue("realname"); int gender = CommonHelper.GetPostValue("gender").ToInt(-1); long positionId = CommonHelper.GetPostValue("positionId").ToLong(-1); DateTime entryDate = CommonHelper.GetPostValue("entryDate").ToDateTime(DateTime.MaxValue); string identity = CommonHelper.GetPostValue("identity"); string phone = CommonHelper.GetPostValue("phone"); long educationId = CommonHelper.GetPostValue("educationId").ToLong(-1); long householdId = CommonHelper.GetPostValue("householdId").ToLong(-1); string school = CommonHelper.GetPostValue("school"); string email = CommonHelper.GetPostValue("email"); string emergency = CommonHelper.GetPostValue("emergency"); string address = CommonHelper.GetPostValue("address"); string remark = CommonHelper.GetPostValue("remark"); int add = CommonHelper.GetPostValue("add").ToInt(0); //0=添加 1=修改 long id = CommonHelper.GetPostValue("id").ToLong(-1); if ((string.IsNullOrEmpty(realname) || gender == -1 || positionId == -1 || entryDate == DateTime.MaxValue || string.IsNullOrEmpty(identity) || householdId == -1 || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(emergency) || string.IsNullOrEmpty(address)) || (add == 1 && id < 0)) { json.ErrorCode = "E001"; json.ErrorMessage = "参数不全!"; return(Json(json)); } realname = HttpUtility.UrlDecode(realname); school = HttpUtility.UrlDecode(school); emergency = HttpUtility.UrlDecode(emergency); address = HttpUtility.UrlDecode(address); remark = HttpUtility.UrlDecode(remark); T_BG_User user = null; if (add == 0) { user = new T_BG_User(); } else { user = _bgUserService.GetUserById(id); if (user == null) { json.ErrorCode = "E003"; json.ErrorMessage = "未获得该修改对象!"; return(Json(json)); } } T_BG_Position p = _bgPositionService.GetByPositionId(positionId); if (p == null) { json.ErrorCode = "E003"; json.ErrorMessage = "未获得该修改员工职位信息!"; return(Json(json)); } user.RealName = realname; user.Gender = gender; user.PositionId = positionId; user.EntryDate = entryDate; user.IP = identity; user.Phone = phone; user.EducationId = educationId; user.HouseholdId = householdId; user.School = school; user.Email = email; user.Emergency = emergency; user.Address = address; user.Remark = remark; user.Lvl = p.Lvl; bool result = false; if (add == 0) { user.DepartmentId = LoginHelper.DepartmentId; user.Status = 0; user.AddTime = DateTime.Now; user.IsDel = 0; user.AreaId = LoginHelper.AreaId; user.ShopID = LoginHelper.ShopID; //这个后期可能需要修改 user.RoleID = 2; result = _bgUserService.Add(user); } else { result = _bgUserService.Update(user); } if (result) { json.ErrorCode = "E000"; json.ErrorMessage = "成功!"; } else { json.ErrorCode = "E002"; json.ErrorMessage = "数据库操作失败!"; } return(Json(json)); }
//[HttpPost] public JsonResult Post(string id) { string userid = CommonHelper.GetPostValue("key"); string filename = CommonHelper.GetPostValue("fn"); string type = CommonHelper.GetPostValue("type").ToString("PublicFile"); OrignalTypeEnum saveType = type.Equals("GuideFile") || type.Equals("3") ? OrignalTypeEnum.GuideFile : type.Equals("ActiveFile") || type.Equals("1") ? OrignalTypeEnum.ActiveFile : OrignalTypeEnum.PublicFile; // //这个方法暂时这样,需要优化 // userid = LoginHelper.UserId.ToString(); long lUserId = userid.ToLong(-1); //string.IsNullOrEmpty(sign) || if (string.IsNullOrEmpty(userid) || lUserId <= 0) { return(Json(new FileUploadEntity { ErrorCode = "10000", ErrorMessage = "非法请求" })); } T_BG_User bgUser = _bgUserService.GetUserById(userid.ToLong(-1)); if (bgUser == null) { return(Json(new FileUploadEntity { ErrorCode = "10000", ErrorMessage = "请重新登录" })); } if (HttpContext.Request.Files.Count > 0) { try { HttpPostedFile file = System.Web.HttpContext.Current.Request.Files[0]; if (file.ContentLength <= 0) { return(Json(new FileUploadEntity { ErrorCode = "10000", ErrorMessage = "上传的文档为空!" })); } FileExtension[] fileExs = new FileExtension[] { FileExtension.DOC, FileExtension.DOCX, FileExtension.PDF }; string fileExt = FileValidation.FileExtension(file, fileExs); if (string.IsNullOrEmpty(fileExt)) { return(Json(new FileUploadEntity { ErrorCode = "10000", ErrorMessage = "请上传WORD、PDF格式的文档!" })); } string originFileName = Regex.Replace(file.FileName, "." + fileExt, "." + fileExt, RegexOptions.IgnoreCase); string savename = Guid.NewGuid().ToString("N"); if (!string.IsNullOrEmpty(filename)) { savename = filename.Replace(string.Format("{0}_", LoginHelper.UserId), ""); } string ofile = originFileName; string newFileName = OriginalSaveHelper.CreateNewSaveFileName(userid, savename, fileExt); string savePath = OriginalSaveHelper.GetSavePath(newFileName, fileExt, type); string fn = newFileName.Replace(string.Format(".{0}", fileExt), ""); if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } string strMs = string.Empty; //string exception = "服务端异常"; string newFilePath = string.Format(@"{0}\{1}", savePath, newFileName); file.SaveAs(newFilePath); int iPageNum = 0; fileExt = fileExt.ToLower(); if (fileExt == "pdf" || fileExt.EndsWith("pdf")) { iPageNum = PdfSaveHelper.GetPdfFilePages(newFilePath, out strMs); } //如果iPageNum 不更新或不上传 if (iPageNum < 0) { return(Json(new FileUploadEntity { ErrorCode = "10000", ErrorMessage = "服务器不能解析上传的pdf,请选择其他文件重新上传!" })); } T_BG_UpFiles bgUpFiles = new T_BG_UpFiles { filename = fn, filehash = FileHelper.GetFileHash(newFilePath), userid = lUserId, fileoriginname = originFileName, filepath = newFilePath, ext = fileExt, addtime = DateTime.Now, type = saveType.ToInt(0) }; string fileorigin = originFileName.ReplaceSqlTag(); long cnt = _bgUpFilesService.GetListByUserIdAndFileNameAndExt(originFileName, lUserId, fileExt, saveType.ToInt(0)); long reslt = _bgUpFilesService.Add(bgUpFiles); if (reslt > 0) { string oname = fileorigin.ToLower().Replace("." + bgUpFiles.ext.ToLower(), ""); string attach = cnt <= 0 ? string.Format("{0}.{1}", oname, bgUpFiles.ext) : string.Format("{0}({1}).{2}", oname, cnt, bgUpFiles.ext); return(Json(new FileUploadEntity { ErrorCode = "00000", ErrorMessage = fn, Attach = attach, FilePath = bgUpFiles.filepath, FileType = fileExt })); } else { return(Json(new FileUploadEntity { ErrorCode = "10003", ErrorMessage = "服务端保存文件失败" })); } } catch (Exception) { return(Json(new FileUploadEntity { ErrorCode = "10000", ErrorMessage = "服务端异常" })); } } else { return(Json(new FileUploadEntity { ErrorCode = "10002", ErrorMessage = "请选择文件" })); } }
// GET: EmailUppload public JsonResult SendFile() { string userid = CommonHelper.GetPostValue("key"); string type = "EmailFile"; //CommonHelper.GetPostValue("type").ToString("PublicFile"); OrignalTypeEnum saveType = OrignalTypeEnum.EmailFile; userid = LoginHelper.UserId.ToString(); long lUserId = userid.ToLong(-1); if (string.IsNullOrEmpty(userid) || lUserId <= 0) { return(Json(new FileUploadEntity { ErrorCode = "10000", ErrorMessage = "非法请求!" })); } T_BG_User bgUser = _bgUserService.GetUserById(userid.ToLong(-1)); if (bgUser == null) { return(Json(new FileUploadEntity { ErrorCode = "10000", ErrorMessage = "请重新登录!" })); } if (HttpContext.Request.Files.Count > 0) { try { HttpPostedFile file = System.Web.HttpContext.Current.Request.Files[0]; if (file.ContentLength <= 0) { return(Json(new FileUploadEntity { ErrorCode = "10000", ErrorMessage = "上传的附件为空!" })); } //FileExtension[] fileExs = new FileExtension[] { FileExtension.DOC, FileExtension.DOCX, FileExtension.PDF }; //string fileExt = FileValidation.FileExtension(file, fileExs); //if (string.IsNullOrEmpty(fileExt)) //{ // return Json(new FileUploadEntity { ErrorCode = "10000", ErrorMessage = "请上传WORD、PDF格式的文档!" }); //} string fileExt = Path.GetExtension(file.FileName); string originFileName = Regex.Replace(file.FileName, "." + fileExt, "." + fileExt, RegexOptions.IgnoreCase); string savePath = OriginalSaveHelper.GetEmailSavePath(fileExt.Replace(".", ""), type); if (string.IsNullOrEmpty(savePath)) { return(Json(new FileUploadEntity { ErrorCode = "10000", ErrorMessage = "上传的路径获取失败!" })); } if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } string newFilePath = string.Format(@"{0}\{1}", savePath, file.FileName); file.SaveAs(newFilePath); T_BG_UpFiles bgUpFiles = new T_BG_UpFiles { filename = file.FileName, filehash = FileHelper.GetFileHash(newFilePath), userid = lUserId, fileoriginname = originFileName, filepath = newFilePath, ext = fileExt, addtime = DateTime.Now, type = saveType.ToInt(0) }; //long cnt = _bgUpFilesService.GetListByUserIdAndFileNameAndExt(originFileName, lUserId, fileExt, saveType.ToInt(0)); long reslt = _bgUpFilesService.Add(bgUpFiles); if (reslt > 0) { return(Json(new FileUploadEntity { ErrorCode = "00000", ErrorMessage = "上传成功", Attach = file.FileName, FilePath = bgUpFiles.filepath, FileType = fileExt })); } else { return(Json(new FileUploadEntity { ErrorCode = "10003", ErrorMessage = "服务端保存文件失败" })); } } catch (Exception) { return(Json(new FileUploadEntity { ErrorCode = "10000", ErrorMessage = "服务端异常" })); } } else { return(Json(new FileUploadEntity { ErrorCode = "10002", ErrorMessage = "请选择附件!" })); } }
public JsonChangePositionEntity ChangePosition() { JsonChangePositionEntity result = new JsonChangePositionEntity(); long id = CommonHelper.GetPostValue("id").ToLong(-1); long newAreaId = CommonHelper.GetPostValue("areaId").ToLong(-1); long newShopId = CommonHelper.GetPostValue("shopId").ToLong(-1); if (id == -1 || newAreaId == -1 || newShopId == -1) { result.ErrorCode = "E001"; result.ErrorMessage = "获得信息不全!"; return(result); } T_BG_User user = _bgUserService.GetUserById(id); if (user == null) { result.ErrorCode = "E002"; result.ErrorMessage = "未发现该用户!"; return(result); } if (user.Lvl >= LoginHelper.Lvl) { result.ErrorCode = "E002"; result.ErrorMessage = "您无权调动该员工职位!"; return(result); } T_BG_ChangeUserPosition c = _bgChangeUserPositionService.GetByUserId(id); if (c != null && c.Status == 0) { result.ErrorCode = "E003"; result.ErrorMessage = "该員工已经调整岗位,正在审核中!"; return(result); } if (user.AreaId == newAreaId && user.ShopID == newShopId) { result.ErrorCode = "E004"; result.ErrorMessage = "该員工已经已经是这个店铺的员工,无需调动!"; return(result); } T_BG_ChangeUserPosition changeUserPosition = new T_BG_ChangeUserPosition(); changeUserPosition.UserId = id; changeUserPosition.OldAreaId = user.AreaId.ToLong(-1); changeUserPosition.OldShopId = user.ShopID.ToLong(-1); changeUserPosition.NewAreaId = newAreaId; changeUserPosition.NewShopId = newShopId; changeUserPosition.AddTime = DateTime.Now; changeUserPosition.IsDel = 0; changeUserPosition.PassUserId = -1; changeUserPosition.PassUserName = ""; changeUserPosition.Status = 0; bool success = _bgChangeUserPositionService.Add(changeUserPosition); if (success) { result.ErrorCode = "E000"; result.ErrorMessage = "成功"; } else { result.ErrorCode = "E003"; result.ErrorMessage = "更新失败!"; } return(result); }
public JsonLeavePositionEntity LeavePosition() { JsonLeavePositionEntity result = new JsonLeavePositionEntity(); long id = CommonHelper.GetPostValue("id").ToLong(-1); if (id < 0) { result.ErrorCode = "E001"; result.ErrorMessage = "获得信息不全!"; return(result); } T_BG_User user = _bgUserService.GetUserById(id); if (user == null) { result.ErrorCode = "E002"; result.ErrorMessage = "该角色不存在,请刷新页面!"; return(result); } else if (user.IsDel == 1) { result.ErrorCode = "E002"; result.ErrorMessage = "该角色已经被删除,请刷新页面!"; return(result); } else if (user.Status == 0) { result.ErrorCode = "E002"; result.ErrorMessage = "该员工尚未审核通过,无法离职!"; return(result); } else if (user.Status == 2) { result.ErrorCode = "E002"; result.ErrorMessage = "该员工尚未审核通过,无法离职!"; return(result); } else if (user.Status == 3) { result.ErrorCode = "E002"; result.ErrorMessage = "该员已经离职,请刷新页面!"; return(result); } user.Status = 3; bool success = _bgUserService.Update(user); if (success) { result.ErrorCode = "E000"; result.ErrorMessage = "成功"; } else { result.ErrorCode = "E003"; result.ErrorMessage = "更新失败!"; } return(result); }