6
0
Fork 0

用户总预收入

release
李静 2021-12-30 11:26:45 +08:00
parent 4eae9167f3
commit 02fc86c0bd
2 changed files with 11 additions and 1 deletions

View File

@ -41,7 +41,7 @@ class WalletController extends Controller
public function index(Request $request)
{
return response()->json([
'distribution_pre' => $request->user()->distributionPreIncomes()->pending()->sum('total_revenue'),
'distribution_pre' => $request->user()->getTotalPreRevenue(),
'wallet_balance'=> $request->user()->wallet?->balance_format ?? 0,
]);
}

View File

@ -296,6 +296,16 @@ class User extends Model implements AuthorizableContract, AuthenticatableContrac
$this->attributes['password'] = $value;
}
/**
* 获取此用户的总预收入
*
* @return string
*/
public function getTotalPreRevenue(): string
{
return $this->distributionPreIncomes()->unsettlement()->sum('total_revenue');
}
/**
* 确认给定的密码是否正确
*