# 合并尼龙刷轮的三个套件型号,并删除重复产品记录。 $login = @{ username = 'admin'; password = 'Shoplix@2026' } | ConvertTo-Json Invoke-RestMethod -Method Post -Uri 'http://localhost:8081/api/admin/v1/auth/login' -ContentType 'application/json' -Body $login -SessionVariable adminSession | Out-Null $productContent = @'
This nylon brush wheel kit is available with three adapter and fixing kit options: HY-047, HY-048 and HY-049. It is designed for garden maintenance, brush cutter accessory sourcing and replacement-part distribution.
Please confirm the required kit option, machine compatibility, mounting dimensions, quantity, packaging and branding requirements before ordering. OEM and wholesale inquiries are welcome.
'@ $saveBody = @{ productCode = 'PRD0089E12MHRYF4' siteCode = 'SIT0000000000001' primaryCategoryCode = 'PCT0089DGXVJZDVK' productName = 'Nylon Brush Wheel Kit' slug = 'nylon-brush-wheel-kit' model = 'HY-047 / HY-048 / HY-049' summary = 'Nylon brush wheel supplied with three adapter and fixing kit options for garden maintenance and brush cutter accessory sourcing.' productContent = $productContent contentTemplateCode = '' templatePosition = 'AFTER' coverMediaCode = 'MED0089DZO2RZW1S' images = @( @{ mediaCode = 'MED0089DZO2RZW1S'; sortNo = 0 }, @{ mediaCode = 'MED0089DZO5MDQ80'; sortNo = 1 }, @{ mediaCode = 'MED0089DZO8EW54W'; sortNo = 2 } ) featured = $false inquiryEnabled = $true sortNo = 47 status = 'PUBLISHED' attributes = @( @{ attributeCode = 'PAT0083ZKZ1VM3UO'; attributeName = 'Model'; value = 'HY-047 / HY-048 / HY-049'; unit = ''; sortNo = 1 }, @{ attributeCode = 'PAT0089C84SCSJY8'; attributeName = 'Product Type'; value = 'Nylon Brush Wheel Kit'; unit = ''; sortNo = 2 }, @{ attributeCode = 'PAT0089C84W1RNCW'; attributeName = 'Color'; value = 'Orange'; unit = ''; sortNo = 3 }, @{ attributeCode = 'PAT0083ZKZ1XHJ40'; attributeName = 'Material'; value = 'Nylon / Metal'; unit = ''; sortNo = 4 }, @{ attributeCode = $null; attributeName = 'Kit Options'; value = '8-Piece Adapter Kit; 4-Piece Fixing Kit; Stihl-Style 4-Piece Kit'; unit = ''; sortNo = 5 } ) specifications = @( @{ groupName = 'Kit Options'; name = 'HY-047'; value = '8-Piece Adapter Kit'; unit = ''; sortNo = 1 }, @{ groupName = 'Kit Options'; name = 'HY-048'; value = '4-Piece Fixing Kit'; unit = ''; sortNo = 2 }, @{ groupName = 'Kit Options'; name = 'HY-049'; value = 'Stihl-Style 4-Piece Kit'; unit = ''; sortNo = 3 }, @{ groupName = 'Material'; name = 'Primary Material'; value = 'Nylon / Metal'; unit = ''; sortNo = 4 }, @{ groupName = 'Appearance'; name = 'Color'; value = 'Orange'; unit = ''; sortNo = 5 } ) } | ConvertTo-Json -Depth 10 $saved = Invoke-RestMethod -Method Post -Uri 'http://localhost:8081/api/admin/v1/products/save' -ContentType 'application/json' -Body $saveBody -WebSession $adminSession if ($saved.productCode -ne 'PRD0089E12MHRYF4') { throw '合并后的产品保存失败,未删除原产品。' } foreach ($productCode in @('PRD0089E13JUANLS', 'PRD0089E14JAZ9C0')) { $deleteBody = @{ siteCode = 'SIT0000000000001'; productCode = $productCode } | ConvertTo-Json Invoke-RestMethod -Method Post -Uri 'http://localhost:8081/api/admin/v1/products/delete' -ContentType 'application/json' -Body $deleteBody -WebSession $adminSession | Out-Null } Write-Output $saved.productCode