add /export/all-customers-info-for-lark-system

This commit is contained in:
Edmond Lang
2025-06-13 00:21:44 +08:00
parent ce9808205a
commit 8c1df85e66
5 changed files with 263 additions and 0 deletions
@@ -24,6 +24,7 @@ use App\Classes\Modules\Exports\Services\ExportsImportedReceiptMappeds;
use App\Classes\Modules\Exports\Services\ExportsWhiteFormTransactions;
use Illuminate\Support\Facades\Storage;
use App\Classes\General\AWSS3Helper;
use App\Classes\Modules\Exports\Services\ExportsAllCustomersInfoForLarkSystem;
use Illuminate\Support\Carbon;
class ExportCustomersToExcelController
@@ -241,5 +242,25 @@ class ExportCustomersToExcelController
return $response;
}
}
public function exportAllCustomersInfoForLarkSystem(Request $request)
{
$password = $request->input('password');
if ($password !== 'all_customers_data') {
return response()->json(['error' => 'Invalid password'], 403);
}
$exportsAllCustomersInfoForLarkSystem = new ExportsAllCustomersInfoForLarkSystem($request);
$exportFileName = 'all_customers_info_for_lark_system.xls';
$filesystemDriver = Storage::getDefaultDriver();
if ($filesystemDriver === 's3') {
return response(['src' => AWSS3Helper::S3Exportable($exportFileName, $exportsAllCustomersInfoForLarkSystem)]);
} else {
$response = $exportsAllCustomersInfoForLarkSystem->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
return $response;
}
}
}