作者 何书鹏

累计佣金

... ... @@ -41,7 +41,7 @@ class UserCommissionLog extends Model
public function scopeAdd($query)
{
return $query->where('money', '>', 0);
return $query->where('money', '>', 0)->where('type','neq','cash_error');
}
public function scopeToday($query)
... ... @@ -141,13 +141,13 @@ class UserCommissionLog extends Model
return $walletLogs;
}
public static function getSum()
public static function getSum($status = 'add')
{
$user = User::info();
$walletLogs = new self();
return $walletLogs->where(['user_id' => $user->id])->sum('money');
return $walletLogs->{$status}()->where(['user_id' => $user->id])->sum('money');
}
... ...