From ae6cd4ec78739fee47a584d4b5c55b70c3ea157d Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Fri, 26 Sep 2025 16:43:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FinReceiptHisController.php | 77 +++++++++++++++++++ app/common/logic/FinReceiptHisLogic.php | 17 ++++ app/common/service/FinReceiptHisService.php | 62 +++++++++++++++ app/common/validate/FinReceiptHisValidate.php | 29 +++++++ config/route.php | 5 ++ 5 files changed, 190 insertions(+) create mode 100644 app/common/controller/FinReceiptHisController.php create mode 100644 app/common/logic/FinReceiptHisLogic.php create mode 100644 app/common/service/FinReceiptHisService.php create mode 100644 app/common/validate/FinReceiptHisValidate.php diff --git a/app/common/controller/FinReceiptHisController.php b/app/common/controller/FinReceiptHisController.php new file mode 100644 index 0000000..eb57d99 --- /dev/null +++ b/app/common/controller/FinReceiptHisController.php @@ -0,0 +1,77 @@ +service = new FinReceiptHisService(); + } + + /** + * 列表页数据格式化 + * + * @param array $data + * @return array + */ + protected function indexFormat($data) + { + if (isset($data['created_at'])) + $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); + if (isset($data['updated_at'])) + $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']); + if (isset($data['arrived_at'])) + $data['arrived_at'] = date('Y-m-d H:i:s', $data['arrived_at']); + if (isset($data['received_at'])) + $data['received_at'] = date('Y-m-d H:i:s', $data['received_at']); + if (isset($data['account_id'])) //收款账号 + $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + if (isset($data['country_id'])) //付款来源国家 + $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + if (isset($data['currency_id'])) //付款币种 + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; + if (isset($data['fx_receipt_file'])) + $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); + return $data; + } + + /** + * 数据格式化 + * + * @param array $data + * @return array + */ + protected function showFormat($data) + { + if (isset($data['created_at'])) + $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); + if (isset($data['updated_at'])) + $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']); + if (isset($data['arrived_at'])) + $data['arrived_at'] = date('Y-m-d H:i:s', $data['arrived_at']); + if (isset($data['received_at'])) + $data['received_at'] = date('Y-m-d H:i:s', $data['received_at']); + if (isset($data['account_id'])) //收款账号 + $data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name; + if (isset($data['country_id'])) //付款来源国家 + $data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr; + if (isset($data['currency_id'])) //付款币种 + $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name; + if (isset($data['fx_receipt_file'])) + $data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']); + return $data; + } +} \ No newline at end of file diff --git a/app/common/logic/FinReceiptHisLogic.php b/app/common/logic/FinReceiptHisLogic.php new file mode 100644 index 0000000..3e90dac --- /dev/null +++ b/app/common/logic/FinReceiptHisLogic.php @@ -0,0 +1,17 @@ +validator; + } + + /** + * 构建查询条件 + */ + protected function buildQueryConfig(Request $request, string $scene = 'index'): array + { + $p = $request->all(); + + $config = []; + $config['model'] = $this->modelClass; + switch ($scene) { + case 'index': + if(empty($p['receipt_id'])){ + throw new BusinessException('receipt_id不能为空'); + } + // ====== ====== 排序 ====== ====== + $config['order']['id'] = 'desc'; + + // ====== ====== 筛选 ====== ====== + $config['where']['receipt_id'] = $p['receipt_id']; + + break; + case 'show': + $config['where']['id'] = $p['id']; + break; + } + + return $config; + } +} \ No newline at end of file diff --git a/app/common/validate/FinReceiptHisValidate.php b/app/common/validate/FinReceiptHisValidate.php new file mode 100644 index 0000000..7a1f7c4 --- /dev/null +++ b/app/common/validate/FinReceiptHisValidate.php @@ -0,0 +1,29 @@ + [ + + ], + + 'update' => [ + + ] + ]; +} \ No newline at end of file diff --git a/config/route.php b/config/route.php index be37a5b..3f7477f 100644 --- a/config/route.php +++ b/config/route.php @@ -361,6 +361,11 @@ Route::group('/admin', function () { Route::any('/payment', [app\common\controller\FinReceiptController::class, 'update']); Route::any('/destroy', [app\common\controller\FinReceiptController::class, 'destroy']); }); + // 收款记录历史 + Route::group('/receipt/his', function () { + Route::any('/list', [app\common\controller\FinReceiptHisController::class, 'index']); + Route::any('/show', [app\common\controller\FinReceiptHisController::class, 'show']); + }); // 付款申请 Route::group('/payment', function () {