|
@ -36,11 +36,11 @@ namespace BBWY.Server.API.Middlewares |
|
|
if (apiRequirement != null) |
|
|
if (apiRequirement != null) |
|
|
{ |
|
|
{ |
|
|
if (!context.Request.Headers.TryGetValue("ClientVersion", out StringValues clientVersionStr)) |
|
|
if (!context.Request.Headers.TryGetValue("ClientVersion", out StringValues clientVersionStr)) |
|
|
throw new BusinessException("未读取到ClientVersion"); |
|
|
throw new BusinessException("缺少版本信息,请更新步步为盈"); |
|
|
if (!int.TryParse(clientVersionStr, out int clientVersion)) |
|
|
if (!int.TryParse(clientVersionStr, out int clientVersion)) |
|
|
throw new BusinessException("非法ClientVersion"); |
|
|
throw new BusinessException("版本信息不正确,请更新步步为盈"); |
|
|
if (clientVersion < apiRequirement.MinimumVersion) |
|
|
if (clientVersion < apiRequirement.MinimumVersion) |
|
|
throw new BusinessException("当前ClientVersion低于接口最低要求,请升级到最新版"); |
|
|
throw new BusinessException("当前请求需更新步步为盈~!"); |
|
|
} |
|
|
} |
|
|
await _next(context); //调用管道执行下一个中间件
|
|
|
await _next(context); //调用管道执行下一个中间件
|
|
|
} |
|
|
} |
|
|