You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.5 KiB
PHP
49 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Scopes;
|
|
|
|
use App\Model\Promote;
|
|
|
|
trait SpendScopes
|
|
{
|
|
public function scopeOfConditions($query, $params)
|
|
{
|
|
if (!empty($params['server_id'])) {
|
|
$query->where('server_id', $params['server_id']);
|
|
}
|
|
if (!empty($params['server_name'])) {
|
|
$query->where('server_name', $params['server_name']);
|
|
}
|
|
if (!empty($params['game_id'])) {
|
|
$query->where('game_id', $params['game_id']);
|
|
}
|
|
if (!empty($params['game_name'])) {
|
|
$query->where('game_name', $params['game_name']);
|
|
}
|
|
if (isset($params['pay_status']) && $params['pay_status'] != -1) {
|
|
$query->where('pay_status', $params['pay_status']);
|
|
}
|
|
if (isset($params['pay_way']) && $params['pay_way'] != -99) {
|
|
$query->where('pay_way', $params['pay_way']);
|
|
}
|
|
if (!empty($params['pay_order_number'])) {
|
|
$query->where('pay_order_number', $params['pay_order_number']);
|
|
}
|
|
if (!empty($params['user_account'])) {
|
|
$query->where('user_account', $params['user_account']);
|
|
}
|
|
if (!empty($params['role_name'])) {
|
|
$query->where('game_player_name', $params['game_player_name']);
|
|
}
|
|
return $query;
|
|
}
|
|
|
|
public function scopeSettleOrder($query, string $tableAlias = null)
|
|
{
|
|
$column = 'is_check';
|
|
if ($tableAlias) {
|
|
$column = $tableAlias . '.' . $column;
|
|
}
|
|
return $query->where($column, 1);
|
|
}
|
|
} |