用户总预收入
parent
4eae9167f3
commit
02fc86c0bd
|
|
@ -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,
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认给定的密码是否正确
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue