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

This commit is contained in:
Edmond Lang
2025-06-12 22:18:53 +08:00
parent 844527417a
commit d6cfd85aa2
3 changed files with 79 additions and 0 deletions
@@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Excel;
use Illuminate\Support\Facades\Storage;
use App\Classes\General\AWSS3Helper;
use App\Classes\Modules\Exports\Services\ExportsAllCustomersInfoForLarkSystem;
use App\Classes\Modules\Exports\Services\ExportsSegmentCustomers;
use App\Models\Segment;
@@ -77,4 +78,24 @@ class ExportCompanyModuleSummaryController
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;
}
}
}