fix: 修复比特流下载失败的问题
This commit is contained in:
parent
e61cf96c07
commit
a2ac1bcb3b
|
@ -368,11 +368,8 @@ public class ExamController : ControllerBase
|
||||||
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
public IActionResult DeleteCommit(string commitId)
|
public IActionResult DeleteCommit(Guid commitId)
|
||||||
{
|
{
|
||||||
if (!Guid.TryParse(commitId, out _))
|
|
||||||
return BadRequest("提交记录ID格式不正确");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 获取当前用户信息
|
// 获取当前用户信息
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class JtagController : ControllerBase
|
||||||
[ProducesResponseType(typeof(string), StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(typeof(string), StatusCodes.Status400BadRequest)]
|
||||||
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
public IResult DownloadBitstream(string address, int port, string bitstreamId, CancellationToken cancelToken)
|
public IResult DownloadBitstream(string address, int port, Guid bitstreamId, CancellationToken cancelToken)
|
||||||
{
|
{
|
||||||
logger.Info($"User {User.Identity?.Name} initiating bitstream download to device {address}:{port} using bitstream ID: {bitstreamId}");
|
logger.Info($"User {User.Identity?.Name} initiating bitstream download to device {address}:{port} using bitstream ID: {bitstreamId}");
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class ResourceController : ControllerBase
|
||||||
|
|
||||||
var resourceInfo = new ResourceInfo(result.Value);
|
var resourceInfo = new ResourceInfo(result.Value);
|
||||||
|
|
||||||
logger.Info($"成功添加资源: {request.ResourceType}/{request.ResourcePurpose}/{file.FileName}");
|
logger.Info($"成功添加资源: {request.ResourceType}/{request.ResourcePurpose}/{file.FileName} ID: {resourceInfo.ID}");
|
||||||
return CreatedAtAction(nameof(GetResourceById), new { resourceId = resourceInfo.ID }, resourceInfo);
|
return CreatedAtAction(nameof(GetResourceById), new { resourceId = resourceInfo.ID }, resourceInfo);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -187,7 +187,7 @@ public class ResourceController : ControllerBase
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
public IActionResult GetResourceById(string resourceId)
|
public IActionResult GetResourceById(Guid resourceId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -231,7 +231,7 @@ public class ResourceController : ControllerBase
|
||||||
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
public IActionResult DeleteResource(string resourceId)
|
public IActionResult DeleteResource(Guid resourceId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -293,7 +293,7 @@ public class ResourceInfo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源ID
|
/// 资源ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ID { get; set; } = string.Empty;
|
public Guid ID { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源名称
|
/// 资源名称
|
||||||
|
@ -327,7 +327,7 @@ public class ResourceInfo
|
||||||
|
|
||||||
public ResourceInfo(Resource resource)
|
public ResourceInfo(Resource resource)
|
||||||
{
|
{
|
||||||
ID = resource.ID.ToString();
|
ID = resource.ID;
|
||||||
Name = resource.ResourceName;
|
Name = resource.ResourceName;
|
||||||
Type = resource.ResourceType;
|
Type = resource.ResourceType;
|
||||||
Purpose = resource.Purpose;
|
Purpose = resource.Purpose;
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class ResourceManager
|
||||||
var duplicateResource = _db.ResourceTable.Where(r => r.SHA256 == sha256).FirstOrDefault();
|
var duplicateResource = _db.ResourceTable.Where(r => r.SHA256 == sha256).FirstOrDefault();
|
||||||
if (duplicateResource != null && duplicateResource.ResourceName == resourceName)
|
if (duplicateResource != null && duplicateResource.ResourceName == resourceName)
|
||||||
{
|
{
|
||||||
logger.Info($"资源已存在: {resourceName}");
|
logger.Info($"资源已存在: {resourceName}, ID: {duplicateResource.ID}, UserID: {duplicateResource.UserID}");
|
||||||
return duplicateResource;
|
return duplicateResource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,9 +311,9 @@ public class ResourceManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="resourceId">资源ID</param>
|
/// <param name="resourceId">资源ID</param>
|
||||||
/// <returns>资源数据</returns>
|
/// <returns>资源数据</returns>
|
||||||
public Optional<Resource> GetResourceById(string resourceId)
|
public Optional<Resource> GetResourceById(Guid resourceId)
|
||||||
{
|
{
|
||||||
var resource = _db.ResourceTable.Where(r => r.ID.ToString() == resourceId).FirstOrDefault();
|
var resource = _db.ResourceTable.Where(r => r.ID == resourceId).FirstOrDefault();
|
||||||
|
|
||||||
if (resource == null)
|
if (resource == null)
|
||||||
{
|
{
|
||||||
|
@ -330,11 +330,11 @@ public class ResourceManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="resourceId">资源ID</param>
|
/// <param name="resourceId">资源ID</param>
|
||||||
/// <returns>删除的记录数</returns>
|
/// <returns>删除的记录数</returns>
|
||||||
public Result<int> DeleteResource(string resourceId)
|
public Result<int> DeleteResource(Guid resourceId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = _db.ResourceTable.Where(r => r.ID.ToString() == resourceId).Delete();
|
var result = _db.ResourceTable.Where(r => r.ID == resourceId).Delete();
|
||||||
logger.Info($"资源已删除: {resourceId},删除记录数: {result}");
|
logger.Info($"资源已删除: {resourceId},删除记录数: {result}");
|
||||||
return new(result);
|
return new(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ import {
|
||||||
import { ProgressStatus } from "@/utils/signalR/server.Hubs";
|
import { ProgressStatus } from "@/utils/signalR/server.Hubs";
|
||||||
import { useRequiredInjection } from "@/utils/Common";
|
import { useRequiredInjection } from "@/utils/Common";
|
||||||
import { useAlertStore } from "./Alert";
|
import { useAlertStore } from "./Alert";
|
||||||
import { ResourceClient } from "@/APIClient";
|
import { ResourceClient, ResourcePurpose } from "@/APIClient";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
maxMemory?: number;
|
maxMemory?: number;
|
||||||
|
@ -118,7 +118,7 @@ const eqps = useEquipments();
|
||||||
const isUploading = ref(false);
|
const isUploading = ref(false);
|
||||||
const isDownloading = ref(false);
|
const isDownloading = ref(false);
|
||||||
const isProgramming = ref(false);
|
const isProgramming = ref(false);
|
||||||
const availableBitstreams = ref<{ id: number; name: string }[]>([]);
|
const availableBitstreams = ref<{ id: string; name: string }[]>([]);
|
||||||
|
|
||||||
// Progress
|
// Progress
|
||||||
const downloadTaskId = ref("");
|
const downloadTaskId = ref("");
|
||||||
|
@ -180,7 +180,7 @@ async function loadAvailableBitstreams() {
|
||||||
const resources = await resourceClient.getResourceList(
|
const resources = await resourceClient.getResourceList(
|
||||||
props.examId,
|
props.examId,
|
||||||
"bitstream",
|
"bitstream",
|
||||||
"template",
|
ResourcePurpose.Template,
|
||||||
);
|
);
|
||||||
availableBitstreams.value =
|
availableBitstreams.value =
|
||||||
resources.map((r) => ({ id: r.id, name: r.name })) || [];
|
resources.map((r) => ({ id: r.id, name: r.name })) || [];
|
||||||
|
@ -192,7 +192,7 @@ async function loadAvailableBitstreams() {
|
||||||
|
|
||||||
// 下载示例比特流
|
// 下载示例比特流
|
||||||
async function downloadExampleBitstream(bitstream: {
|
async function downloadExampleBitstream(bitstream: {
|
||||||
id: number;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
}) {
|
}) {
|
||||||
if (isDownloading.value) return;
|
if (isDownloading.value) return;
|
||||||
|
@ -229,7 +229,7 @@ async function downloadExampleBitstream(bitstream: {
|
||||||
|
|
||||||
// 直接烧录示例比特流
|
// 直接烧录示例比特流
|
||||||
async function programExampleBitstream(bitstream: {
|
async function programExampleBitstream(bitstream: {
|
||||||
id: number;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
}) {
|
}) {
|
||||||
if (isProgramming.value) return;
|
if (isProgramming.value) return;
|
||||||
|
@ -275,7 +275,7 @@ async function handleClick(event: Event): Promise<void> {
|
||||||
if (!checkFile(bitstream.value)) return;
|
if (!checkFile(bitstream.value)) return;
|
||||||
|
|
||||||
isUploading.value = true;
|
isUploading.value = true;
|
||||||
let uploadedBitstreamId: number | null = null;
|
let uploadedBitstreamId: string | null = null;
|
||||||
try {
|
try {
|
||||||
console.log("开始上传比特流文件:", bitstream.value.name);
|
console.log("开始上传比特流文件:", bitstream.value.name);
|
||||||
const bitstreamId = await eqps.jtagUploadBitstream(
|
const bitstreamId = await eqps.jtagUploadBitstream(
|
||||||
|
|
Loading…
Reference in New Issue