id; } // 设置id public function setId($id) { $this->id = $id; return $this; } // 获取万能验证码 public function getCustomCode() { return $this->customCode; } // 设置万能验证码 public function setCustomCode($customCode) { $this->customCode = $customCode ?? null; return $this; } // 获取团队昵称 public function getStatus() { return $this->status; } public function setStatus($status) { $this->status = $status; return $this; } // 获取团队昵称 public function getTeamName() { return $this->teamName ?? ''; } public function setTeamName($teamName): ZeroUserRequestEntity { $this->teamName = $teamName; return $this; } // 获取团队长uid public function getTeamUid() { return $this->teamUid; } public function setTeamUid($teamUid): ZeroUserRequestEntity { $this->teamUid = $teamUid; return $this; } // 获取是否移除 public function getIsRemove() { return $this->isRemove; } public function setIsRemove($isRemove): ZeroUserRequestEntity { $this->isRemove = $isRemove; return $this; } /** * 将请求参数转换为数组格式 * 用于数据库操作或API传输 * 动态获取当前类的所有公共属性,使用下划线分割的键名 * * @return array */ public function getArray(): array { $result = []; $reflection = new \ReflectionClass($this); $properties = $reflection->getProperties(\ReflectionProperty::IS_PUBLIC); foreach ($properties as $property) { $propertyName = $property->getName(); // 跳过继承的属性 if ($property->getDeclaringClass()->getName() !== self::class) { continue; } // 将驼峰命名转换为下划线命名 $key = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $propertyName)); // 获取对应的getter方法名 $getterMethod = 'get' . ucfirst($propertyName); if (method_exists($this, $getterMethod)) { $result[$key] = $this->$getterMethod(); } else { // 如果没有对应的getter方法,直接获取属性值 $result[$key] = $this->$propertyName; } } return $result; } }