From 415b985bb36c46797fc3b9f88e751bf353b966a7 Mon Sep 17 00:00:00 2001
From: cheche <717840555@qq.com>
Date: Mon, 15 Jan 2024 13:36:34 +0800
Subject: [PATCH] =?UTF-8?q?fix=20=E8=8E=B7=E5=8F=96token=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Services/Implements/AssignmentService.cs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs
index 1ff5f76a..5134adc3 100644
--- a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs
@@ -13,6 +13,7 @@ using Microsoft.Extensions.Options;
using SqlSugar;
using Kurisu.SqlSugar.Extensions;
using Kurisu.SqlSugar.Attributes;
+using System.Threading.Tasks;
namespace Dlhis.ScheduledTask.TaskAssignment.Services.Implements;
@@ -160,13 +161,12 @@ public class AssignmentService : IAssignmentService
///
public async Task Token(long taskId)
{
- var task = await _dbContext.Queryable().Where(x => x.Id == taskId).FirstAsync();
-
+ var task = await _dbContext.Queryable().Where(x => x.Id == taskId).FirstAsync();
task.ThrowIfNull("该任务不存在");
- if (task.Status != DeviceTaskStatusEnumType.Success)
- {
- return "";
- }
+
+ var isSuccess = task.Status != DeviceTaskStatusEnumType.Success ? true : false;
+ isSuccess.ThrowIfTrue("设备任务下发状态需为完成");
+
string newtoken="";
Scoped.Request.Value.Create((sp) =>
{