- Add SSO QR status poller and assist platform HTTP client - Add assist-platform session store with 0600 secure permissions - Implement domains/assist-platform (api, services, types) for corporation search, detail, tickets, staff query and passwordless token generation - Implement cli/commands/assist-platform with aliases assist-center and ap - Support seamless --save --switch --elevate pipeline to import tenant and extract persistent OpenAPI credentials - Update embedded skill documentation, reference guide, and test suites
79 lines
2.8 KiB
TypeScript
79 lines
2.8 KiB
TypeScript
import { getCorporationDetail } from "../../../domains/assist-platform/services.js";
|
|
import { stringOption } from "../../parser.js";
|
|
import { printJson, printKeyValue, printTable } from "../../printer.js";
|
|
import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
|
|
import { resolveAssistClient } from "./common.js";
|
|
|
|
export async function handleDetail(
|
|
parsed: CliParsedArgs,
|
|
runtime: CliRuntime
|
|
): Promise<CliResult> {
|
|
const client = resolveAssistClient(parsed, runtime);
|
|
const corpId =
|
|
parsed.args[0] ||
|
|
stringOption(parsed.options, ["corp", "corpid", "id"]) ||
|
|
runtime.selectedCorp?.id;
|
|
|
|
if (!corpId) {
|
|
return {
|
|
stdout: "",
|
|
stderr: "用法: hose-use assist-platform detail <企业ID>\n示例: hose-use assist-platform detail Cxa3oOtQi2eS$g\n",
|
|
exitCode: 1,
|
|
};
|
|
}
|
|
|
|
const detail = await getCorporationDetail(client, corpId);
|
|
|
|
if (runtime.jsonMode) {
|
|
return {
|
|
stdout: printJson(detail, runtime.outputOptions),
|
|
stderr: "",
|
|
exitCode: 0,
|
|
};
|
|
}
|
|
|
|
const corp = detail.corporation || {};
|
|
const basic = detail.basic || {};
|
|
|
|
const summaryPairs: Record<string, string> = {
|
|
企业名称: String(corp.name || "-"),
|
|
企业ID: String(corp.id || corpId),
|
|
基础状态: String(basic.status || corp.state || "-"),
|
|
付费模式: String(corp.payType || "-"),
|
|
部署集群: String(corp.platformName || "app"),
|
|
灰度版本: String(corp.grayver || "-"),
|
|
数据库版本: String(corp.dbVersion || "-"),
|
|
授权人数: String(basic.peopleCount || "-"),
|
|
生效时间: basic.startTime ? new Date(Number(basic.startTime)).toLocaleDateString() : "-",
|
|
到期时间: basic.endTime ? new Date(Number(basic.endTime)).toLocaleDateString() : "-",
|
|
};
|
|
|
|
const packageRows = detail.corporationPackageVos.map((p, i) => [
|
|
String(i + 1),
|
|
p.name,
|
|
p.packageId,
|
|
p.enable ? "🟢 已启用" : "⚪ 未开通",
|
|
]);
|
|
|
|
const packageTable = printTable(["#", "套餐版本", "套餐 ID", "开通状态"], packageRows);
|
|
|
|
const goodsRows = detail.otherGoodsList.slice(0, 30).map((g, i) => [
|
|
String(i + 1),
|
|
String(g.name || "-"),
|
|
String(g.catName || "-"),
|
|
String(g.status || "-"),
|
|
String(g.model || "-"),
|
|
]);
|
|
|
|
const goodsTable = printTable(["#", "商品/功能名称", "业务类别", "状态", "类型"], goodsRows);
|
|
const moreNotice = detail.otherGoodsList.length > 30
|
|
? `\n(已显示前 30 项商品能力,全部 ${detail.otherGoodsList.length} 项可使用 --json 查看)\n`
|
|
: "";
|
|
|
|
return {
|
|
stdout: `====== 企业 [${corpId}] 协助中心全量业务配置 ======\n${printKeyValue(summaryPairs)}\n\n--- 原生套餐包规格 ---\n${packageTable}\n\n--- 已开通商品与扩展能力 ---\n${goodsTable}${moreNotice}\n`,
|
|
stderr: "",
|
|
exitCode: 0,
|
|
};
|
|
}
|