validate([ 'page' => ['nullable', 'integer', 'min:1'], 'limit' => ['nullable', 'integer', 'min:1', 'max:200'], 'member_id' => ['nullable', 'string'], 'first_name' => ['nullable', 'string'], 'login_ip' => ['nullable', 'string'], 'platform' => ['nullable', 'string'], ]); $result = OnlineUserService::list($params); } catch (ValidationException $e) { return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first()); } catch (Exception $e) { return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage()); } return $this->success($result); } /** * 新用户汇总(按天) */ public function newUserSummary() { try { $params = request()->validate([ 'start_time' => ['nullable', 'date', 'date_format:Y-m-d'], 'end_time' => ['nullable', 'date', 'date_format:Y-m-d', 'after_or_equal:start_time'], ]); $endDate = $params['end_time'] ?? date('Y-m-d'); $startDate = $params['start_time'] ?? date('Y-m-d', strtotime($endDate . ' -6 days')); $result = NewUserSummaryService::summarize($startDate, $endDate); } catch (ValidationException $e) { return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first()); } catch (Exception $e) { return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage()); } return $this->success($result); } }