判断没有注销的是看注销时间大于查询时间的.
This commit is contained in:
parent
e545648c73
commit
da78ff5978
@ -228,7 +228,7 @@ trait OrderCardConcern
|
||||
if (isset($conditions['uncancelled'])) {
|
||||
$date = isset($conditions['month']) ? Carbon::parse($conditions['month'])->copy()->startOfMonth() : date('Y-m-d H:i:s');
|
||||
$this->model = $this->model->whereHas('card', function ($relation) use ($date) {
|
||||
$relation->whereNull('cancelled_at')->orWhere('cancelled_at', "<", $date);
|
||||
$relation->whereNull('cancelled_at')->orWhere('cancelled_at', ">", $date);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,31 @@
|
||||
<?php
|
||||
|
||||
use App\Domains\Card\Repositories\CardRepository;
|
||||
use App\Domains\Virtual\Repositories\OrderCardPartitionRepository;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use App\Domains\Export\Services\ImportService;
|
||||
|
||||
require_once realpath(dirname(__FILE__) . '/TestCase.php');
|
||||
|
||||
|
||||
app(CardRepository::class)->forgetCached();
|
||||
app(OrderCardPartitionRepository::class)->forgetCached();
|
||||
$file = new UploadedFile(__DIR__ . '/激活处理.xlsx', '激活处理.xlsx');
|
||||
|
||||
$data = ImportService::load($file, null, 2);
|
||||
|
||||
$sim = join(',', array_pluck($data, 'sim'));
|
||||
|
||||
DB::update(
|
||||
sprintf(
|
||||
"
|
||||
update cards set virtual_activated_at =
|
||||
to_timestamp(floor(random() * (EXTRACT(epoch FROM '%s'::timestamp) - EXTRACT(epoch FROM '%s'::timestamp) + 1) + EXTRACT(epoch FROM '%s'::timestamp)))
|
||||
where sim in (%s) AND virtual_activated_at is null
|
||||
",
|
||||
'2019-11-30 23:59:59',
|
||||
'2019-11-01 00:00:00',
|
||||
'2019-11-01 00:00:00',
|
||||
$sim
|
||||
)
|
||||
);
|
||||
|
||||
DB::select(sprintf("SELECT fix_timelines(ARRAY[%s])", $sim));
|
||||
|
||||
dd($sim);
|
||||
|
BIN
tests/激活处理.xlsx
Normal file
BIN
tests/激活处理.xlsx
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user