restore: 恢复 11-06~11-09 本地未提交改动

- libs: 新增 hr_sdk / hotel_report / dingtalk,更新 desktopauto
- controlplane-next: SDK 管理模块(controller/entity/migrations)与前端视图
- electron-shell: 插件同步、注册表、runner 调整
- plugins: XQ0035/XQ0041/XQ0042/XQ0045_XQ0046/XQ0048/XQ0076/XQ0078 等版本更新
- tests/tools: 新增 SDK 兼容性检查与打包工具(sdk_pack.py、sdk_compat_check.py)
This commit is contained in:
2026-11-09 17:27:10 +08:00
parent e4539db9f8
commit 9873eb1963
327 changed files with 29670 additions and 718 deletions
+32 -10
View File
@@ -9,6 +9,8 @@ const registry = require("./registry");
const platformAuth = require("./platform-auth");
const state = require("./state");
const envSync = require("./env-sync");
const sdkSync = require("./sdk-sync");
const { versionLt } = require("./crypto");
const { makeLogger } = require("./logger");
const logger = makeLogger("meta");
@@ -28,8 +30,9 @@ async function accountAllowedPlatforms(account) {
}
}
// 调中心机获取后台维护的场景分类;控制面不可达返回 null(调用方回退本地 plugin.json)
async function accountPluginCategories(account) {
// 调中心机获取插件云端信息(后台分类 / 按账号下发版本 / 通道 test|prod);
// 控制面不可达返回 null(调用方回退本地 plugin.json,且不显示通道徽章)
async function accountPluginCloud(account) {
if (!config.CONTROLPLANE_URL) return null;
try {
const r = await cp.request("GET", "/api/plugins", {
@@ -39,8 +42,13 @@ async function accountPluginCategories(account) {
});
const map = new Map();
for (const p of r.plugins || []) {
const cat = String(p.category || "").trim();
if (cat) map.set(p.id, cat);
map.set(p.id, {
category: String(p.category || "").trim(),
version: String(p.version || p.latest_version || "").trim(),
// 服务端按账号判定:管理员且在测 → test,其余 prod(老版本服务端无此字段则留空)
channel: p.channel === "test" ? "test" : p.channel === "prod" ? "prod" : "",
status: String(p.status || ""),
});
}
return map;
} catch (e) {
@@ -63,17 +71,27 @@ async function buildMeta(account) {
authExpired = true;
}
}
const [cloudCats, allowedPlats] = account
const [cloud, allowedPlats] = account
? await Promise.all([
plugins.length ? accountPluginCategories(account) : Promise.resolve(null),
plugins.length ? accountPluginCloud(account) : Promise.resolve(null),
accountAllowedPlatforms(account),
])
: [null, null];
// 后台分类优先,未配置则保留插件包内 plugin.json 的分类
if (cloudCats) {
// 云端信息回填:后台分类优先(未配置则保留插件包内 plugin.json 的分类);
// 同时下发通道(正式版/测试版)与云端版本,供前端标出「这是测试版还是正式版」
if (cloud) {
plugins = plugins.map((p) => {
const cat = cloudCats.get(p.id);
return cat ? { ...p, category: cat } : p;
const c = cloud.get(p.id);
if (!c) return p;
const localVer = String(p.version || "");
const cloudVer = c.version || "";
return {
...p,
category: c.category || p.category,
channel: c.channel, // test | prod | ""(服务端未下发)
cloud_version: cloudVer, // 按本账号权限应装的云端版本
update_available: !!cloudVer && !!localVer && cloudVer !== localVer && versionLt(localVer, cloudVer),
};
});
}
// 平台在线态:并行 + 单平台 2.5s 兜底,避免外网校验慢时整屏元数据被拖住
@@ -99,6 +117,10 @@ async function buildMeta(account) {
version: envSync.readCurrent() || "",
installed: !!envSync.readCurrent(),
},
// SDK 概要:本地已装版本(id → versions)+ 上次同步结果,供设置页排查"插件跑不起来"
sdks: sdkSync.status(),
sdk_last_sync: sdkSync.lastResult(),
sdk_allow: sdkSync.allowInfo(),
};
}