feat: 复用颜色映射生成完整采购规格 (#295)
This commit is contained in:
@@ -332,6 +332,25 @@ func ListShopeePddLinksByGoodsIDs(q Execer, goodsIDs []string) (map[string]strin
|
||||
return links, nil
|
||||
}
|
||||
|
||||
// ListShopeeGoodsIDsByPddGoodsID 返回当前仍关联指定 PDD 商品的蝦皮商品。
|
||||
func ListShopeeGoodsIDsByPddGoodsID(q Execer, pddGoodsID string) ([]string, error) {
|
||||
rows, err := q.Query(`SELECT goods_id FROM shopee_products
|
||||
WHERE pdd_goods_id=? AND deleted_at IS NULL ORDER BY goods_id`, pddGoodsID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("查询 PDD 商品 %s 的蝦皮关联失败: %w", pddGoodsID, err)
|
||||
}
|
||||
defer rows.Close()
|
||||
var result []string
|
||||
for rows.Next() {
|
||||
var goodsID string
|
||||
if err := rows.Scan(&goodsID); err != nil {
|
||||
return nil, fmt.Errorf("读取 PDD 商品的蝦皮关联失败: %w", err)
|
||||
}
|
||||
result = append(result, goodsID)
|
||||
}
|
||||
return result, rows.Err()
|
||||
}
|
||||
|
||||
// UpdateShopeePddLink 更新蝦皮商品当前关联的 PDD 商品。
|
||||
// 调用方必须先在同一事务里保证 PDD 商品存在,避免留下悬空关联。
|
||||
func UpdateShopeePddLink(q Execer, shopeeGoodsID, pddGoodsID, pddURL string) error {
|
||||
|
||||
Reference in New Issue
Block a user