# laravel-wisharetec **Repository Path**: guolei19850528/laravel-wisharetec ## Basic Information - **Project Name**: laravel-wisharetec - **Description**: No description available - **Primary Language**: PHP - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-04 - **Last Updated**: 2026-02-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Laravel Wisharetec SaaS 扩展包 一个功能强大的 Laravel 扩展包,用于与 Wisharetec SaaS 平台进行交互,提供便捷的 API 调用方法。 ## 功能特性 ### 基础功能 - 支持登录认证 - 支持令牌自动刷新和缓存 - 支持自定义请求选项 - 支持 SSL 证书验证配置 ### 业务查询功能 - 支持查询社区列表和详情 - 支持查询楼栋列表 - 支持查询房屋列表和详情 - 支持查询停车场列表 - 支持查询停车位列表 - 支持查询业主列表和详情 - 支持查询车辆列表 - 支持查询停车授权审批列表和详情 ## 安装 使用 Composer 安装扩展包: ```bash composer require guolei19850528/laravel-wisharetec ``` ## 配置 在使用扩展包时,需要配置以下信息: - API 基础 URL - 登录账号 - 登录密码 ## 使用示例 ### 初始化客户端 ```php use Guolei19850528\Laravel\Wisharetec\Saas\Biz; // 创建业务客户端实例 $biz = new Biz( account: 'your-account', password: 'your-password', baseUrl: 'https://wisharetec-saas-api.example.com' ); ``` ### 查询社区列表 ```php // 查询社区列表 $communities = $biz->queryCommunities([ 'pageNum' => 1, 'pageSize' => 10, 'conditions' => [ 'fields' => [ 'name' => '社区名称' // 筛选条件 ] ] ]); // 处理查询结果 foreach ($communities['data'] as $community) { echo $community['name'] . PHP_EOL; } ``` ### 查询社区详情 ```php // 查询特定社区的详情 $community = $biz->queryCommunity( id: 'community-id-123' ); // 输出社区详情 echo $community['name'] . ': ' . $community['address']; ``` ### 查询房屋列表 ```php // 查询房屋列表 $houses = $biz->queryHouses([ 'pageNum' => 1, 'pageSize' => 20, 'conditions' => [ 'fields' => [ 'communityId' => 'community-id-123' // 按社区筛选 ] ], 'orderBy' => [ 'buildingNo' => 'asc', 'floorNo' => 'asc', 'houseNo' => 'asc' ] ]); ``` ### 查询业主信息 ```php // 查询业主详情 $owner = $biz->queryPropertyOwner( userId: 'user-id-123', communityId: 'community-id-123', spaceId: 'property-id-123' ); // 输出业主姓名和联系方式 echo '业主姓名: ' . $owner['name'] . PHP_EOL; echo '联系电话: ' . $owner['phone'] . PHP_EOL; ``` ### 查询车辆信息 ```php // 查询车辆列表 $cars = $biz->queryCars([ 'pageNum' => 1, 'pageSize' => 10, 'conditions' => [ 'fields' => [ 'communityId' => 'community-id-123' // 按社区筛选 ] ] ]); ``` ### 查询停车授权审批 ```php // 查询停车授权审批列表 $approvals = $biz->queryParkingAuthApprovals([ 'pageNum' => 1, 'pageSize' => 10, 'conditions' => [ 'fields' => [ 'communityId' => 'community-id-123' ] ] ]); // 查询特定审批的详情 $approvalDetail = $biz->queryParkingAuthApproval( id: 'approval-id-123' ); ``` ## API 文档 ### Biz 类 #### 构造函数 ```php __construct(?string $account = null, ?string $password = null, ?string $baseUrl = null) ``` #### 社区相关方法 ```php // 查询社区列表 queryCommunities(array|Collection|\stdClass|null $data = [], ?array $options = []) // 查询社区详情 queryCommunity(?string $id = null, ?array $options = []) ``` #### 房屋相关方法 ```php // 查询楼栋列表 queryBuildings(array|Collection|\stdClass|null $data = [], ?array $options = []) // 查询房屋列表 queryHouses(array|Collection|\stdClass|null $data = [], ?array $options = []) // 查询房产详情 queryProperty(mixed $id = '', ?array $options = []) ``` #### 停车场相关方法 ```php // 查询停车场列表 queryParkingLots(array|Collection|\stdClass|null $data = [], ?array $options = []) // 查询停车位列表 queryParkingSpaces(array|Collection|\stdClass|null $data = [], ?array $options = []) ``` #### 业主相关方法 ```php // 查询业主列表 queryPropertyOwners(array|Collection|\stdClass|null $data = [], ?array $options = []) // 查询业主详情 queryPropertyOwner(mixed $userId = '', mixed $communityId = '', mixed $spaceId = '', ?array $options = []) ``` #### 车辆相关方法 ```php // 查询车辆列表 queryCars(array|Collection|\stdClass|null $data = [], ?array $options = []) ``` #### 停车授权审批相关方法 ```php // 查询停车授权审批列表 queryParkingAuthApprovals(array|Collection|\stdClass|null $data = [], ?array $options = []) // 查询停车授权审批详情 queryParkingAuthApproval(mixed $id = '', mixed $nodeId = 'node_433279443693', ?array $options = []) ``` ### 基础配置方法 ```php // 设置/获取 API 基础 URL setBaseUrl(?string $baseUrl): static getBaseUrl(): ?string // 设置/获取登录账号 setAccount(?string $account): static getAccount(): ?string // 设置/获取登录密码 setPassword(?string $password): static getPassword(): ?string // 设置/获取认证令牌 setToken(?string $token): static getToken(): ?string // 刷新认证令牌 refreshToken(string $key = '', \DateTimeInterface|\DateInterval|int|null $ttl = 86400 * 180): static ``` ## 注意事项 1. 确保在 Wisharetec SaaS 平台上拥有合法的账号和权限 2. 令牌默认缓存 180 天,可根据实际情况调整 3. 所有 API 调用都有超时设置,默认连接超时 300 秒,请求超时 300 秒,读取超时 3000 秒 4. 默认禁用 SSL 证书验证,生产环境建议开启 5. 请求参数支持数组、Collection 或 stdClass 对象 ## 许可证 MIT License ## 贡献 欢迎提交 Issue 和 Pull Request 来帮助改进这个扩展包。