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.

32 lines
1.1 KiB
PHTML

5 years ago
<?php
namespace Base\Repository;
class SpendRepository {
public function __construct()
{
}
public function getPayGameByDay($params) {
$beginTime = $params['begin_time'] ?? 0;
$endTime = $params['end_time'] ?? 0;
$gameId = $params['game_id'] ?? 0;
$serverId = $params['server_id'] ?? 0;
$ids = $params['promote_id'] ?? [];
$isBan = $params['is_ban'] ?? false;
$map = [];
$map['pay_status']=1;
$map['pay_time'] = ['between', [$beginTime, $endTime]];
$map['game_id'] = $gameId > 0 ? $gameId : ['gt', 0];
$map['promote_id'] = ['in', [1,2]];
$map['pay_way'] = $isBan ? ['neq', '-10'] : ['neq', '-1'];
$field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as pay_time,game_id as pay_num';
$subTable = M('spend', 'tab_')->field($field)->where($map)->group('pay_time')->select(false);
$data = M('spend', 'tab_')->field('a.pay_time,count(DISTINCT a.pay_num) as pay_num')->table('(' . $subTable . ') as a')->group('a.pay_time')->select();
var_dump(M()->getLastSql());die();
return $data;
}
}