|
|
@ -177,7 +177,7 @@ class SpendRepository
|
|
|
|
$gameIds = $params['game_ids'] ?? [];
|
|
|
|
$gameIds = $params['game_ids'] ?? [];
|
|
|
|
$conditions = $this->getGameGroupConditionsNew($params);
|
|
|
|
$conditions = $this->getGameGroupConditionsNew($params);
|
|
|
|
$field = 'game_id, sum(pay_amount) as amount';
|
|
|
|
$field = 'game_id, sum(pay_amount) as amount';
|
|
|
|
$items = M('spend', 'tab_')->field($field)->where($conditions)->group('game_id')->select();
|
|
|
|
$items = M('spend use index(spend_search)', 'tab_')->field($field)->where($conditions)->group('game_id')->select();
|
|
|
|
return $this->assembleRecords($items, $gameIds, 'amount', 'game_id');
|
|
|
|
return $this->assembleRecords($items, $gameIds, 'amount', 'game_id');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -187,7 +187,7 @@ class SpendRepository
|
|
|
|
public function getPayAmountByGameAndType($params)
|
|
|
|
public function getPayAmountByGameAndType($params)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$conditions = $this->getGameGroupConditionsNew($params);
|
|
|
|
$conditions = $this->getGameGroupConditionsNew($params);
|
|
|
|
return M('spend', 'tab_')->where($conditions)->sum('pay_amount');
|
|
|
|
return M('spend use index(spend_search)', 'tab_')->where($conditions)->sum('pay_amount');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -234,7 +234,7 @@ class SpendRepository
|
|
|
|
$gameIds = $params['game_ids'] ?? [];
|
|
|
|
$gameIds = $params['game_ids'] ?? [];
|
|
|
|
$conditions = $this->getGameGroupConditions($params);
|
|
|
|
$conditions = $this->getGameGroupConditions($params);
|
|
|
|
$field = 'game_id, count(*) count';
|
|
|
|
$field = 'game_id, count(*) count';
|
|
|
|
$items = M('spend', 'tab_')->field($field)->where($conditions)->group('game_id')->select();
|
|
|
|
$items = M('spend use index(spend_search)', 'tab_')->field($field)->where($conditions)->group('game_id')->select();
|
|
|
|
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
|
|
|
|
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -244,7 +244,7 @@ class SpendRepository
|
|
|
|
public function getPayCountByGame($params)
|
|
|
|
public function getPayCountByGame($params)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$conditions = $this->getGameGroupConditions($params);
|
|
|
|
$conditions = $this->getGameGroupConditions($params);
|
|
|
|
return M('spend', 'tab_')->where($conditions)->count();
|
|
|
|
return M('spend use index(spend_search)', 'tab_')->where($conditions)->count();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -255,7 +255,7 @@ class SpendRepository
|
|
|
|
$gameIds = $params['game_ids'] ?? [];
|
|
|
|
$gameIds = $params['game_ids'] ?? [];
|
|
|
|
$conditions = $this->getGameGroupConditions($params);
|
|
|
|
$conditions = $this->getGameGroupConditions($params);
|
|
|
|
$field = 'game_id, count(distinct user_id) count';
|
|
|
|
$field = 'game_id, count(distinct user_id) count';
|
|
|
|
$items = M('spend', 'tab_')->field($field)->where($conditions)->group('game_id')->select();
|
|
|
|
$items = M('spend use index(spend_search)', 'tab_')->field($field)->where($conditions)->group('game_id')->select();
|
|
|
|
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
|
|
|
|
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -265,7 +265,7 @@ class SpendRepository
|
|
|
|
public function getPayUserCountByGame($params)
|
|
|
|
public function getPayUserCountByGame($params)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$conditions = $this->getGameGroupConditions($params);
|
|
|
|
$conditions = $this->getGameGroupConditions($params);
|
|
|
|
$sql = M('spend', 'tab_')->field('distinct game_id, user_id')
|
|
|
|
$sql = M('spend use index(spend_search)', 'tab_')->field('distinct game_id, user_id')
|
|
|
|
->where($conditions)
|
|
|
|
->where($conditions)
|
|
|
|
->fetchSql(true)
|
|
|
|
->fetchSql(true)
|
|
|
|
->select();
|
|
|
|
->select();
|
|
|
@ -307,7 +307,7 @@ class SpendRepository
|
|
|
|
$oldConditions['pay_time'] = ['lt', $beginTime];
|
|
|
|
$oldConditions['pay_time'] = ['lt', $beginTime];
|
|
|
|
$oldQuery = M('spend', 'tab_')->field('user_id')->where($oldConditions)->group('user_id')->buildSql();
|
|
|
|
$oldQuery = M('spend', 'tab_')->field('user_id')->where($oldConditions)->group('user_id')->buildSql();
|
|
|
|
$conditions['user_id'] = ['exp', ' not in (' . $oldQuery . ')'];
|
|
|
|
$conditions['user_id'] = ['exp', ' not in (' . $oldQuery . ')'];
|
|
|
|
$items = M('spend', 'tab_')->field('count(distinct user_id) count, game_id')->where($conditions)->group('game_id')->select();
|
|
|
|
$items = M('spend use index(spend_search)', 'tab_')->field('count(distinct user_id) count, game_id')->where($conditions)->group('game_id')->select();
|
|
|
|
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
|
|
|
|
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|