|
@@ -4,6 +4,7 @@
|
|
|
|
|
|
|
|
namespace app\v1\logic\dataReport;
|
|
namespace app\v1\logic\dataReport;
|
|
|
|
|
|
|
|
|
|
+use app\exception\ApiException;
|
|
|
use plugin\saiadmin\basic\BaseLogic;
|
|
use plugin\saiadmin\basic\BaseLogic;
|
|
|
use plugin\saiadmin\service\OpenSpoutWriter;
|
|
use plugin\saiadmin\service\OpenSpoutWriter;
|
|
|
use support\think\Db;
|
|
use support\think\Db;
|
|
@@ -16,23 +17,34 @@ class UserLogLogic extends BaseLogic
|
|
|
{
|
|
{
|
|
|
$params = $this->searchByAuth($where);
|
|
$params = $this->searchByAuth($where);
|
|
|
|
|
|
|
|
- $tableName = 'sdk_reg_log_' . date('Ym', strtotime($params['reg_time']));
|
|
|
|
|
$limit = request()->input('limit', 10);
|
|
$limit = request()->input('limit', 10);
|
|
|
-
|
|
|
|
|
- // 获取这一天的注册日志
|
|
|
|
|
- $regLogQuery = Db::connect('db_game_log')->table($tableName);
|
|
|
|
|
|
|
+ if(!$params['reg_time']){
|
|
|
|
|
+ throw new ApiException("注册时间不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 公共处理完的where, 自然量ID, auth_id=0为自然量
|
|
// 公共处理完的where, 自然量ID, auth_id=0为自然量
|
|
|
[$where, $whereRaw] = $this->getUlogCommonWhere($params);
|
|
[$where, $whereRaw] = $this->getUlogCommonWhere($params);
|
|
|
- if($where){
|
|
|
|
|
- $regLogQuery = $regLogQuery->where($where);
|
|
|
|
|
- }
|
|
|
|
|
- if($whereRaw){
|
|
|
|
|
- $regLogQuery = $regLogQuery->whereRaw($whereRaw);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $monthRange = getMonthsBetweenDates($params['reg_time'][0], $params['reg_time'][1]);
|
|
|
|
|
+
|
|
|
|
|
+ $query = null;
|
|
|
|
|
+ foreach ($monthRange as $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);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 分页
|
|
// 分页
|
|
|
- return $regLogQuery->paginate($limit)->toArray();
|
|
|
|
|
|
|
+ return $query->paginate($limit)->toArray();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 登录日志
|
|
// 登录日志
|