Log
This commit is contained in:
parent
cc56046e2a
commit
2706e53f15
@ -88,6 +88,7 @@ class OrderDetailExport extends AbstractExport implements FromQuery, WithHeading
|
|||||||
return [
|
return [
|
||||||
'A' => NumberFormat::FORMAT_NUMBER,
|
'A' => NumberFormat::FORMAT_NUMBER,
|
||||||
'F' => NumberFormat::FORMAT_NUMBER_00,
|
'F' => NumberFormat::FORMAT_NUMBER_00,
|
||||||
|
'G' => NumberFormat::FORMAT_DATE_YYYYMMDD2,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,10 +47,8 @@ class LogSync extends Command
|
|||||||
$this->packages = app(PackageRepository::class)->get()->keyBy('sn');
|
$this->packages = app(PackageRepository::class)->get()->keyBy('sn');
|
||||||
$this->products = app(ProductRepository::class)->get()->keyBy('sn');
|
$this->products = app(ProductRepository::class)->get()->keyBy('sn');
|
||||||
|
|
||||||
$query = DB::connection('vd_old')->table('logs')
|
$query = DB::connection('vd_old')->table('logs')->whereIn('type', array_keys(self::$types))
|
||||||
->where('type', '<>', 10)
|
->where('id', '>', $nextId)->orderBy('id');
|
||||||
->where('id', '>', $nextId)
|
|
||||||
->orderBy('id');
|
|
||||||
|
|
||||||
$total = $query->count();
|
$total = $query->count();
|
||||||
|
|
||||||
|
@ -10,9 +10,11 @@ use Dipper\Excel\Concerns\Exportable;
|
|||||||
use Dipper\Excel\Concerns\WithHeadings;
|
use Dipper\Excel\Concerns\WithHeadings;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use App\Domains\Virtual\Services\CardService;
|
use App\Domains\Virtual\Services\CardService;
|
||||||
|
use Dipper\Excel\Concerns\WithColumnFormatting;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||||
use App\Domains\Virtual\Repositories\OrderCardRepository;
|
use App\Domains\Virtual\Repositories\OrderCardRepository;
|
||||||
|
|
||||||
class CardExport extends AbstractExport implements FromQuery, WithHeadings, WithRows
|
class CardExport extends AbstractExport implements FromQuery, WithHeadings, WithRows, WithColumnFormatting
|
||||||
{
|
{
|
||||||
public $conditions;
|
public $conditions;
|
||||||
|
|
||||||
@ -24,7 +26,9 @@ class CardExport extends AbstractExport implements FromQuery, WithHeadings, With
|
|||||||
|
|
||||||
public function query()
|
public function query()
|
||||||
{
|
{
|
||||||
return app(OrderCardRepository::class)->withConditions($this->conditions)->applyConditions();
|
$builder = app(OrderCardRepository::class)->withConditions($this->conditions)->applyConditions()->getModel();
|
||||||
|
|
||||||
|
return $builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,7 +38,7 @@ class CardExport extends AbstractExport implements FromQuery, WithHeadings, With
|
|||||||
*/
|
*/
|
||||||
public function rows($rows)
|
public function rows($rows)
|
||||||
{
|
{
|
||||||
$rows = CardService::transformer((new Collection($rows)));
|
$rows = CardService::transformer($rows);
|
||||||
|
|
||||||
$rows->transform(function ($item) {
|
$rows->transform(function ($item) {
|
||||||
return [
|
return [
|
||||||
@ -73,4 +77,18 @@ class CardExport extends AbstractExport implements FromQuery, WithHeadings, With
|
|||||||
'服务结束时间',
|
'服务结束时间',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function columnFormats(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'B' => NumberFormat::FORMAT_NUMBER,
|
||||||
|
'C' => NumberFormat::FORMAT_NUMBER,
|
||||||
|
'D' => NumberFormat::FORMAT_NUMBER,
|
||||||
|
'H' => NumberFormat::FORMAT_DATE_YYYYMMDD2,
|
||||||
|
'J' => NumberFormat::FORMAT_DATE_YYYYMMDD2,
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,12 +109,10 @@ class OrderRepository extends Repository
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($conditions['starttime'])) {
|
if (isset($conditions['starttime'])) {
|
||||||
Log::info($conditions['starttime']);
|
|
||||||
$this->model = $this->model->where('order_at', '>=', Carbon::parse($conditions['starttime']));
|
$this->model = $this->model->where('order_at', '>=', Carbon::parse($conditions['starttime']));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($conditions['endtime'])) {
|
if (isset($conditions['endtime'])) {
|
||||||
Log::info($conditions['endtime']);
|
|
||||||
$this->model = $this->model->where('order_at', '<=', Carbon::parse($conditions['endtime']));
|
$this->model = $this->model->where('order_at', '<=', Carbon::parse($conditions['endtime']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user