1
0

提交代码

This commit is contained in:
2020-08-06 14:45:56 +08:00
commit 9d0d5f4be9
361 changed files with 36445 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Admin\Exporters;
use App\Models\User;
use Encore\Admin\Grid\Exporters\CsvExporter;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithStrictNullComparison;
class CardExporters extends CsvExporter implements WithMapping, WithStrictNullComparison
{
protected $fileName = '联卡蝠激活卡.csv';
protected $mapTrue = true;
protected $users = [];
public function __construct()
{
$this->fileName = '联卡蝠激活卡' . date('YmdHis') . '.csv';
$this->users = User::pluck('username', 'id')->toArray();
}
protected $headings = ['卡序号', '归属', '卡号', '打印卡号', '卡密', '类型', '专项', '状态', '激活用户', '激活时间', '创建时间', '更改时间'];
public function map($info): array
{
$data = [
$info->id,
$this->users[$info->user_id] ?? '无',
'`' . $info->code,
$info->type . $info->code,
$info->pass,
$info->type,
$info->type == 'K' ? '商品ID' . $info->source['goods'] . '规格ID' . $info->source['param'] : '非专项',
$info->status_text,
$this->users[$info->active_id] ?? '无',
$info->actived_at,
$info->created_at,
$info->updated_at,
];
return $data;
}
}