justdev/lomnio-api-connector 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

justdev/lomnio-api-connector

Composer 安装命令:

composer require justdev/lomnio-api-connector

包简介

Connects WordPress with the Lomnio API.

README 文档

README

WordPress plugin for syncing Lomnio data into local database tables and reading it from theme code.

Installation

Install Composer dependencies inside the plugin directory:

cd wp-content/plugins/lomnio-api-connector
composer install
composer dump-autoload --no-dev

Activate the plugin in WordPress admin:

/wp-admin/plugins.php

Admin Pages

Endpoint management page:

/wp-admin/admin.php?page=lomnio-api-endpoints

This page allows admins to:

  • enable or disable endpoints;
  • set sync frequency;
  • run all syncs manually;
  • run Project or Units sync separately;
  • check Status, Message, and Fetched At.

Hidden API token settings page:

/wp-admin/admin.php?page=lomnio-api-connector

The page is available only to users with manage_options. The API token is stored encrypted in wp_options.

You can paste either a raw token or the full header:

Authorization: Bearer YOUR_API_TOKEN

After saving a valid token, the plugin queues immediate Project and Units sync when the endpoints are active.

Sync

The plugin uses Action Scheduler.

Project action hook:

lomnio_api_connector_sync_project

Units action hook:

lomnio_api_connector_sync_units

Default schedules:

  • Project: once per day;
  • Units: every 10 minutes.

Available schedules include 5 minutes, 10 minutes, 30 minutes, hourly, twice daily, and daily.

Stored Data

Project data is stored in:

{$wpdb->prefix}lomnio_project

The table stores ProjectResource without the API data wrapper.

Units data is stored in:

{$wpdb->prefix}lomnio_units

Units sync uses one detailed list request:

/v1/units?per_page=-1&detailed=true

The plugin does not call:

/v1/units/{unit}

Each unit row stores the detailed UnitResource in list_payload_json and detail_payload_json, plus separate columns for filtering and sorting.

Theme Usage

Project as object:

use LomnioApiConnector\Database\ProjectRepository;

$lomnio_project = new ProjectRepository();

$section['project'] = $lomnio_project->get_project_object();

Project as array:

use LomnioApiConnector\Database\ProjectRepository;

$lomnio_project = new ProjectRepository();

$project = $lomnio_project->get_api_response();

Units list:

use LomnioApiConnector\Database\UnitRepository;

$lomnio_units = new UnitRepository();

$section['units'] = $lomnio_units->get_units();

Units with filters:

use LomnioApiConnector\Database\UnitRepository;

$lomnio_units = new UnitRepository();

$section['units'] = $lomnio_units->get_units(
	array(
		'status' => 'available',
		'floor'  => 2,
	)
);

Single unit by ID:

use LomnioApiConnector\Database\UnitRepository;

$lomnio_units = new UnitRepository();

$section['unit'] = $lomnio_units->get_unit_by_id( 51 );

Single unit by code:

use LomnioApiConnector\Database\UnitRepository;

$lomnio_units = new UnitRepository();

$section['unit'] = $lomnio_units->get_unit_by_code( 'A101' );

Available Unit Filters

get_units() supports these filters:

  • id
  • unit_id
  • code
  • status
  • status_code
  • type
  • layout_type
  • floor
  • floor_number
  • floor_id
  • building_id
  • phase_id
  • room_count

Filter values can be scalar values or arrays:

$units = $lomnio_units->get_units(
	array(
		'status' => array( 'available', 'reserved' ),
		'floor'  => array( 1, 2, 3 ),
	)
);

Direct Authorization Header

If plugin code needs the configured authorization header:

$headers = \LomnioApiConnector\Plugin::instance()
	->secret_storage()
	->get_authorization_headers();

The result is either a headers array or WP_Error.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-06-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固