|
...
|
...
|
@@ -25,6 +25,7 @@ use App\Models\Template\Template; |
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
|
|
|
|
|
|
|
class LyhImportTest extends Command
|
|
|
|
{
|
|
...
|
...
|
@@ -52,15 +53,41 @@ class LyhImportTest extends Command |
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
ProjectServer::useProject(3531);
|
|
|
|
echo date('Y-m-d H:i:s') . 'start->3531' . PHP_EOL;
|
|
|
|
// $this->importProductCategory('https://ecdn6-nc.globalso.com/upload/p/3654/file/2025-06/products-1.csv',3654);
|
|
|
|
$this->import3531CustomModule(3531);
|
|
|
|
ProjectServer::useProject(1517);
|
|
|
|
echo date('Y-m-d H:i:s') . 'start->1517' . PHP_EOL;
|
|
|
|
$url1 = 'https://ecdn6.globalso.com/upload/p/1517/file/2025-10/horse-racing-tkd-modification-1.xlsx';//改tdk
|
|
|
|
$url2 = 'https://v6-file.globalso.com/upload/p/1517/file/2025-10/horse-racing-url-modification.xlsx';//改url路由+tdk
|
|
|
|
$this->download_1517_action($url1);
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :导入
|
|
|
|
* @name :download_1517_action
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/10/22 16:47
|
|
|
|
*/
|
|
|
|
public function download_1517_action($url)
|
|
|
|
{
|
|
|
|
// 下载到 Laravel storage 的临时路径
|
|
|
|
$tempPath = storage_path('app/temp_url.xlsx');
|
|
|
|
file_put_contents($tempPath, file_get_contents($url));
|
|
|
|
// 载入 Excel
|
|
|
|
try {
|
|
|
|
$spreadsheet = IOFactory::load($tempPath);
|
|
|
|
$sheet = $spreadsheet->getActiveSheet();
|
|
|
|
$rows = $sheet->toArray();
|
|
|
|
unlink($tempPath);
|
|
|
|
dd($rows);
|
|
|
|
}catch (\Exception $e){
|
|
|
|
echo '文件打不开'.PHP_EOL;
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :3951项目导入产品
|
|
|
|
* @name :import3951Product
|
|
|
|
* @author :lyh
|
...
|
...
|
|