星盘解释库接口说明

POST https://chart.12sign.top/interpretation

概述

星盘解释库接口允许您直接查询星盘解释语料,无需计算完整的星盘。支持单个查询和批量查询,可以按语料集和星盘类型进行过滤。

重要说明: 本接口专门用于查询解释语料库,与星盘计算接口分离。如果您需要在星盘计算结果中自动包含解释,请使用 /onechart 接口并设置 include_analysis: true。

请求参数

参数名 类型 必需 说明
chartType string 必需 星盘类型,如 "natal"、"solar_return" 等
fallInto object 必需 查询条件对象,包含以下字段:
fallInto.type integer 必需 语料类型:
1 = 行星解释
4 = 行星落宫解释
5 = 行星落座解释
6 = 行星相位解释
7 = 宫头落入星座解释
8 = 宫主飞星解释
fallInto.planet_id integer/string 条件必需 行星ID(type=1,4,5,6,8时需要)。type=8时使用字符串格式 "hr1"~"hr12",代表第1~12宫的宫主星
fallInto.planet_id2 integer 条件必需 第二个行星ID(仅type=6时需要)
fallInto.sign_id integer 条件必需 星座ID(type=5,7时需要)
fallInto.house_id integer 条件必需 宫位ID(type=4,7,8时需要)。type=8时代表宫主星实际落入的宫位
fallInto.degree integer 条件必需 相位度数(仅type=6时需要)
corpusSets array 可选 语料集名称列表,用于过滤查询结果。
returnAll boolean 可选 是否返回所有匹配的语料集结果,默认为 false

请求格式

单个查询格式

{ "chartType": "natal", "fallInto": { "type": 5, "planet_id": 0, "sign_id": 1 }, "corpusSets": ["default"] }

批量查询格式

[ { "chartType": "natal", "fallInto": { "type": 5, "planet_id": 0, "sign_id": 1 } }, { "chartType": "natal", "fallInto": { "type": 6, "planet_id1": 0, "planet_id2": 1, "degree": 180 } } ]

返回参数

参数名 类型 说明
success boolean 请求是否成功
data object/array 解释数据对象(单个查询)或数组(批量查询)
data.type integer 语料类型
data.content string 解释文本内容
data.corpus_set string 语料集名称
data.chart_type string 星盘类型
total integer 批量查询时的总请求数
found integer 批量查询时找到的结果数
error string 错误信息(仅在失败时返回)
code string 错误代码(仅在失败时返回)

返回示例

单个查询成功响应

{ "success": true, "data": { "type": 5, "content": "太阳落在白羊座,象征着新的开始和充满活力的能量...", "corpus_set": "default", "chart_type": "natal" } }

批量查询成功响应

{ "success": true, "data": [ { "type": 5, "content": "太阳落在白羊座,象征着新的开始和充满活力的能量...", "corpus_set": "default", "chart_type": "natal" }, { "type": 6, "content": "太阳与月亮对分相位,代表着意识与情感的冲突...", "corpus_set": "default", "chart_type": "natal" } ], "total": 2, "found": 2 }

错误响应示例

{ "success": false, "error": "未找到匹配的解释语料", "code": "NOT_FOUND" }

行星ID对照表

ID 行星名称 ID 行星名称 ID 行星名称
0太阳 1月亮 2水星
3金星 4火星 5木星
6土星 7天王星 8海王星
9冥王星 10北交点 11真实北交点
12平均莉莉丝 13真实莉莉丝 15凯龙星
16福勒斯 17谷神星 18智神星
19婚神星 20灶神星 100上升点
注意: 更多行星ID请参考完整的星盘系统文档。特殊点如上升点(100)、天顶(101)、福点(109)等也支持查询。

星座ID对照表

ID 星座名称 ID 星座名称 ID 星座名称
1白羊座 2金牛座 3双子座
4巨蟹座 5狮子座 6处女座
7天秤座 8天蝎座 9射手座
10摩羯座 11水瓶座 12双鱼座

常见查询示例

1. 查询行星解释

// 查询太阳解释 { "chartType": "natal", "fallInto": { "type": 1, "planet_id": 0 }, "corpusSets": ["default"] }

2. 查询行星落座解释

// 查询太阳落在白羊座 { "chartType": "natal", "fallInto": { "type": 5, "planet_id": 0, "sign_id": 1 }, "corpusSets": ["default"] }

3. 查询行星落宫解释

// 查询月亮落在一宫 { "chartType": "natal", "fallInto": { "type": 4, "planet_id": 1, "house_id": 1 }, "corpusSets": ["default"] }

4. 查询行星相位解释

// 查询太阳合月亮 { "chartType": "natal", "fallInto": { "type": 6, "planet_id1": 0, "planet_id2": 1, "degree": 0 }, "corpusSets": ["default"] }

5. 查询宫头落入星座解释

// 查询第一宫宫头落在天秤座 { "chartType": "natal", "fallInto": { "type": 7, "house_id": 1, "sign_id": 7 }, "corpusSets": ["default"] }

6. 查询宫主飞星解释

// 查询第一宫宫主星落入第八宫 { "chartType": "natal", "fallInto": { "type": 8, "planet_id": "hr1", "house_id": 8 }, "corpusSets": ["default"] }

Python 测试代码

import requests import json # 单个查询示例 def query_single_interpretation(): url = "https://chart.12sign.top/interpretation" payload = { "chartType": "natal", "fallInto": { "type": 5, "planet_id": 0, "sign_id": 1 }, "corpusSets": ["default"] } response = requests.post(url, json=payload) result = response.json() if result.get("success"): print("解释内容:", result["data"]["content"]) else: print("查询失败:", result.get("error")) # 批量查询示例 def query_batch_interpretations(): url = "https://chart.12sign.top/interpretation" payload = [ { "chartType": "natal", "fallInto": { "type": 5, "planet_id": 0, "sign_id": 1 } }, { "chartType": "natal", "fallInto": { "type": 6, "planet_id1": 0, "planet_id2": 1, "degree": 180 } } ] response = requests.post(url, json=payload) result = response.json() if result.get("success"): print(f"找到 {result['found']} 个解释:") for i, interp in enumerate(result["data"], 1): print(f"{i}. {interp.get('content', '无内容')}") else: print("批量查询失败:", result.get("error")) if __name__ == "__main__": query_single_interpretation() print("-" * 50) query_batch_interpretations()

在线测试

测试解释查询

重要提醒:
相关接口: