fix 二维码校验设备权限
This commit is contained in:
@@ -16,6 +16,10 @@
|
||||
<None Remove="log\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dlhis.Basic.Api\Dlhis.Basic.Api.csproj" />
|
||||
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||
|
||||
@@ -1,23 +1,31 @@
|
||||
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
# 请参阅 https://aka.ms/customizecontainer 以了解如何自定义调试容器,以及 Visual Studio 如何使用此 Dockerfile 生成映像以更快地进行调试。
|
||||
|
||||
# 此阶段用于在快速模式(默认为调试配置)下从 VS 运行时
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
||||
|
||||
# 此阶段用于生成服务项目
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["Src/Dlhis.Canteen/Dlhis.Canteen.csproj", "Src/Dlhis.Canteen/"]
|
||||
COPY ["Src/Dlhis.Basic.Api/Dlhis.Basic.Api.csproj", "Src/Dlhis.Basic.Api/"]
|
||||
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
||||
COPY ["Src/Dlhis.DataPermission.Model/Dlhis.DataPermission.Model.csproj", "Src/Dlhis.DataPermission.Model/"]
|
||||
COPY ["Src/Dlhis.Sys.Api/Dlhis.Sys.Api.csproj", "Src/Dlhis.Sys.Api/"]
|
||||
RUN dotnet restore "Src/Dlhis.Canteen/Dlhis.Canteen.csproj"
|
||||
RUN dotnet restore "./Src/Dlhis.Canteen/Dlhis.Canteen.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/Src/Dlhis.Canteen"
|
||||
RUN dotnet build "Dlhis.Canteen.csproj" -c Release -o /app/build
|
||||
RUN dotnet build "./Dlhis.Canteen.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
# 此阶段用于发布要复制到最终阶段的服务项目
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "Dlhis.Canteen.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./Dlhis.Canteen.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
# 此阶段在生产中使用,或在常规模式下从 VS 运行时使用(在不使用调试配置时为默认值)
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Canteen.Order.Dto;
|
||||
using Dlhis.Basic.Api;
|
||||
using Dlhis.Canteen.Order.Dto;
|
||||
using Dlhis.Canteen.Order.Repository;
|
||||
using Dlhis.Canteen.Setting.Services;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
@@ -31,6 +32,7 @@ public class OrderService : IOrderService
|
||||
private readonly IBalanceRepository _balanceRepository;
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly RedisCache _redisCache;
|
||||
private readonly IGainfoPermissionApi _gainfoPermissionApi;
|
||||
private readonly ILogger<OrderService> _logger;
|
||||
|
||||
public OrderService(ICanteenSettingService canteenSettingService,
|
||||
@@ -40,6 +42,7 @@ public class OrderService : IOrderService
|
||||
IBalanceRepository balanceRepository,
|
||||
IOrderRepository orderRepository,
|
||||
RedisCache redisCache,
|
||||
IGainfoPermissionApi gainfoPermissionApi,
|
||||
ILogger<OrderService> logger)
|
||||
{
|
||||
_canteenSettingService = canteenSettingService;
|
||||
@@ -49,6 +52,7 @@ public class OrderService : IOrderService
|
||||
_balanceRepository = balanceRepository;
|
||||
_orderRepository = orderRepository;
|
||||
_redisCache = redisCache;
|
||||
_gainfoPermissionApi = gainfoPermissionApi;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -126,6 +130,19 @@ public class OrderService : IOrderService
|
||||
|
||||
//******************************************************* help methods ************************************************************/
|
||||
|
||||
private async Task CheckPermissionAsync(string userCode, string deviceUniqueNo)
|
||||
{
|
||||
var r = await _gainfoPermissionApi.GetPermissionsDeviceCodesAsync(userCode);
|
||||
if (r.Code != Kurisu.RemoteCall.Default.ApiStateCode.Success)
|
||||
{
|
||||
true.ThrowIfTrue(r.Msg);
|
||||
}
|
||||
|
||||
var code = await _dbContext.Queryable<DeviceEntity>().Where(x => x.UniqueNo == deviceUniqueNo).Select(x => x.Code).SingleAsync();
|
||||
r.Data.Contains(code).ThrowIfFalse("无权消费");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前消费人员
|
||||
/// </summary>
|
||||
@@ -142,6 +159,7 @@ public class OrderService : IOrderService
|
||||
if (request.UserUniqueNo.StartsWith("01"))
|
||||
{
|
||||
gainfo = await GetUserByQrCodeAsync(request.UserUniqueNo);
|
||||
await CheckPermissionAsync(gainfo.Code, request.DeviceUniqueNo);
|
||||
}
|
||||
else if (request.UserUniqueNo.StartsWith("02"))
|
||||
{
|
||||
|
||||
@@ -7,6 +7,15 @@
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://localhost:5008"
|
||||
},
|
||||
"Container (Dockerfile)": {
|
||||
"commandName": "Docker",
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_URLS": "http://+:80"
|
||||
},
|
||||
"publishAllPorts": true,
|
||||
"useSSL": false
|
||||
}
|
||||
},
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json"
|
||||
|
||||
Reference in New Issue
Block a user