diff --git a/app/common/controller/FinReceiptController.php b/app/common/controller/FinReceiptController.php index ebfd956..56d7bfb 100644 --- a/app/common/controller/FinReceiptController.php +++ b/app/common/controller/FinReceiptController.php @@ -12,6 +12,7 @@ use app\common\model\User; use app\common\service\OssService; use app\common\traits\crud\CrudControllerTrait; use app\common\service\FinReceiptService; +use support\Request; class FinReceiptController extends BaseController { @@ -23,7 +24,18 @@ class FinReceiptController extends BaseController { $this->service = new FinReceiptService(); } - + public function show(Request $request) + { + try { + $raw = $this->service->serviceShow($request); + $data = $this->transformData($raw, method_exists($this, 'showFormat') + ? [$this, 'showFormat'] + : null); + return $this->success($data); + } catch (\Throwable $e) { + return $this->error($e->getMessage()); + } + } /** * 列表页数据格式化 * @@ -91,6 +103,8 @@ class FinReceiptController extends BaseController if(!$paymentApply) return $data; $paymentApply = $paymentApply->toArray(); + $paymentApply['created_at'] = strtotime($paymentApply['created_at']); + $paymentApply['updated_at'] = strtotime($paymentApply['updated_at']); $paymentApply = (new FinPaymentApplyController())->showFormat($paymentApply); $data['payment_apply'] = $paymentApply; } diff --git a/app/common/service/FinPaymentApplyService.php b/app/common/service/FinPaymentApplyService.php index 294bc01..f451ce4 100644 --- a/app/common/service/FinPaymentApplyService.php +++ b/app/common/service/FinPaymentApplyService.php @@ -217,14 +217,16 @@ class FinPaymentApplyService $orderByClause = "CASE WHEN created_at >= {$sevenDaysAgo} THEN (" . implode(' + ', $similarityOrder) . ") - ELSE 999999 + ELSE 0 END ASC, "; } $orderByClause .= "CASE WHEN created_at < {$sevenDaysAgo} THEN id - ELSE 0 + ELSE 999999 END DESC"; + + $orderByClause .= ", id DESC"; $query->orderByRaw($orderByClause);