包廂同步 原同步包廂資訊 改全部同步 20250604

This commit is contained in:
allen.yan 2025-06-04 16:39:57 +08:00
parent 42bf78df8c
commit 25652b0f57
4 changed files with 27 additions and 4 deletions

View File

@ -19,6 +19,13 @@ class ExportSqliteFavoriteJob implements ShouldQueue
public $timeout = 600; // 可依資料量調整 timeout 秒數
protected ?int $branchId;
public function __construct(?int $branchId = null)
{
$this->branchId = $branchId;
}
public function handle()
{
$sqlitePath = storage_path('app/database/tempFavorite.sqlite');
@ -57,6 +64,6 @@ class ExportSqliteFavoriteJob implements ShouldQueue
],
],
]);
SendSqliteFileJob::dispatch($sqlitePath);
SendSqliteFileJob::dispatch($sqlitePath, $this->branchId);
}
}

View File

@ -22,6 +22,13 @@ class ExportSqliteSongJob implements ShouldQueue
public $timeout = 600; // 可依資料量調整 timeout 秒數
protected ?int $branchId;
public function __construct(?int $branchId = null)
{
$this->branchId = $branchId;
}
public function handle()
{
$sqlitePath = storage_path('app/database/tempSong.sqlite');
@ -145,6 +152,6 @@ class ExportSqliteSongJob implements ShouldQueue
],
]);
DB::purge($connectionName);
SendSqliteFileJob::dispatch($sqlitePath);
SendSqliteFileJob::dispatch($sqlitePath, $this->branchId);
}
}

View File

@ -21,9 +21,11 @@ class ExportSqliteUserJob implements ShouldQueue
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $timeout = 600; // 可依資料量調整 timeout 秒數
protected ?int $branchId;
public bool $isSend;
public function __construct(bool $isSend = true){
public function __construct(bool $isSend = true,?int $branchId = null){
$this->isSend =$isSend ;
$this->branchId = $branchId;
}
public function handle()
@ -209,7 +211,7 @@ class ExportSqliteUserJob implements ShouldQueue
],
]);
if($this->isSend)
SendSqliteFileJob::dispatch($sqlitePath);
SendSqliteFileJob::dispatch($sqlitePath, $this->branchId);
}
}

View File

@ -4,6 +4,9 @@ namespace App\Livewire\Admin;
use App\Models\Branch;
use App\Jobs\ExportSqliteBranchJob;
use App\Jobs\ExportSqliteUserJob;
use App\Jobs\ExportSqliteSongJob;
use App\Jobs\ExportSqliteFavoriteJob;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
@ -130,6 +133,10 @@ final class BranchTable extends PowerGridComponent
public function synchronous($branch_id): void
{
ExportSqliteBranchJob::dispatch($branch_id);
ExportSqliteSongJob::dispatch($branch_id);
ExportSqliteFavoriteJob::dispatch($branch_id);
ExportSqliteUserJob::dispatch(true,$branch_id);
$this->notification()->send([
'icon' => 'success',
'title' => '分店:'.$branch_id,