mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 18:29:19 +08:00
feat(ecom): 订单管理新增批量删除功能
- OrderServiceImpl 新增 deleteOrders 批量删除接口,单次最多500条 - 新增 BatchDeleteOrderDTO 参数校验 - 前端订单列表新增勾选框,支持批量删除选中订单 - OssServiceImpl 简化上传逻辑,移除冗余代码 - 更新 OSS 凭证配置
This commit is contained in:
@@ -65,18 +65,34 @@ async function uploadFileToOssWithHeaderSignature(
|
||||
uploadUrl: string,
|
||||
uploadHeaders: Record<string, string>,
|
||||
): Promise<void> {
|
||||
const headers: Record<string, string> = {
|
||||
...uploadHeaders,
|
||||
};
|
||||
const headers: Record<string, string> = { ...uploadHeaders };
|
||||
const contentType =
|
||||
headers['Content-Type'] ?? headers['content-type'] ?? '';
|
||||
|
||||
// OSS4 预签名 PUT 与 Content-Type 严格一致;File 作 body 时浏览器会按 file.type 自动带头,易 403。
|
||||
const body =
|
||||
contentType !== '' ? await file.arrayBuffer() : file;
|
||||
if (contentType !== '') {
|
||||
headers['Content-Type'] = contentType;
|
||||
delete headers['content-type'];
|
||||
}
|
||||
|
||||
const response = await fetch(uploadUrl, {
|
||||
method: 'PUT',
|
||||
body: file,
|
||||
body,
|
||||
headers,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`上传失败: ${response.status} ${response.statusText}`);
|
||||
let detail = '';
|
||||
try {
|
||||
detail = (await response.text()).slice(0, 300);
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
throw new Error(
|
||||
`上传失败: ${response.status} ${response.statusText}${detail ? ` — ${detail}` : ''}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user