激活时间查询错误问题
This commit is contained in:
parent
f70fb9da3e
commit
5b790a7a40
@ -129,10 +129,8 @@ trait OrderCardConcern
|
||||
}
|
||||
|
||||
if (isset($conditions['activated_starttime']) && isset($conditions['activated_endtime'])) {
|
||||
$query->whereHas('card', function ($relation) use ($conditions) {
|
||||
$relation->where('activated_at', '>=', Carbon::parse($conditions['activated_starttime']))
|
||||
->where('activated_at', '<=', Carbon::parse($conditions['activated_endtime']));
|
||||
});
|
||||
$query->where('activated_at', '>=', Carbon::parse($conditions['activated_starttime']))
|
||||
->where('activated_at', '<=', Carbon::parse($conditions['activated_endtime']));
|
||||
}
|
||||
|
||||
if (isset($conditions['sn'])) {
|
||||
@ -152,7 +150,7 @@ trait OrderCardConcern
|
||||
}
|
||||
|
||||
if (isset($conditions['sell_starttime']) && isset($conditions['sell_endtime'])) {
|
||||
$query->whereRaw(sprintf("sim in (SELECT sim FROM virtual_order_cards WHERE created_at >= '%s' AND created_at <= '%s' AND deleted_at is null AND refunded_at is null)", $conditions['sell_starttime'], $conditions['sell_endtime']));
|
||||
$query->whereRaw(sprintf("sim in (SELECT sim FROM virtual_order_cards_partition WHERE type in (0, 1) AND created_at >= '%s' AND created_at <= '%s' AND deleted_at is null AND refunded_at is null)", $conditions['sell_starttime'], $conditions['sell_endtime']));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -9,87 +9,47 @@ require_once realpath(dirname(__FILE__) . '/TestCase.php');
|
||||
|
||||
$disk = 'public';
|
||||
|
||||
//
|
||||
$conditions = [
|
||||
"limit" => 0,
|
||||
"type" => [0, 1],
|
||||
"year" => "2018",
|
||||
"sell_starttime" => "2017-01-01 00:00:00",
|
||||
"sell_endtime" => "2017-12-31 23:59:59",
|
||||
];
|
||||
$filename = "2017销售在2018年报表.xlsx";
|
||||
$export = new CompanyYearReportExport($conditions);
|
||||
Excel::store($export, $filename, 'public');
|
||||
$url = Storage::disk($disk)->url($filename);
|
||||
echo $url . PHP_EOL;
|
||||
for ($i = 2017; $i <= 2020; $i++) {
|
||||
$conditions = [
|
||||
"limit" => 0,
|
||||
"type" => [0, 1],
|
||||
"year" => "2018",
|
||||
"sell_starttime" => "$i-01-01 00:00:00",
|
||||
"sell_endtime" => "$i-12-31 23:59:59",
|
||||
];
|
||||
$filename = "${i}销售在2018年报表.xlsx";
|
||||
$export = new CompanyYearReportExport($conditions);
|
||||
Excel::store($export, $filename, 'public');
|
||||
$url = Storage::disk($disk)->url($filename);
|
||||
echo $url . PHP_EOL;
|
||||
|
||||
for ($j = 1; $j <= 12; $j++) {
|
||||
$conditions = [
|
||||
"limit" => 0,
|
||||
"type" => [0, 1],
|
||||
"month" => "2019-$j",
|
||||
"sell_starttime" => "$i-01-01 00:00:00",
|
||||
"sell_endtime" => "$i-12-31 23:59:59",
|
||||
];
|
||||
|
||||
$filename = "${i}销售在2019-${j}月报表.xlsx";
|
||||
$export = new CompanyYearReportExport($conditions);
|
||||
Excel::store($export, $filename, 'public');
|
||||
$url = Storage::disk($disk)->url($filename);
|
||||
echo $url . PHP_EOL;
|
||||
}
|
||||
|
||||
|
||||
$conditions = [
|
||||
"limit" => 0,
|
||||
"type" => [0, 1],
|
||||
"year" => "2019",
|
||||
"sell_starttime" => "2017-01-01 00:00:00",
|
||||
"sell_endtime" => "2017-12-31 23:59:59",
|
||||
];
|
||||
|
||||
$filename = "2017销售在2019年报表.xlsx";
|
||||
$export = new CompanyYearReportExport($conditions);
|
||||
Excel::store($export, $filename, 'public');
|
||||
$url = Storage::disk($disk)->url($filename);
|
||||
echo $url . PHP_EOL;
|
||||
|
||||
$conditions = [
|
||||
"limit" => 0,
|
||||
"type" => [0, 1],
|
||||
"year" => "2020",
|
||||
"sell_starttime" => "2017-01-01 00:00:00",
|
||||
"sell_endtime" => "2017-12-31 23:59:59",
|
||||
];
|
||||
|
||||
$filename = "2017销售在2020年报表.xlsx";
|
||||
$export = new CompanyYearReportExport($conditions);
|
||||
Excel::store($export, $filename, 'public');
|
||||
$url = Storage::disk($disk)->url($filename);
|
||||
echo $url . PHP_EOL;
|
||||
|
||||
$conditions = [
|
||||
"limit" => 0,
|
||||
"type" => [0, 1],
|
||||
"year" => "2019",
|
||||
"sell_starttime" => "2018-01-01 00:00:00",
|
||||
"sell_endtime" => "2018-12-31 23:59:59",
|
||||
];
|
||||
|
||||
$filename = "2018销售在2019年报表.xlsx";
|
||||
$export = new CompanyYearReportExport($conditions);
|
||||
Excel::store($export, $filename, 'public');
|
||||
$url = Storage::disk($disk)->url($filename);
|
||||
echo $url . PHP_EOL;
|
||||
|
||||
$conditions = [
|
||||
"limit" => 0,
|
||||
"type" => [0, 1],
|
||||
"year" => "2020",
|
||||
"sell_starttime" => "2018-01-01 00:00:00",
|
||||
"sell_endtime" => "2018-12-31 23:59:59",
|
||||
];
|
||||
|
||||
$filename = "2018销售在2020年报表.xlsx";
|
||||
$export = new CompanyYearReportExport($conditions);
|
||||
Excel::store($export, $filename, 'public');
|
||||
$url = Storage::disk($disk)->url($filename);
|
||||
echo $url . PHP_EOL;
|
||||
|
||||
$conditions = [
|
||||
"limit" => 0,
|
||||
"type" => [0, 1],
|
||||
"year" => "2020",
|
||||
"sell_starttime" => "2019-01-01 00:00:00",
|
||||
"sell_endtime" => "2019-12-31 23:59:59",
|
||||
];
|
||||
|
||||
$filename = "2019销售在2020年报表.xlsx";
|
||||
$export = new CompanyYearReportExport($conditions);
|
||||
Excel::store($export, $filename, 'public');
|
||||
$url = Storage::disk($disk)->url($filename);
|
||||
echo $url . PHP_EOL;
|
||||
$conditions = [
|
||||
"limit" => 0,
|
||||
"type" => [0, 1],
|
||||
"year" => "2020",
|
||||
"sell_starttime" => "$i-01-01 00:00:00",
|
||||
"sell_endtime" => "$i-12-31 23:59:59",
|
||||
];
|
||||
$filename = "${i}销售在2020年报表.xlsx";
|
||||
$export = new CompanyYearReportExport($conditions);
|
||||
Excel::store($export, $filename, 'public');
|
||||
$url = Storage::disk($disk)->url($filename);
|
||||
echo $url . PHP_EOL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user