From 97c885e2490222c0ecc1d7ea8a6e9636790f8678 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Mon, 27 Nov 2023 10:25:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/adminapi/lists/finance/RefundRecordLists.php | 1 - app/middleapi/controller/RefundController.php | 14 +++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/adminapi/lists/finance/RefundRecordLists.php b/app/adminapi/lists/finance/RefundRecordLists.php index c6193aa79..98eac2165 100755 --- a/app/adminapi/lists/finance/RefundRecordLists.php +++ b/app/adminapi/lists/finance/RefundRecordLists.php @@ -97,7 +97,6 @@ class RefundRecordLists extends BaseAdminDataLists implements ListsSearchInterfa foreach ($lists as &$item) { $item['avatar'] = FileService::getFileUrl($item['avatar']); } - return $lists; } diff --git a/app/middleapi/controller/RefundController.php b/app/middleapi/controller/RefundController.php index 011586c6a..963cd7161 100644 --- a/app/middleapi/controller/RefundController.php +++ b/app/middleapi/controller/RefundController.php @@ -4,6 +4,7 @@ namespace app\middleapi\controller; use app\adminapi\logic\finance\RefundLogic; use app\common\model\refund\RefundRecord; +use app\common\enum\RefundEnum; use app\common\controller\BaseLikeAdminController; use app\common\service\FileService; @@ -82,11 +83,22 @@ class RefundController extends BaseLikeAdminController ->join('user u', 'u.id = r.user_id') ->order(['r.id' => 'desc']) ->where($where)->count(); + $extend = (new RefundRecord())->alias('r') + ->join('user u', 'u.id = r.user_id') + ->field([ + 'count(r.id) as total', + 'count(if(r.refund_status='.RefundEnum::REFUND_ING.', true, null)) as ing', + 'count(if(r.refund_status='.RefundEnum::REFUND_SUCCESS.', true, null)) as success', + 'count(if(r.refund_status='.RefundEnum::REFUND_ERROR.', true, null)) as error', + ]) + ->where($where) + ->select()->toArray(); $result = [ 'lists' => $lists, 'count' => $count, 'page_no' => $pageNo, - 'page_size' => $pageSize + 'page_size' => $pageSize, + 'extend' => array_shift($extend) ]; return $this->success('请求成功',$result); }