|
@@ -17,34 +17,27 @@ class UserLogLogic extends BaseLogic
|
|
|
{
|
|
{
|
|
|
$params = $this->searchByAuth($where);
|
|
$params = $this->searchByAuth($where);
|
|
|
|
|
|
|
|
|
|
+ $page = request()->input('page', 10);
|
|
|
$limit = request()->input('limit', 10);
|
|
$limit = request()->input('limit', 10);
|
|
|
|
|
+ $offset = ($page - 1) * $limit;
|
|
|
|
|
+
|
|
|
if(!$params['reg_time']){
|
|
if(!$params['reg_time']){
|
|
|
throw new ApiException("注册时间不能为空");
|
|
throw new ApiException("注册时间不能为空");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 公共处理完的where, 自然量ID, auth_id=0为自然量
|
|
// 公共处理完的where, 自然量ID, auth_id=0为自然量
|
|
|
[$where, $whereRaw] = $this->getUlogCommonWhere($params);
|
|
[$where, $whereRaw] = $this->getUlogCommonWhere($params);
|
|
|
-
|
|
|
|
|
$monthRange = getMonthsBetweenDates($params['reg_time'][0], $params['reg_time'][1]);
|
|
$monthRange = getMonthsBetweenDates($params['reg_time'][0], $params['reg_time'][1]);
|
|
|
|
|
|
|
|
- $query = null;
|
|
|
|
|
|
|
+ $db = Db::connect('db_game_log');
|
|
|
|
|
+ $unionQuery = [];
|
|
|
foreach ($monthRange as $month){
|
|
foreach ($monthRange as $month){
|
|
|
$tableName = 'sdk_reg_log_' . $month;
|
|
$tableName = 'sdk_reg_log_' . $month;
|
|
|
- $monthQuery = Db::connect("db_game_log")->table($tableName)
|
|
|
|
|
- ->field("*")
|
|
|
|
|
- ->where($where)
|
|
|
|
|
- ->whereRaw($whereRaw);
|
|
|
|
|
-
|
|
|
|
|
- // 如果是第一个查询,直接赋值;否则使用 unionAll 合并
|
|
|
|
|
- if ($query === null) {
|
|
|
|
|
- $query = $monthQuery;
|
|
|
|
|
- } else {
|
|
|
|
|
- $query->unionAll($monthQuery);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $unionQuery[] = $db->table($tableName)->field("uid,reg_time,imei,brand")->where($where)->whereRaw($whereRaw)->buildSql();
|
|
|
}
|
|
}
|
|
|
|
|
+ $fullSql = "(" . implode(' UNION ALL ', $unionQuery) . ") as unTable";
|
|
|
|
|
|
|
|
- // 分页
|
|
|
|
|
- return $query->paginate($limit)->toArray();
|
|
|
|
|
|
|
+ return $db->table($fullSql)->paginate($limit)->toArray();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 登录日志
|
|
// 登录日志
|