Browse Source

接口验证版本提示修改

updatebug
shanji 2 years ago
parent
commit
6f16a23cd9
  1. 6
      BBWYB.Server.API/Middlewares/ClientVersionValidationMiddleWare.cs

6
BBWYB.Server.API/Middlewares/ClientVersionValidationMiddleWare.cs

@ -31,11 +31,11 @@ namespace BBWYB.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); //调用管道执行下一个中间件
} }

Loading…
Cancel
Save