/** * 初始化Rola-IP代理平台数据 * 为系统添加Rola-IP平台配置示例 */ const sequelize = require('./src/config/sequelize') const MProxyPlatform = require('./src/modes/MProxyPlatform') async function initRolaIPPlatform() { try { console.log('开始初始化Rola-IP代理平台数据...') // 检查是否已存在Rola-IP平台配置 const existingPlatform = await MProxyPlatform.findOne({ where: { platform: 'rola-ip' } }) if (existingPlatform) { console.log('Rola-IP平台配置已存在,跳过初始化') return } // 创建Rola-IP平台配置示例 const rolaipConfig = { platform: 'rola-ip', displayName: 'Rola-IP代理平台', description: '专业代理IP服务平台,支持住宅IP、数据中心IP、移动IP等多种类型', apiUrl: 'https://admin.rola-ip.co', authType: 'userPass', username: '', // 需要用户填写 password: '', // 需要用户填写 apiKey: '', token: '', proxyTypes: 'residential,datacenter,mobile,static_residential,ipv6', countries: 'US,UK,DE,FR,JP,KR,AU,CA,BR,IN,SG,HK,TW,RU,NL', concurrentLimit: 100, rotationInterval: 300, // 5分钟 connectionTimeout: 30000, retryCount: 3, remark: '支持多种代理类型和15个国家/地区,提供住宅IP、数据中心IP、移动IP、静态住宅IP和IPv6代理服务', isEnabled: false, // 默认禁用,需要用户配置后启用 createdAt: new Date(), updatedAt: new Date() } await MProxyPlatform.create(rolaipConfig) console.log('✅ Rola-IP代理平台初始化完成') console.log('📝 平台信息:') console.log(` - 平台名称: ${rolaipConfig.displayName}`) console.log(` - API地址: ${rolaipConfig.apiUrl}`) console.log(` - 支持类型: ${rolaipConfig.proxyTypes}`) console.log(` - 支持地区: ${rolaipConfig.countries}`) console.log('⚠️ 注意: 需要在前端界面配置用户名和密码后启用') } catch (error) { console.error('❌ 初始化Rola-IP平台数据失败:', error.message) throw error } } // 如果直接运行此脚本 if (require.main === module) { initRolaIPPlatform() .then(() => { console.log('🎉 Rola-IP平台初始化脚本执行完成') process.exit(0) }) .catch((error) => { console.error('💥 初始化脚本执行失败:', error) process.exit(1) }) } module.exports = initRolaIPPlatform