34 lines
921 B
PHP
34 lines
921 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use app\adminapi\logic\stats\YejiStatsLogic;
|
|
|
|
require dirname(__DIR__) . '/vendor/autoload.php';
|
|
|
|
$query = new class() {
|
|
/** @var string[] */
|
|
public array $whereRawClauses = [];
|
|
|
|
public function whereRaw(string $sql): self
|
|
{
|
|
$this->whereRawClauses[] = $sql;
|
|
|
|
return $this;
|
|
}
|
|
};
|
|
|
|
YejiStatsLogic::applyPrescriptionOrderEffectiveAmountQuery($query, 'po');
|
|
|
|
if (count($query->whereRawClauses) !== 2) {
|
|
throw new RuntimeException('有效金额过滤条件数量不正确');
|
|
}
|
|
if (!str_contains($query->whereRawClauses[0], 'po.fulfillment_status NOT IN (4,9,10)')) {
|
|
throw new RuntimeException('未排除已取消、拒收和全额退款状态');
|
|
}
|
|
if (!str_contains($query->whereRawClauses[1], 'po.refund_amount <= 0')) {
|
|
throw new RuntimeException('未排除已发生部分退款的订单');
|
|
}
|
|
|
|
echo "FIRST_VISIT_EFFECTIVE_AMOUNT_FILTER_OK\n";
|