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