diff --git a/app/common/service/FinPaymentApplyService.php b/app/common/service/FinPaymentApplyService.php index 0f6bec7..78d0d37 100644 --- a/app/common/service/FinPaymentApplyService.php +++ b/app/common/service/FinPaymentApplyService.php @@ -233,12 +233,12 @@ class FinPaymentApplyService } if (!empty($remitter)) { - $similarityOrder[] = "CASE WHEN remitter = {$remitter} THEN 0 ELSE 1 END"; + $similarityOrder[] = "CASE WHEN remitter = '{$remitter}' THEN 0 ELSE 1 END"; } if (!empty($amount)) { $amount = (float)$amount; - $similarityOrder[] = "ABS(amount - {$amount}) ASC"; + $similarityOrder[] = "ABS(amount - {$amount})"; $similarityOrder[] = "CASE WHEN (ABS(amount - {$amount}) / {$amount} * 100) <= 5 THEN 0 ELSE 1 END"; } @@ -252,9 +252,9 @@ class FinPaymentApplyService END ASC, "; } - $orderByClause .= "CASE - WHEN created_at > {$sevenDaysAgo} THEN id - ELSE 999999 + $orderByClause .= "CASE + WHEN created_at > {$sevenDaysAgo} THEN id + ELSE 999999 END DESC, "; $orderByClause .= "id DESC";