MCPcopy Create free account
hub / github.com/53AI/53AIHub / GetProgress

Method GetProgress

api/controller/batch_upload.go:218–250  ·  view source on GitHub ↗

GetProgress 获取上传进度(轮询方式) @Summary 获取上传进度 @Description 获取批量上传的进度信息 @Tags 批量上传 @Accept json @Produce json @Security BearerAuth @Param batch_id path string true "批次ID" @Param detail query bool false "是否返回详细信息" @Param file_upload_id query string false "查询特定文件" @Param since query int false "增量查询时间戳" @Suc

(c *gin.Context)

Source from the content-addressed store, hash-verified

216// @Failure 500 {object} model.CommonResponse "服务器内部错误"
217// @Router /api/files/upload/batch/{batch_id}/progress [get]
218func (ctrl *BatchUploadController) GetProgress(c *gin.Context) {
219 batchID := c.Param("batch_id")
220
221 var params service.ProgressQueryParams
222 if err := c.ShouldBindQuery(&params); err != nil {
223 c.JSON(http.StatusBadRequest, model.ParamError.ToResponse(err))
224 return
225 }
226
227 // 验证权限
228 batch, err := ctrl.manager.GetBatch(batchID)
229 if err != nil {
230 c.JSON(http.StatusNotFound, model.NotFound.ToResponse(err))
231 return
232 }
233
234 eid := config.GetEID(c)
235 userID := config.GetUserId(c)
236
237 if batch.GetEID() != eid || batch.GetUserID() != userID {
238 c.JSON(http.StatusForbidden, model.AuthFailed.ToResponse(errors.New("无权限查看此批次")))
239 return
240 }
241
242 // 获取进度信息
243 progress, err := ctrl.progressStorage.GetBatchProgress(batchID, &params)
244 if err != nil {
245 c.JSON(http.StatusInternalServerError, model.SystemError.ToResponse(err))
246 return
247 }
248
249 c.JSON(http.StatusOK, model.Success.ToResponse(progress))
250}
251
252// CancelBatch 取消批量上传
253// @Summary 取消批量上传

Callers 1

GetSyncProgressFunction · 0.45

Calls 6

ToResponseMethod · 0.80
GetBatchMethod · 0.80
GetEIDMethod · 0.80
GetUserIDMethod · 0.80
GetBatchProgressMethod · 0.80
NewMethod · 0.45

Tested by

no test coverage detected