推广平台->数据管理->每日概况|数据汇总--sql优化

master
chenxiaojun 5 years ago
parent e9b234df02
commit 232760c351

@ -34,14 +34,14 @@ class SpendRepository
$gameIds = $params['game_ids'] ?? []; $gameIds = $params['game_ids'] ?? [];
$conditions = []; $conditions = [];
$conditions['pay_status'] = 1;
$conditions['promote_id'] = ['in', $ids]; $conditions['promote_id'] = ['in', $ids];
$conditions['pay_time'] = ['between', [$beginTime, $endTime]];
$conditions['game_id'] = ['in', $gameIds]; $conditions['game_id'] = ['in', $gameIds];
$conditions['pay_way'] = $isBan ? ['neq', '-10'] : ['neq', '-1'];
if (!empty($params['server_id'])) { if (!empty($params['server_id'])) {
$conditions['server_id'] = $params['server_id']; $conditions['server_id'] = $params['server_id'];
} }
$conditions['pay_way'] = $isBan ? ['neq', '-10'] : ['neq', '-1'];
$conditions['pay_status'] = 1;
$conditions['pay_time'] = ['between', [$beginTime, $endTime]];
return $conditions; return $conditions;
} }
@ -56,7 +56,6 @@ class SpendRepository
$conditions = []; $conditions = [];
$conditions['pay_status'] = 1; $conditions['pay_status'] = 1;
$conditions['promote_id'] = ['in', $ids]; $conditions['promote_id'] = ['in', $ids];
$conditions['pay_time'] = ['between', [$beginTime, $endTime]];
$conditions['game_id'] = ['in', $gameIds]; $conditions['game_id'] = ['in', $gameIds];
if (!empty($params['server_id'])) { if (!empty($params['server_id'])) {
$conditions['server_id'] = $params['server_id']; $conditions['server_id'] = $params['server_id'];
@ -64,6 +63,7 @@ class SpendRepository
if (isset($params['pay_way'])) { if (isset($params['pay_way'])) {
$conditions['pay_way'] = $params['pay_way']; $conditions['pay_way'] = $params['pay_way'];
} }
$conditions['pay_time'] = ['between', [$beginTime, $endTime]];
return $conditions; return $conditions;
} }

@ -65,13 +65,13 @@ class UserRepository
$conditions = []; $conditions = [];
$conditions['promote_id'] = ['in', $ids]; $conditions['promote_id'] = ['in', $ids];
$conditions[$params['time_column']] = ['between', [$beginTime, $endTime]];
if (!empty($gameIds)) { if (!empty($gameIds)) {
$conditions['game_id'] = ['in', $gameIds]; $conditions['game_id'] = ['in', $gameIds];
if (!empty($params['server_id'])) { if (!empty($params['server_id'])) {
$conditions['server_id'] = $params['server_id']; $conditions['server_id'] = $params['server_id'];
} }
} }
$conditions[$params['time_column']] = ['between', [$beginTime, $endTime]];
return $conditions; return $conditions;
} }
@ -107,11 +107,11 @@ class UserRepository
$conditions = []; $conditions = [];
$conditions['promote_id'] = ['in', $ids]; $conditions['promote_id'] = ['in', $ids];
$conditions[$params['time_column']] = ['between', [$beginTime, $endTime]];
$conditions['game_id'] = ['in', $gameIds]; $conditions['game_id'] = ['in', $gameIds];
if ($serverId > 0) { if ($serverId > 0) {
$conditions['server_id'] = $serverId; $conditions['server_id'] = $serverId;
} }
$conditions[$params['time_column']] = ['between', [$beginTime, $endTime]];
return $conditions; return $conditions;
} }

Loading…
Cancel
Save