|
|
@ -300,7 +300,20 @@ class TestingResourceRepository
|
|
|
|
'pay_status' => 1,
|
|
|
|
'pay_status' => 1,
|
|
|
|
'_string' => '(' . implode(' or ', $spendOrWhere) . ')',
|
|
|
|
'_string' => '(' . implode(' or ', $spendOrWhere) . ')',
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$spendList = M('spend', 'tab_')->field('sum(pay_amount) amount, game_id, game_player_id')->where($spendCondition)->group('game_id,game_player_id')->select();
|
|
|
|
$subBindingSql = M('testing_binding', 'tab_')
|
|
|
|
|
|
|
|
->where([
|
|
|
|
|
|
|
|
'_string' =>
|
|
|
|
|
|
|
|
'tab_testing_binding.role_id < tab_spend.game_player_id and ' .
|
|
|
|
|
|
|
|
'tab_testing_binding.game_id < tab_spend.game_id and ' .
|
|
|
|
|
|
|
|
'UNIX_TIMESTAMP(FROM_UNIXTIME(tab_testing_binding.create_time, "%Y-%m-%d 00:00:00")) < tab_spend.pay_time'
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
->select(false);
|
|
|
|
|
|
|
|
$spendCondition['_string'] .= ' and exists(' . $subBindingSql . ')';
|
|
|
|
|
|
|
|
$spendList = M('spend', 'tab_')
|
|
|
|
|
|
|
|
->field('sum(pay_amount) amount, game_id, game_player_id')
|
|
|
|
|
|
|
|
->where($spendCondition)
|
|
|
|
|
|
|
|
->group('game_id,game_player_id')
|
|
|
|
|
|
|
|
->select();
|
|
|
|
foreach ($spendList as $item) {
|
|
|
|
foreach ($spendList as $item) {
|
|
|
|
$spendItems[$this->getGameRoleId($item['game_id'], $item['game_player_id'])] = $item['amount'];
|
|
|
|
$spendItems[$this->getGameRoleId($item['game_id'], $item['game_player_id'])] = $item['amount'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|