48 lines
1.3 KiB
PHP
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;
|
|
}
|
|
}
|