From 4ea718130b76cd3107c38a3c0b06552e3d24b3d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Wed, 17 Mar 2021 15:53:11 +0800 Subject: [PATCH] Update Transfer.php --- app/data/controller/api/auth/Transfer.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/data/controller/api/auth/Transfer.php b/app/data/controller/api/auth/Transfer.php index 7a36f262f..db717ab83 100644 --- a/app/data/controller/api/auth/Transfer.php +++ b/app/data/controller/api/auth/Transfer.php @@ -100,7 +100,18 @@ class Transfer extends Auth { $query = $this->_query($this->table)->where(['uid' => $this->uuid]); $result = $query->like('date,code')->in('status')->order('id desc')->page(true, false, false, 10); - $this->success('获取提现成功', $result); + // 统计历史数据 + $map = [['uid', '=', $this->uuid], ['status', '>', 1]]; + [$total, $count, $locks] = UserRebateService::instance()->amount($this->uuid); + $this->success('获取提现成功', array_merge($result, [ + 'total' => [ + '锁定' => $locks, + '可提' => $total - $count, + '上月' => $this->app->db->name($this->table)->where($map)->whereLike('date', date("Y-m-%", strtotime('-1 month')))->sum('amount'), + '本月' => $this->app->db->name($this->table)->where($map)->whereLike('date', date("Y-m-%"))->sum('amount'), + '全年' => $this->app->db->name($this->table)->where($map)->whereLike('date', date("Y-%"))->sum('amount'), + ], + ])); } /**