|
|
@@ -6,6 +6,7 @@ namespace app\v1\logic\dataReport;
|
|
|
|
|
|
use app\v1\logic\tool\ToolLogic;
|
|
|
use plugin\saiadmin\basic\BaseLogic;
|
|
|
+use plugin\saiadmin\exception\ApiException;
|
|
|
use plugin\saiadmin\service\OpenSpoutWriter;
|
|
|
use support\think\Db;
|
|
|
|
|
|
@@ -17,6 +18,21 @@ class UserLogLogic extends BaseLogic
|
|
|
{
|
|
|
$params = $this->searchByAuth($where);
|
|
|
|
|
|
+ // 检查注册时间只能查询3个月内
|
|
|
+ if (empty($params['reg_time']) || count($params['reg_time']) != 2) {
|
|
|
+ throw new ApiException('请选择注册时间范围');
|
|
|
+ }
|
|
|
+ $startTime = strtotime($params['reg_time'][0]);
|
|
|
+ $endTime = strtotime($params['reg_time'][1]);
|
|
|
+ if ($endTime < $startTime) {
|
|
|
+ throw new ApiException('注册时间范围不正确');
|
|
|
+ }
|
|
|
+ // 计算时间差,限制为3个月(90天)内
|
|
|
+ $maxDays = 90;
|
|
|
+ if (($endTime - $startTime) > ($maxDays * 86400)) {
|
|
|
+ throw new ApiException('注册时间只能查询3个月内');
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
$tableNames = ToolLogic::getMonthlyTableNames('sdk_reg_log_', $params['reg_time'][0], $params['reg_time'][1]);
|
|
|
|
|
|
@@ -47,6 +63,7 @@ class UserLogLogic extends BaseLogic
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// 分页
|
|
|
return $regLogQuery->paginate($limit)->toArray();
|
|
|
}
|