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)));
}, $simArray);
$simArray = array_filter($simArray);
$order = $this->orderService->storeByOrder($orderId, $simArray);
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
use App\Domains\Stats\Services\OrderService;
use App\Domains\Export\Services\ExportService;
use App\Domains\Virtual\Services\PropertyService;
use App\Domains\Stats\Exports\CompanyReportDetailExport;
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;
dd(array_filter(["", 1]));
// $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);
// $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);
$res = $service->index([
'company_name' => '福建省福信富通网络科技股份有限公司',
'starttime' => '2016-01-01 00:00:00',
'endtime' => '2016-12-31 23:59:59',
'type' => 1,
]);
dd($res->toArray());
$url = ExportService::store($export, "public", false);