/// <summary> /// 查询通知名称列表 /// </summary> /// <param name="notificationInfo"></param> /// <returns></returns> public async Task <JsonResult> GetNotificationInfoAll() { var data = await _sysNotificationAppService.GetNotificationInfoAllAsync(); return(Json(data)); }
public async Task <AjaxResponse> SaveUserModel(UserInput model) { if (model.ID == null) { UserInfo modelInput = model.MapTo <UserInfo>(); //查询范围包含已经逻辑删除的数据 using (_unitOfWorkManager.Current.DisableFilter(AbpDataFilters.SoftDelete)) { //唯一键冲突必须要先进行验证 var res = await _userInfoManager.FindByNameAsync(modelInput.UserCode); if (res != null) { return(new AjaxResponse { Success = false, Error = new ErrorInfo("账号重复") }); } } //新增用户设置默认图标 modelInput.ImageUrl = "m"; if (modelInput.Sex == "0") { modelInput.ImageUrl = "w"; } //新增用户对象 await _userInfoManager.CreateAsync(modelInput); //获取新增后的主键id model.ID = modelInput.Id; //新增订阅通知 var notificationInfo = await _sysNotificationAppService.GetNotificationInfoAllAsync(); foreach (var item in notificationInfo) { await _sysNotificationAppService.InsertSubscriptionAsync(new List <long>() { modelInput.Id }, item.NotificationName); } } else { long id = Convert.ToInt64(model.ID); //更新数据时不对数据是否逻辑删除做判断 using (_unitOfWorkManager.Current.DisableFilter(AbpDataFilters.SoftDelete)) { //获取需要更新的数据 UserInfo data = _userInfoRepository.Get(id); //映射需要修改的数据对象 UserInfo modelInput = ObjectMapper.Map(model, data); //提交修改 await _userInfoManager.UpdateAsync(modelInput); } //清除缓存 _cacheManagerExtens.RemoveUserInfoCache(id); } bool isFlag = await _userInfoExtens.UpdateUserInfo(model); if (!isFlag) { return(new AjaxResponse { Success = false, Error = new ErrorInfo("用户扩展信息保存失败!") }); } return(new AjaxResponse { Success = true }); }