45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Exporters;
|
|
|
|
use App\Models\User;
|
|
use Encore\Admin\Grid\Exporters\ExcelExporter;
|
|
use Maatwebsite\Excel\Concerns\WithMapping;
|
|
|
|
class AccountLog extends ExcelExporter implements WithMapping
|
|
{
|
|
protected $fileName = '佣金明细.xlsx';
|
|
protected $headings = [
|
|
'序号',
|
|
'用户编号',
|
|
'用户账号',
|
|
'用户名称',
|
|
'佣金名称',
|
|
'佣金金额',
|
|
'佣金描述',
|
|
'产生时间',
|
|
];
|
|
|
|
public function __construct()
|
|
{
|
|
$this->fileName = '佣金明细' . date('YmdHis') . '.xlsx';
|
|
}
|
|
|
|
public function map($info): array
|
|
{
|
|
$data = [
|
|
'id' => (string) $info->id,
|
|
'user_id' => (string) $info->user_id,
|
|
'username' => '`' . $info->user->username,
|
|
'nickname' => (string) $info->userinfo->nickname,
|
|
'title' => (string) $info->rule->title,
|
|
'variable' => (string) $info->variable,
|
|
'remark' => (string) $info->rule->remark,
|
|
'created_at' => (string) $info->created_at,
|
|
];
|
|
|
|
return $data;
|
|
}
|
|
|
|
}
|