pull/1/head
limu 1 year ago
parent 0d401273da
commit 764936ffe6
  1. 9
      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'));
}

Loading…
Cancel
Save