更新统计

This commit is contained in:
yaooo 2023-11-27 10:25:40 +08:00
parent d802ff0c75
commit 97c885e249
2 changed files with 13 additions and 2 deletions

View File

@ -97,7 +97,6 @@ class RefundRecordLists extends BaseAdminDataLists implements ListsSearchInterfa
foreach ($lists as &$item) {
$item['avatar'] = FileService::getFileUrl($item['avatar']);
}
return $lists;
}

View File

@ -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);
}