| | |
| | | [Route("[controller]")] |
| | | public class WareAuthorizeController : ControllerBase |
| | | { |
| | | |
| | | private static bool isRuning_Fun_MianAgvFun = false; |
| | | private static readonly SemaphoreSlim semaphore_MianAgvFun = new SemaphoreSlim(1, 1); |
| | | |
| | | private readonly ILogger<WareAuthorizeController> _logger; |
| | | |
| | | public WareAuthorizeController(ILogger<WareAuthorizeController> logger) |
| | |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpGet(Name = "ValidateLicense")] |
| | | public AuthorizeFunRetEntity ValidateLicense([FromQuery] ValidateLicenseInput input) |
| | | public async Task<AuthorizeFunRetEntity> ValidateLicense([FromQuery] ValidateLicenseInput input) |
| | | { |
| | | if (isRuning_Fun_MianAgvFun) |
| | | { |
| | | //认为是验证成功,不要并发导致读取授权文件失败 |
| | | //return AuthorizeFunRetEntity.Success("成功", null); |
| | | } |
| | | try |
| | | { |
| | | await semaphore_MianAgvFun.WaitAsync(); |
| | | isRuning_Fun_MianAgvFun = true; |
| | | |
| | | //if (input == null) |
| | | //{ |
| | | // return AuthorizeFunRetEntity.Fail("参数不能为空"); |
| | |
| | | { |
| | | return AuthorizeFunRetEntity.Fail("异常:" + ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | semaphore_MianAgvFun.Release(); |
| | | isRuning_Fun_MianAgvFun = false; |
| | | } |
| | | } |
| | | } |
| | | } |