feat: 支持蝦皮批量创建 PDD 采集任务 (#185)
This commit is contained in:
+12
-4
@@ -543,9 +543,11 @@ func DeletePddProducts(db *sql.DB, goodsIDs []string) (int64, error) {
|
||||
type CollectTaskResult struct {
|
||||
Created int
|
||||
|
||||
SkippedCollecting int // 正在采集且**没超时**,得等客户端来领/提交
|
||||
SkippedCollected int // 已经采集完成,本来就不需要重新采集
|
||||
SkippedDeleted int // 商品不存在或已被软删除
|
||||
SkippedShopeeMissing int // 浏览器提交的蝦皮商品已不存在
|
||||
SkippedUnlinked int // 蝦皮商品尚未关联 PDD
|
||||
SkippedCollecting int // 正在采集且**没超时**,得等客户端来领/提交
|
||||
SkippedCollected int // 已经采集完成,本来就不需要重新采集
|
||||
SkippedDeleted int // 商品不存在或已被软删除
|
||||
|
||||
// RetryWaitText 是 SkippedCollecting 里最快能重试的还需等待时长,
|
||||
// 形如 "12 分钟";SkippedCollecting 为 0 时是空串。
|
||||
@@ -555,7 +557,7 @@ type CollectTaskResult struct {
|
||||
// Skipped 是跳过总数,供测试和粗粒度统计用;
|
||||
// 界面提示要按原因分开说,见 FormatCollectTaskMessage,不要直接显示这个数。
|
||||
func (r CollectTaskResult) Skipped() int {
|
||||
return r.SkippedCollecting + r.SkippedCollected + r.SkippedDeleted
|
||||
return r.SkippedShopeeMissing + r.SkippedUnlinked + r.SkippedCollecting + r.SkippedCollected + r.SkippedDeleted
|
||||
}
|
||||
|
||||
// CreatePddCollectTasks 为勾选的 PDD 商品创建不指定客户端的采集任务。
|
||||
@@ -784,6 +786,12 @@ func formatRetryWait(remain time.Duration) string {
|
||||
// (比如还要等多久),见 #24。
|
||||
func FormatCollectTaskMessage(r CollectTaskResult) string {
|
||||
var reasons []string
|
||||
if r.SkippedShopeeMissing > 0 {
|
||||
reasons = append(reasons, fmt.Sprintf("%d 个蝦皮商品已不存在", r.SkippedShopeeMissing))
|
||||
}
|
||||
if r.SkippedUnlinked > 0 {
|
||||
reasons = append(reasons, fmt.Sprintf("%d 个未关联 PDD", r.SkippedUnlinked))
|
||||
}
|
||||
if r.SkippedCollecting > 0 {
|
||||
reason := fmt.Sprintf("%d 个正在采集中", r.SkippedCollecting)
|
||||
if r.Created > 0 {
|
||||
|
||||
Reference in New Issue
Block a user