fix(发布与账号): 修复虚拟铺货和删除任务体验

- 虚拟商品发布跳过地址查询与地址字段,避免被默认地址校验拦截。
- 取消批量铺货后保留上传图片,支持失败项重试并按过期策略清理。
- 优化账号删除的确认弹窗、进度反馈与后台停止逻辑,避免误删和页面卡顿。
This commit is contained in:
Christ committed 2026-07-25 18:37:30 +08:00
1 parent 7fd11106af
commit fd30a0d17a
14 files changed
+278 -57

No files matched your search

+12 -1
View File
@@ -9,6 +9,7 @@ import (
"mime/multipart"
"net/http"
"net/http/httptest"
"os"
"strings"
"testing"
"time"
@@ -218,7 +219,7 @@ func TestRunItemPublishBatch_FailureMarksRowFailed(t *testing.T) {
}
func TestCancelItemPublishBatchMarksUnfinishedRowsFailed(t *testing.T) {
srv, _, cleanup := newTestServer(t)
srv, store, cleanup := newTestServer(t)
defer cleanup()
srv.MTop = withMTopTransport(roundTripFunc(func(req *http.Request) (*http.Response, error) {
select {
@@ -279,6 +280,16 @@ func TestCancelItemPublishBatchMarksUnfinishedRowsFailed(t *testing.T) {
if got["failed"] != got["total"] {
t.Fatalf("取消后未完成行应全部失败: total=%v failed=%v body=%+v", got["total"], got["failed"], got)
}
batch, err := store.PublishBatches.Get(context.Background(), 1, batchID)
if err != nil {
t.Fatal(err)
}
if strings.TrimSpace(batch.UploadDir) == "" {
t.Fatal("取消运行中的任务后应保留 upload_dir 供失败项重试")
}
if _, err := os.Stat(batch.UploadDir); err != nil {
t.Fatalf("取消运行中的任务后应保留图片目录: %v", err)
}
}
// TestRunItemPublishBatch_Success 启动批次,mock mtop 全程返回 SUCCESS,验证行最终成功。