时里院子市集
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

57 lines
1.7 KiB

#!/bin/bash
# 批量修复所有API文件的导入问题
# 将 import request from '@/utils/request'; 替换为 import request from '@/utils/request-legacy';
echo "🚀 开始批量修复API文件导入..."
# 需要更新的文件列表
files=(
"src/api/cms/cmsModel/index.ts"
"src/api/cms/cmsArticle/index.ts"
"src/api/cms/cmsSpecValue/index.ts"
"src/api/cms/cmsSpec/index.ts"
"src/api/cms/cmsOrder/index.ts"
"src/api/system/payment/index.ts"
"src/api/shop/shopGoodsSku/index.ts"
"src/api/system/tenant/index.ts"
"src/api/shop/shopGoodsCategory/index.ts"
"src/api/shop/shopGift/index.ts"
"src/api/system/plug/index.ts"
"src/api/system/environment/index.ts"
"src/api/system/url/index.ts"
"src/api/system/file/index.ts"
"src/api/system/dict-data/index.ts"
"src/api/system/dictionary-data/index.ts"
"src/api/system/operation-record/index.ts"
"src/api/system/user-file/index.ts"
"src/api/system/white-domain/index.ts"
"src/api/system/menu/index.ts"
)
updated_count=0
total_count=${#files[@]}
for file in "${files[@]}"; do
if [ -f "$file" ]; then
# 检查文件是否包含目标导入
if grep -q "import request from '@/utils/request';" "$file"; then
# 执行替换
sed -i '' "s|import request from '@/utils/request';|import request from '@/utils/request-legacy';|g" "$file"
echo "✅ 已更新: $file"
((updated_count++))
else
echo "⏭️ 跳过: $file (未找到目标导入)"
fi
else
echo "❌ 文件不存在: $file"
fi
done
echo ""
echo "📊 更新完成:"
echo " 总文件数: $total_count"
echo " 已更新: $updated_count"
echo " 跳过: $((total_count - updated_count))"
echo ""
echo "🎉 所有API文件导入已修复!"