From 764936ffe6484af863f1f81f8228a06125e8d365 Mon Sep 17 00:00:00 2001 From: limu Date: Thu, 25 Jan 2024 13:58:45 +0800 Subject: [PATCH] Changes --- app/api/controller/User.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/api/controller/User.php b/app/api/controller/User.php index 26982eca..d9d13d9c 100644 --- a/app/api/controller/User.php +++ b/app/api/controller/User.php @@ -17,6 +17,7 @@ use app\api\model\User as UserModel; use app\api\model\UserCoupon as UserCouponModel; use app\api\service\User as UserService; use cores\exception\BaseException; +use app\api\model\user\BalanceLog; /** * 用户管理 @@ -36,6 +37,14 @@ class User extends Controller $userInfo = UserService::getCurrentLoginUser(true); // 获取用户头像和会员等级 $userInfo = UserModel::related($userInfo, ['avatar', 'grade']); + //获取提现次数 + $userInfo['finace_count'] = BalanceLog::where(['user_id' => $userInfo->user_id, 'scene' => 50])->count()??0; + //获取用户收入 + $userInfo['income'] = BalanceLog::where(['user_id' => $userInfo->user_id]) + ->whereIn('scene',[10,30,40,60]) + ->where('money','>',0) + ->sum('money')??0; + return $this->renderSuccess(compact('userInfo')); }