服务端的TigerApi 框架,基于.NET6 2024 版本
YangYuGang
6 天以前 d09f804c71b452b9039e4e2d9512489814deea73
Tiger.Controllers.System/Controllers/Base/BaseController.cs
@@ -574,5 +574,44 @@
        }
        #endregion
        #region 导入Excel
        [HttpPost]
        public async Task<IActionResult> ImportExcel([FromBody] ApiAction<ImportInput> action)
        {
            ApiAction response;
            try
            {
                IImportExcel import = DI.Resolve(action.Data.typeFullName) as IImportExcel;
                response = action.GetResponse(await import.Import(action.NewDataEntity(),action.Data));
            }
            catch (System.Exception ex)
            {
                response = action.GetResponse().CatchExceptionWithLog(ex);
            }
            return Ok(response);
        }
        /// <summary>
        /// 导入Excel前验证
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> ValidateTableImport([FromBody] ApiAction<ImportValidateInput> action)
        {
            ApiAction response;
            try
            {
                IImportExcel import = DI.Resolve(action.Data.typeFullName) as IImportExcel;
                response = action.GetResponse(await import.ValidateTableImport(action.NewDataEntity(), action.Data));
            }
            catch (System.Exception ex)
            {
                response = action.GetResponse().CatchExceptionWithLog(ex);
            }
            return Ok(response);
        }
        #endregion
    }
}