|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
namespace Base\Repository;
|
|
|
|
|
|
|
|
|
|
use Base\Service\PromoteService;
|
|
|
|
|
use Base\Tool\Registry;
|
|
|
|
|
|
|
|
|
|
class GameRepository
|
|
|
|
@ -68,7 +69,7 @@ class GameRepository
|
|
|
|
|
return $gameIds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getUserRegisterCount($baseGame, $date, $deviceType = 0)
|
|
|
|
|
public function getUserRegisterCount($baseGame, $date, $deviceType = 0, $promote = null)
|
|
|
|
|
{
|
|
|
|
|
$gameIds = $this->getGameIdsByBaseGame($baseGame, $deviceType);
|
|
|
|
|
$timeBegin = strtotime($date . ' 00:00:00');
|
|
|
|
@ -76,17 +77,25 @@ class GameRepository
|
|
|
|
|
|
|
|
|
|
$subCondition = [
|
|
|
|
|
'game_id' => ['in', $gameIds],
|
|
|
|
|
'_string' => 'tab_user.id=tab_user_play_info.user_id'
|
|
|
|
|
'_string' => 'tab_user_play.user_id=tab_user_play_info.user_id'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$subSql = M('user_play_info', 'tab_')->field('1')->where($subCondition)->select(false);
|
|
|
|
|
return M('user', 'tab_')->where([
|
|
|
|
|
'register_time' => ['between', [$timeBegin, $timeEnd]],
|
|
|
|
|
'_string' => 'exists (' . $subSql . ')'
|
|
|
|
|
$sqlStr = 'exists (' . $subSql . ')';
|
|
|
|
|
|
|
|
|
|
if ($promote) {
|
|
|
|
|
$promoteService = new PromoteService();
|
|
|
|
|
$sqlStr .= ' and promote_id in (' . $promoteService->subInSql($promote) . ')';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return M('user_play', 'tab_')->where([
|
|
|
|
|
// 'register_time' => ['between', [$timeBegin, $timeEnd]],
|
|
|
|
|
'create_time' => ['between', [$timeBegin, $timeEnd]],
|
|
|
|
|
'_string' => $sqlStr
|
|
|
|
|
])->count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getUserRetentionCount($baseGame, $date, $day, $deviceType = 0)
|
|
|
|
|
public function getUserRetentionCount($baseGame, $date, $day, $deviceType = 0, $promote = null)
|
|
|
|
|
{
|
|
|
|
|
$gameIds = $this->getGameIdsByBaseGame($baseGame, $deviceType);
|
|
|
|
|
|
|
|
|
@ -96,14 +105,21 @@ class GameRepository
|
|
|
|
|
|
|
|
|
|
$subCondition = [
|
|
|
|
|
'game_id' => ['in', $gameIds],
|
|
|
|
|
'_string' => 'tab_user.id=tab_user_play_info.user_id',
|
|
|
|
|
'_string' => 'tab_user_play.user_id=tab_user_play_info.user_id',
|
|
|
|
|
'play_time' => ['egt', $retentionTime],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$subSql = M('user_play_info', 'tab_')->field('1')->where($subCondition)->select(false);
|
|
|
|
|
return M('user', 'tab_')->where([
|
|
|
|
|
'register_time' => ['between', [$timeBegin, $timeEnd]],
|
|
|
|
|
'_string' => 'exists (' . $subSql . ')'
|
|
|
|
|
$sqlStr = 'exists (' . $subSql . ')';
|
|
|
|
|
if ($promote) {
|
|
|
|
|
$promoteService = new PromoteService();
|
|
|
|
|
$sqlStr .= ' and promote_id in (' . $promoteService->subInSql($promote) . ')';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return M('user_play', 'tab_')->where([
|
|
|
|
|
// 'register_time' => ['between', [$timeBegin, $timeEnd]],
|
|
|
|
|
'create_time' => ['between', [$timeBegin, $timeEnd]],
|
|
|
|
|
'_string' => $sqlStr
|
|
|
|
|
])->count();
|
|
|
|
|
}
|
|
|
|
|
}
|