20260227-1

This commit is contained in:
cyh666666
2026-02-27 16:51:56 +08:00
1526 changed files with 2457 additions and 38509 deletions

28
fix_merchant_id.py Normal file
View File

@@ -0,0 +1,28 @@
import re
# Read the file
with open('pages/mall/consumer/product-detail.uvue', 'r', encoding='utf-8') as f:
content = f.read()
# Find and replace the selectedItem object
# Looking for the pattern with quantity as the last property
old_pattern = r"(const selectedItem = \{[^}]+quantity: this\.quantity as number)\s*\}"
new_text = r"""\1,
merchant_id: this.product.merchant_id ?? '',
shop_id: this.product.merchant_id ?? '',
shop_name: this.merchant?.shop_name ?? ''
}"""
# Check if pattern exists
if 'quantity: this.quantity as number' in content and 'selectedItem' in content:
content = re.sub(old_pattern, new_text, content, flags=re.DOTALL)
print("Pattern found and replaced!")
else:
print("Pattern not found!")
# Write back
with open('pages/mall/consumer/product-detail.uvue', 'w', encoding='utf-8') as f:
f.write(content)
print("File updated successfully!")