增强跨盘秒传可复选

This commit is contained in:
King committed 2026-07-30 17:09:53 +08:00
1 parent 4cffa98fb5
commit 78efa1cfad
167 files changed
+485 -101

No files matched your search

+32 -8
View File
@@ -18,10 +18,35 @@ func (h *Handler) crossTransferRoutes(w http.ResponseWriter, r *http.Request) {
} }
type crossTransferScanReq struct { type crossTransferScanReq struct {
SourceAccountID int64 `json:"source_account_id"` SourceAccountID int64 `json:"source_account_id"`
SourceParentID string `json:"source_parent_id"` SourceParentID string `json:"source_parent_id"`
Method string `json:"method"` Method string `json:"method"`
SourceDisplayPath string `json:"source_display_path"` SourceDisplayPath string `json:"source_display_path"`
Sources []crossTransferScanSource `json:"sources"`
}
type crossTransferScanSource struct {
ParentID string `json:"parent_id"`
DisplayPath string `json:"display_path"`
AncestorIDs []string `json:"ancestor_ids"`
}
func (r crossTransferScanReq) roots() []crosstransfer.ScanRoot {
if len(r.Sources) == 0 {
return []crosstransfer.ScanRoot{{
ParentID: r.SourceParentID,
DisplayPath: r.SourceDisplayPath,
}}
}
roots := make([]crosstransfer.ScanRoot, 0, len(r.Sources))
for _, source := range r.Sources {
roots = append(roots, crosstransfer.ScanRoot{
ParentID: source.ParentID,
DisplayPath: source.DisplayPath,
AncestorIDs: source.AncestorIDs,
})
}
return roots
} }
func (h *Handler) crossTransferScan(w http.ResponseWriter, r *http.Request) { func (h *Handler) crossTransferScan(w http.ResponseWriter, r *http.Request) {
@@ -33,7 +58,7 @@ func (h *Handler) crossTransferScan(w http.ResponseWriter, r *http.Request) {
writeErr(w, err) writeErr(w, err)
return return
} }
result, err := h.crossTransfer.ScanSource(r.Context(), req.SourceAccountID, req.SourceParentID, req.Method, req.SourceDisplayPath) result, err := h.crossTransfer.ScanSources(r.Context(), req.SourceAccountID, req.roots(), req.Method)
if err != nil { if err != nil {
writeErr(w, err) writeErr(w, err)
return return
@@ -51,12 +76,11 @@ func (h *Handler) crossTransferScanStream(w http.ResponseWriter, r *http.Request
return return
} }
h.streamCrossTransferNDJSON(w, r, func(emit func(crosstransfer.StreamEvent) error) error { h.streamCrossTransferNDJSON(w, r, func(emit func(crosstransfer.StreamEvent) error) error {
return h.crossTransfer.ScanSourceStream( return h.crossTransfer.ScanSourcesStream(
r.Context(), r.Context(),
req.SourceAccountID, req.SourceAccountID,
req.SourceParentID, req.roots(),
req.Method, req.Method,
req.SourceDisplayPath,
emit, emit,
) )
}) })
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loaded 100 of 167 files, more files were not shown because too many files have changed in this diff. Show more