love_php/app/Exports/ActiveUserExport.php
2026-04-02 09:20:51 +08:00

48 lines
1.3 KiB
PHP

<?php
namespace App\Exports;
use App\Exports\Sheets\LoveActiveUser;
use App\Exports\Sheets\SaasActiveUser;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
class ActiveUserExport implements WithMultipleSheets
{
protected $start_date, $end_date, $type;
public function __construct($start_date, $end_date, $type)
{
$this->start_date = date('Y-m-d', strtotime($start_date));
$this->end_date = date("Y-m-d", strtotime($end_date));
$this->type = $type;
}
public function sheets(): array
{
if ($this->type) {
if ($this->type == "mp") {
$sheets = [
//福恋用户
new LoveActiveUser($this->start_date,$this->end_date),
];
}else {
$sheets = [
//Saas用户
new SaasActiveUser($this->start_date, $this->end_date),
];
}
}else {
$sheets = [
//福恋用户
new LoveActiveUser($this->start_date,$this->end_date),
//Saas用户
new SaasActiveUser($this->start_date, $this->end_date),
];
}
return $sheets;
}
}