This commit is contained in:
邓皓元 2019-11-15 12:18:45 +08:00
parent 19fc32a976
commit 9c02f4d6ed
3 changed files with 60 additions and 47 deletions

View File

@ -362,6 +362,8 @@ class OrderController extends Controller
return intval(trim(str_replace("\t", '', $item))); return intval(trim(str_replace("\t", '', $item)));
}, $simArray); }, $simArray);
$simArray = array_filter($simArray);
$order = $this->orderService->storeByOrder($orderId, $simArray); $order = $this->orderService->storeByOrder($orderId, $simArray);
return res($order, '排单成功'); return res($order, '排单成功');

10
tests/Activate.php Normal file
View File

@ -0,0 +1,10 @@
<?php
use App\Domains\Card\Repositories\CardRepository;
use App\Domains\Virtual\Repositories\OrderCardPartitionRepository;
require_once realpath(dirname(__FILE__) . '/TestCase.php');
app(CardRepository::class)->forgetCached();
app(OrderCardPartitionRepository::class)->forgetCached();

View File

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