| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetInterfaceList(InterfaceVm model) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SqlSugarPagedList<InterfaceDto>> GetInterfaceList(InterfaceVm model) |
| | | { |
| | | try |
| | | { |
| | | var models = _interface.GetInterfaceList(model, out int count); |
| | | |
| | | return Ok(new { code = 0, count, msg = "接口列表", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | return await _interface.GetInterfaceList(model); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetInterfaceDetailList(InterfaceDetailVm model) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SqlSugarPagedList<InterfaceDetailDto>> GetInterfaceDetailList(InterfaceDetailVm model) |
| | | { |
| | | try |
| | | { |
| | | var models = _interface.GetInterfaceDetailList(model, out int count); |
| | | |
| | | return Ok(new { code = 0, count, msg = "接口明细列表", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | return await _interface.GetInterfaceDetailList(model); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult AddInterface(InterfaceVm model) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task AddInterface(InterfaceVm model) |
| | | { |
| | | try |
| | | await _interface.AddInterface(model); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | |
| | | model.CreateUser = int.Parse(UserId); |
| | | string strMesage = _interface.AddInterface(model); |
| | | |
| | | if (strMesage == "") |
| | | { |
| | | return Ok(new { code = 0, msg = "添加成功" }); |
| | | } |
| | | if (strMesage.Contains("-1")) |
| | | { |
| | | return Ok(new { code = 1, msg = strMesage }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 0, msg = strMesage }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | ParentName = "系统设置", |
| | | MenuName = "接口管理", |
| | | FkNo = model.InterfaceNo, |
| | | TypeName = "添加", |
| | | Msg = $"添加了接口编号为{model.InterfaceNo}的接口信息" |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult EditInterface(InterfaceVm model) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task EditInterface(InterfaceVm model) |
| | | { |
| | | try |
| | | await _interface.EditInterface(model); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | |
| | | model.CreateUser = int.Parse(UserId); |
| | | string strMesage = _interface.EditInterface(model); |
| | | |
| | | if (strMesage == "") |
| | | { |
| | | return Ok(new { code = 0, msg = "编辑成功" }); |
| | | } |
| | | if (strMesage.Contains("-1")) |
| | | { |
| | | return Ok(new { code = 0, msg = "部分成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = strMesage }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | ParentName = "系统设置", |
| | | MenuName = "接口管理", |
| | | FkNo = model.InterfaceNo, |
| | | TypeName = "编辑", |
| | | Msg = $"编辑了接口编号为{model.InterfaceNo}的接口信息" |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelInterface(InterfaceVm model) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task DelInterface(InterfaceVm model) |
| | | { |
| | | try |
| | | await _interface.DelInterface(model); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | |
| | | model.CreateUser = int.Parse(UserId); |
| | | string strMesage = _interface.DelInterface(model); |
| | | |
| | | if (strMesage == "") |
| | | { |
| | | return Ok(new { code = 0, msg = "删除成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = strMesage }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | ParentName = "系统设置", |
| | | MenuName = "接口管理", |
| | | FkNo = model.InterfaceNo, |
| | | TypeName = "编辑", |
| | | Msg = $"删除了接口编号为{model.InterfaceNo}的接口信息" |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelInterfaceDetail(InterfaceDetailVm model) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task DelInterfaceDetail(InterfaceDetailVm model) |
| | | { |
| | | try |
| | | await _interface.DelInterfaceDetail(model); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | |
| | | model.CreateUser = int.Parse(UserId); |
| | | string strMesage = _interface.DelInterfaceDetail(model); |
| | | |
| | | if (strMesage == "") |
| | | { |
| | | return Ok(new { code = 0, msg = "删除成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = strMesage }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | ParentName = "系统设置", |
| | | MenuName = "接口管理", |
| | | FkNo = model.InterfaceNo, |
| | | TypeName = "编辑", |
| | | Msg = $"删除了接口编号为{model.InterfaceNo}的接口信息,本系统字段为{model.Field}的接口信息" |
| | | }); |
| | | } |
| | | #endregion |
| | | } |