style: 优化蝦皮列表关键信息展示 (#214)

This commit is contained in:
chengma
2026-08-13 12:07:27 +08:00
parent 121b12ac41
commit 5b7d92289e
6 changed files with 22 additions and 17 deletions
+5 -3
View File
@@ -37,8 +37,10 @@ type ShopeeProductView struct {
PendingCount int
SourceText string
// PddURL 为空且 PddMissing 为 true 时,模板显示"未填写"并标红——
// 这是最需要操作员注意的状态,见 §4.2。
// 列表正文只显示稳定、短小的 PDD 商品 ID,完整 URL 留在 title 中。
// PddMissing 为 true 时模板显示"未填写"并标红——这是最需要操作员
// 注意的状态,见 §4.2。
PddGoodsID string
PddURL string
PddMissing bool
@@ -123,9 +125,9 @@ func ListShopeeProducts(db *sql.DB, filter repository.ShopeeFilter, page int) (*
if r.PddGoodsID == "" {
v.PddMissing = true
v.PddURL = "未填写"
v.StatusText = "未填链接"
} else {
v.PddGoodsID = r.PddGoodsID
v.PddURL = r.PddGoodsURL
if r.CollectStatus.Valid {
v.StatusText = collectStatusText(model.CollectStatus(r.CollectStatus.String))
+5 -2
View File
@@ -193,8 +193,8 @@ func TestListShopeeProducts_PDD链接未填写(t *testing.T) {
t.Fatalf("查询失败: %v", err)
}
row := result.Rows[0]
if !row.PddMissing || row.PddURL != "未填写" {
t.Errorf("PddMissing/PddURL = %v/%q,想要 true/\"未填写\"", row.PddMissing, row.PddURL)
if !row.PddMissing || row.PddGoodsID != "" || row.PddURL != "" {
t.Errorf("未关联 PDD 视图错误:%+v", row)
}
if row.StatusText != "未填链接" {
t.Errorf("StatusText = %q,想要 \"未填链接\"", row.StatusText)
@@ -221,6 +221,9 @@ func TestListShopeeProducts_采集状态联查(t *testing.T) {
if row.PddMissing {
t.Error("已填链接,PddMissing 应为 false")
}
if row.PddGoodsID != "9001" || row.PddURL != "https://mobile.yangkeduo.com/goods.html?goods_id=9001" {
t.Errorf("PDD 商品 ID/完整链接错误:%q/%q", row.PddGoodsID, row.PddURL)
}
if row.StatusText != "已采集" {
t.Errorf("StatusText = %q,想要 \"已采集\"", row.StatusText)
}