157 lines
7.1 KiB
PHP
157 lines
7.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\PrintPlugin;
|
|
use App\Models\PrintPluginVersion;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class PrintPluginSeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
$plugins = [
|
|
[
|
|
'code' => 'cainiao',
|
|
'name' => '菜鸟打印插件',
|
|
'platform' => 'cainiao',
|
|
'version' => '2.5.8',
|
|
'download_url' => 'http://localhost:5174/plugins/cainiao-install.bat',
|
|
'md5' => 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6',
|
|
'file_size' => 45875200,
|
|
'changelog' => "2.5.8 (2026-03-20)\n- 优化打印队列处理速度\n- 修复特定打印机掉线问题\n- 新增云端模板同步\n\n2.5.7 (2026-03-15)\n- 修复win11兼容性问题\n- 增加错误日志上报",
|
|
'min_erp_version' => '1.0.0',
|
|
'status' => 'active',
|
|
'install_type' => 'exe',
|
|
'config' => [
|
|
'update_check_url' => 'https://print.cainiao.com/api/version',
|
|
'api_endpoint' => 'https://print.cainiao.com/api',
|
|
'heartbeat_interval' => 30,
|
|
],
|
|
'published_at' => '2026-03-20',
|
|
],
|
|
[
|
|
'code' => 'pdd',
|
|
'name' => '拼多多打印插件',
|
|
'platform' => 'pdd',
|
|
'version' => '1.8.3',
|
|
'download_url' => 'https://erp.pdd.com/plugin/pdd-print-setup.exe',
|
|
'md5' => 'b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7',
|
|
'file_size' => 38797312,
|
|
'changelog' => "1.8.3 (2026-03-18)\n- 支持拼多多新版面单格式\n- 优化批量打印性能\n- 修复订单同步延迟问题\n\n1.8.2 (2026-03-10)\n- 新增多店铺同时登录\n- 增加打印异常自动重试",
|
|
'min_erp_version' => '1.0.0',
|
|
'status' => 'active',
|
|
'install_type' => 'exe',
|
|
'config' => [
|
|
'update_check_url' => 'https://erp.pdd.com/api/plugin/version',
|
|
'api_endpoint' => 'https://erp.pdd.com/api/print',
|
|
'heartbeat_interval' => 30,
|
|
],
|
|
'published_at' => '2026-03-18',
|
|
],
|
|
[
|
|
'code' => 'douyin',
|
|
'name' => '抖音小店打印插件',
|
|
'platform' => 'douyin',
|
|
'version' => '3.2.1',
|
|
'download_url' => 'https://partner.douyin.com/plugin/douyin-print.exe',
|
|
'md5' => 'c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8',
|
|
'file_size' => 42504248,
|
|
'changelog' => "3.2.1 (2026-03-22)\n- 支持抖音即时零售面单\n- 新增异常件处理功能\n- 优化打印预览效果\n\n3.2.0 (2026-03-15)\n- 重构打印队列引擎\n- 支持模板自定义",
|
|
'min_erp_version' => '1.2.0',
|
|
'status' => 'active',
|
|
'install_type' => 'exe',
|
|
'config' => [
|
|
'update_check_url' => 'https://partner.douyin.com/api/plugin/check',
|
|
'api_endpoint' => 'https://partner.douyin.com/api/print',
|
|
'heartbeat_interval' => 30,
|
|
],
|
|
'published_at' => '2026-03-22',
|
|
],
|
|
[
|
|
'code' => 'kuaishou',
|
|
'name' => '快手小店打印插件',
|
|
'platform' => 'kuaishou',
|
|
'version' => '2.1.5',
|
|
'download_url' => 'https://print.kuaishou.com/plugin/kuaishou-print.exe',
|
|
'md5' => 'd4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9',
|
|
'file_size' => 35241984,
|
|
'changelog' => "2.1.5 (2026-03-16)\n- 修复快手面单打印问题\n- 提升启动速度\n- 增加离线缓存功能\n\n2.1.4 (2026-03-08)\n- 支持批量打印\n- 增加打印统计",
|
|
'min_erp_version' => '1.1.0',
|
|
'status' => 'active',
|
|
'install_type' => 'exe',
|
|
'config' => [
|
|
'update_check_url' => 'https://print.kuaishou.com/api/version',
|
|
'api_endpoint' => 'https://print.kuaishou.com/api',
|
|
'heartbeat_interval' => 30,
|
|
],
|
|
'published_at' => '2026-03-16',
|
|
],
|
|
[
|
|
'code' => 'kuaimai',
|
|
'name' => '快麦打印机驱动',
|
|
'platform' => 'kuaimai',
|
|
'version' => '5.0.2',
|
|
'download_url' => 'https://driver.kuaimai.com/plugin/km-driver.exe',
|
|
'md5' => 'e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0',
|
|
'file_size' => 52100352,
|
|
'changelog' => "5.0.2 (2026-03-19)\n- 支持新款快麦打印机M450\n- 优化驱动兼容性\n- 增加远程固件升级\n\n5.0.1 (2026-03-12)\n- 修复USB连接断开问题",
|
|
'min_erp_version' => '1.0.0',
|
|
'status' => 'active',
|
|
'install_type' => 'exe',
|
|
'config' => [
|
|
'update_check_url' => 'https://driver.kuaimai.com/api/check',
|
|
'api_endpoint' => 'https://driver.kuaimai.com/api',
|
|
'heartbeat_interval' => 60,
|
|
],
|
|
'published_at' => '2026-03-19',
|
|
],
|
|
[
|
|
'code' => 'feiyun',
|
|
'name' => '飞鹅打印机插件',
|
|
'platform' => 'feiyun',
|
|
'version' => '1.6.8',
|
|
'download_url' => 'https://print.feiyun.com/plugin/feiyun-setup.exe',
|
|
'md5' => 'f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1',
|
|
'file_size' => 29360128,
|
|
'changelog' => "1.6.8 (2026-03-14)\n- 支持飞鹅K5系列打印机\n- 优化网络打印稳定性\n\n1.6.7 (2026-03-05)\n- 修复小票打印格式问题",
|
|
'min_erp_version' => '1.0.0',
|
|
'status' => 'active',
|
|
'install_type' => 'exe',
|
|
'config' => [
|
|
'update_check_url' => 'https://print.feiyun.com/api/version',
|
|
'api_endpoint' => 'https://print.feiyun.com/api',
|
|
'heartbeat_interval' => 30,
|
|
],
|
|
'published_at' => '2026-03-14',
|
|
],
|
|
];
|
|
|
|
foreach ($plugins as $pluginData) {
|
|
$config = $pluginData['config'] ?? [];
|
|
unset($pluginData['config']);
|
|
|
|
$plugin = PrintPlugin::updateOrCreate(
|
|
['code' => $pluginData['code']],
|
|
$pluginData
|
|
);
|
|
|
|
// 添加版本历史
|
|
PrintPluginVersion::updateOrCreate(
|
|
['plugin_id' => $plugin->id, 'version' => $plugin->version],
|
|
[
|
|
'download_url' => $plugin->download_url,
|
|
'md5' => $plugin->md5,
|
|
'file_size' => $plugin->file_size,
|
|
'changelog' => $plugin->changelog,
|
|
'min_erp_version' => $plugin->min_erp_version,
|
|
'published_at' => $plugin->published_at,
|
|
]
|
|
);
|
|
|
|
// 更新config
|
|
$plugin->update(['config' => $config]);
|
|
}
|
|
}
|
|
}
|