vd/tests/ExampleTest.php
2019-11-13 20:06:49 +08:00

61 lines
1.1 KiB
PHP

<?php
use App\Domains\Stats\Services\OrderService;
use App\Domains\Virtual\Services\PropertyService;
require_once realpath(dirname(__FILE__) . '/TestCase.php');
$sql = <<< EOF
select
"sim" ,
"company_id",
"package_id",
"type",
case
"type"
when 3 then sum(counts)
else count(*)
end as counts ,
"unit_price"
from
"virtual_order_cards_partition"
where
("type" in (0)
and "company_id" in (23)
and "package_id" in (98)
and "unit_price" = 14400
and ("service_start_at" <= '2019-10-31 23:59:59'
and "service_end_at" >= '2019-10-01 00:00:00'))
and "virtual_order_cards_partition"."deleted_at" is null
and "refunded_at" is null
group by
"company_id" ,
"package_id",
"type",
"unit_price" ,
"sim"
order by
"sim" asc
limit 100000
EOF;
$res = DB::select($sql);
dd($res);
$test = PropertyService::load('1', '1');
dd($test);
$service = app(OrderService::class);
$res = $service->index([
'company_name' => '福建省福信富通网络科技股份有限公司',
'starttime' => '2016-01-01 00:00:00',
'endtime' => '2016-12-31 23:59:59',
'type' => 1,
]);
dd($res->toArray());