dsh-metaphysics 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -7
- package/README.md +10 -4
- package/client.js +1376 -51
- package/engine/bazi.js +2 -1
- package/engine/geju.js +84 -46
- package/engine/geo.js +1 -1
- package/engine/index.js +3 -1
- package/engine/interpret.js +1370 -1356
- package/engine/qiongtong.js +1025 -0
- package/engine/tiaohou.js +228 -0
- package/index.js +1 -1
- package/package.json +2 -2
package/engine/interpret.js
CHANGED
|
@@ -1,1356 +1,1370 @@
|
|
|
1
|
-
// 解析与详解模块
|
|
2
|
-
// 输入:任一体系的排盘结果(compute 的返回值)
|
|
3
|
-
// 输出:结构化解析对象 —— { moduleType, system, title, lead, dimensions[], sections[], disclaimer }
|
|
4
|
-
// moduleType:natal(命盘) / divination(卦象) / card(牌阵)
|
|
5
|
-
// dimensions:五个固定维度,每项 { key, label, text, advice }
|
|
6
|
-
// sections:体系专属的附加解读(卦辞爻辞、塔罗整体叙事等)
|
|
7
|
-
// 文案口径:第二人称、温和、只给倾向与建议,不作绝对判断。
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
HEX64, HEX_BY_CORE, TRIGRAM, YAO_POSITION, MOVING_NATURE,
|
|
11
|
-
ZIWEI_STARS, WUXING_INDUSTRY, WUXING_ORGAN, TENGOD_STYLE,
|
|
12
|
-
LIUREN_JIANG, TAROT_ELEMENT_FOCUS, DISCLAIMER,
|
|
13
|
-
} from './interpret-data.js';
|
|
14
|
-
// 生年四化要按年干反查四颗星,四化表只在紫微引擎里定义了一份,这里直接复用,避免两处维护打架
|
|
15
|
-
import { MUTAGEN } from './ziwei.js';
|
|
16
|
-
|
|
17
|
-
// ── 固定五维度 ────────────────────────────────────────────
|
|
18
|
-
export const DIMENSIONS = [
|
|
19
|
-
{ key: 'overall', label: '整体运势' },
|
|
20
|
-
{ key: 'work', label: '工作与职业选择' },
|
|
21
|
-
{ key: 'career', label: '事业发展' },
|
|
22
|
-
{ key: 'love', label: '爱情与感情' },
|
|
23
|
-
{ key: 'health', label: '健康状况' },
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
export const MODULE_TYPE = {
|
|
27
|
-
bazi: 'natal', ziwei: 'natal',
|
|
28
|
-
liuyao: 'divination', meihua: 'divination', daliuren: 'divination',
|
|
29
|
-
tarot: 'card',
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const SYSTEM_LABEL = {
|
|
33
|
-
bazi: '八字', ziwei: '紫微斗数', liuyao: '六爻',
|
|
34
|
-
meihua: '梅花易数', daliuren: '大六壬', tarot: '塔罗',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// ── 询问方向 ────────────────────────────────────────────
|
|
38
|
-
// 问事(六爻 / 梅花 / 大六壬 / 塔罗)时可选的方向。
|
|
39
|
-
// dim 指向五维度里最贴近的一条,会把该维度提到最前并在开头点明问题与方向,避免泛泛而谈。
|
|
40
|
-
export const DIRECTIONS = [
|
|
41
|
-
{ key: 'general', label: '综合', dim: null, focus: '' },
|
|
42
|
-
{ key: 'wealth', label: '财运', dim: 'work', focus: '钱财进出的落点主要看「工作与职业选择」与「事业发展」这两条。' },
|
|
43
|
-
{ key: 'career', label: '事业', dim: 'career', focus: '事业发展这条与你的问题最直接。' },
|
|
44
|
-
{ key: 'love', label: '感情', dim: 'love', focus: '感情这条与你的问题最直接。' },
|
|
45
|
-
{ key: 'health', label: '健康', dim: 'health', focus: '健康这条与你的问题最直接;下面只作提醒,不作任何诊断。' },
|
|
46
|
-
{ key: 'study', label: '学业', dim: 'career', focus: '学业与考试更贴近「事业发展」这条,讲的是长期积累与阶段进展。' },
|
|
47
|
-
{ key: 'travel', label: '出行', dim: 'overall', focus: '出行与迁动更贴近「整体运势」这条,看的是当下这一段的大环境。' },
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
export const DIRECTION_DEFAULT = 'general';
|
|
51
|
-
export const dirOf = (key) => DIRECTIONS.find((d) => d.key === key) || DIRECTIONS[0];
|
|
52
|
-
|
|
53
|
-
/** 归一化「所问之事 + 询问方向」,给出结构与回显串 */
|
|
54
|
-
function askOf(opts) {
|
|
55
|
-
const o = isObj(opts) ? opts : {};
|
|
56
|
-
const question = typeof o.question === 'string' ? o.question.trim().slice(0, 200) : '';
|
|
57
|
-
const d = dirOf(o.direction);
|
|
58
|
-
return {
|
|
59
|
-
question,
|
|
60
|
-
direction: d.key,
|
|
61
|
-
directionLabel: d.label,
|
|
62
|
-
echo: `问题:${question || '(未填写)'} | 询问方向:${d.label}`,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/** 把问题与方向写进解析:聚焦维度提前 + 点明方向 + 引语回显 */
|
|
67
|
-
function applyAsk(dims, ask, lead) {
|
|
68
|
-
const list = Array.isArray(dims) ? dims.slice() : [];
|
|
69
|
-
const d = dirOf(ask && ask.direction);
|
|
70
|
-
if (d.dim) {
|
|
71
|
-
const i = list.findIndex((x) => x && x.key === d.dim);
|
|
72
|
-
if (i > 0) { const hit = list[i]; list.splice(i, 1); list.unshift(hit); }
|
|
73
|
-
if (list[0] && list[0].key === d.dim) {
|
|
74
|
-
const head = ask.question
|
|
75
|
-
? `就你所问的「${ask.question}」来看(${d.label}方向)——${d.focus}`
|
|
76
|
-
: `按${d.label}这个方向看——${d.focus}`;
|
|
77
|
-
list[0] = Object.assign({}, list[0], { text: `${head}${list[0].text}`, focused: true });
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
let l = lead || '';
|
|
81
|
-
if (ask.question) l = `你问的是「${ask.question}」${d.key === 'general' ? '。' : `,方向是${d.label}。`}${l}`;
|
|
82
|
-
else if (d.key !== 'general') l = `方向是${d.label}。${l}`;
|
|
83
|
-
return { dims: list, lead: l };
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// 大运/流年档位 → 走势描述(非绝对判断)
|
|
87
|
-
const TIER_TEXT = {
|
|
88
|
-
大吉: '外部环境对你比较配合,属于可以主动争取的阶段',
|
|
89
|
-
吉: '整体偏顺,适合稳步推进手上的事',
|
|
90
|
-
平: '起伏不大,更适合打基础、补短板',
|
|
91
|
-
忌: '摩擦与消耗偏多,宜守成、减少冒进',
|
|
92
|
-
大忌: '压力相对集中,宜降低预期、先保住基本盘',
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const TIER_ADVICE = {
|
|
96
|
-
大吉: '想做的事可以排进日程,别只停在想法上',
|
|
97
|
-
吉: '按已有节奏走,把一件事做完整比开新头更划算',
|
|
98
|
-
平: '把精力投向积累:技能、资质、人脉都算数',
|
|
99
|
-
忌: '少做大的调整,先把手上的事收尾',
|
|
100
|
-
大忌: '给自己留出缓冲,重要决定不妨往后放一放',
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
// ── 小工具 ────────────────────────────────────────────────
|
|
104
|
-
const isObj = (v) => v && typeof v === 'object';
|
|
105
|
-
const pick = (o, k, d = '') => (isObj(o) && o[k] != null ? o[k] : d);
|
|
106
|
-
const join = (arr, sep = '、') => (Array.isArray(arr) ? arr.filter(Boolean).join(sep) : String(arr || ''));
|
|
107
|
-
|
|
108
|
-
/** 查询卦意:全名 → 核心卦名 → 上下卦取象兜底 */
|
|
109
|
-
export function hexInfo(name, upper, lower) {
|
|
110
|
-
if (HEX64[name]) return { full: name, ...HEX64[name] };
|
|
111
|
-
const core = typeof name === 'string' && name.length > 2 ? name.slice(2) : name;
|
|
112
|
-
if (HEX_BY_CORE[core]) {
|
|
113
|
-
const full = HEX_BY_CORE[core];
|
|
114
|
-
return { full, ...HEX64[full] };
|
|
115
|
-
}
|
|
116
|
-
const u = TRIGRAM[upper] || {};
|
|
117
|
-
const l = TRIGRAM[lower] || {};
|
|
118
|
-
return {
|
|
119
|
-
full: name || '本卦',
|
|
120
|
-
meaning: `${u.nature || upper || ''}在${l.nature || lower || ''}上,${u.trait || ''}遇${l.trait || ''}`.trim(),
|
|
121
|
-
scene: '按上下卦的取象体会这一卦的大意',
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/** 从格局名反推对应的十神(用于匹配行事风格) */
|
|
126
|
-
function godFromPattern(name) {
|
|
127
|
-
const s = String(name || '');
|
|
128
|
-
if (/七杀/.test(s)) return '七杀';
|
|
129
|
-
if (/正官/.test(s)) return '正官';
|
|
130
|
-
if (/正财/.test(s)) return '正财';
|
|
131
|
-
if (/偏财|财格/.test(s)) return '偏财';
|
|
132
|
-
if (/伤官/.test(s)) return '伤官';
|
|
133
|
-
if (/食神|食伤/.test(s)) return '食神';
|
|
134
|
-
if (/正印/.test(s)) return '正印';
|
|
135
|
-
if (/偏印|枭/.test(s)) return '偏印';
|
|
136
|
-
if (/劫财/.test(s)) return '劫财';
|
|
137
|
-
if (/比肩|比劫/.test(s)) return '比肩';
|
|
138
|
-
if (/官/.test(s)) return '正官';
|
|
139
|
-
if (/财/.test(s)) return '偏财';
|
|
140
|
-
if (/印/.test(s)) return '正印';
|
|
141
|
-
return '';
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/** 按爻位取爻辞大意 */
|
|
145
|
-
function yaoGist(pos, moving) {
|
|
146
|
-
const y = YAO_POSITION.find((x) => x.pos === pos) || YAO_POSITION[0];
|
|
147
|
-
return `${y.name}(${y.gist}):${y.tone}${moving ? ';此处发动,' + (moving.yinYang === '阳' ? MOVING_NATURE.yang : MOVING_NATURE.yin) : ''}`;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// ══════════════════════════════════════════════════════════
|
|
151
|
-
// 八字
|
|
152
|
-
// ══════════════════════════════════════════════════════════
|
|
153
|
-
function baziInterpret(r) {
|
|
154
|
-
const dm = isObj(r.dayMaster) ? r.dayMaster : {};
|
|
155
|
-
const st = isObj(r.strength) ? r.strength : {};
|
|
156
|
-
const frame = isObj(r.frame) ? r.frame : {};
|
|
157
|
-
const ys = isObj(frame.yongshen) ? frame.yongshen : {};
|
|
158
|
-
const
|
|
159
|
-
const
|
|
160
|
-
const
|
|
161
|
-
const
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
const
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
const
|
|
190
|
-
const
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
const
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
else cross.push(`当前大运 ${cur.ganzhi} 走${dw}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
if (
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
const
|
|
232
|
-
const
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
{
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
const
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
const
|
|
344
|
-
const
|
|
345
|
-
out
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
else if (!good.includes(curTier) &&
|
|
353
|
-
else out.push('
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
{
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
},
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
function
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
const
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
.
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
const
|
|
509
|
-
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
const
|
|
516
|
-
let
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
const
|
|
530
|
-
|
|
531
|
-
const
|
|
532
|
-
{
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
{
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
: ''
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
const
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
text:
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
const
|
|
679
|
-
{
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
const
|
|
772
|
-
const
|
|
773
|
-
|
|
774
|
-
const
|
|
775
|
-
const
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
]
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
const
|
|
886
|
-
const
|
|
887
|
-
const
|
|
888
|
-
const
|
|
889
|
-
const
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
const
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
const
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
`${
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
const
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
const
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
`${
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
]
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
const
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1
|
+
// 解析与详解模块
|
|
2
|
+
// 输入:任一体系的排盘结果(compute 的返回值)
|
|
3
|
+
// 输出:结构化解析对象 —— { moduleType, system, title, lead, dimensions[], sections[], disclaimer }
|
|
4
|
+
// moduleType:natal(命盘) / divination(卦象) / card(牌阵)
|
|
5
|
+
// dimensions:五个固定维度,每项 { key, label, text, advice }
|
|
6
|
+
// sections:体系专属的附加解读(卦辞爻辞、塔罗整体叙事等)
|
|
7
|
+
// 文案口径:第二人称、温和、只给倾向与建议,不作绝对判断。
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
HEX64, HEX_BY_CORE, TRIGRAM, YAO_POSITION, MOVING_NATURE,
|
|
11
|
+
ZIWEI_STARS, WUXING_INDUSTRY, WUXING_ORGAN, TENGOD_STYLE,
|
|
12
|
+
LIUREN_JIANG, TAROT_ELEMENT_FOCUS, DISCLAIMER,
|
|
13
|
+
} from './interpret-data.js';
|
|
14
|
+
// 生年四化要按年干反查四颗星,四化表只在紫微引擎里定义了一份,这里直接复用,避免两处维护打架
|
|
15
|
+
import { MUTAGEN } from './ziwei.js';
|
|
16
|
+
|
|
17
|
+
// ── 固定五维度 ────────────────────────────────────────────
|
|
18
|
+
export const DIMENSIONS = [
|
|
19
|
+
{ key: 'overall', label: '整体运势' },
|
|
20
|
+
{ key: 'work', label: '工作与职业选择' },
|
|
21
|
+
{ key: 'career', label: '事业发展' },
|
|
22
|
+
{ key: 'love', label: '爱情与感情' },
|
|
23
|
+
{ key: 'health', label: '健康状况' },
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export const MODULE_TYPE = {
|
|
27
|
+
bazi: 'natal', ziwei: 'natal',
|
|
28
|
+
liuyao: 'divination', meihua: 'divination', daliuren: 'divination',
|
|
29
|
+
tarot: 'card',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const SYSTEM_LABEL = {
|
|
33
|
+
bazi: '八字', ziwei: '紫微斗数', liuyao: '六爻',
|
|
34
|
+
meihua: '梅花易数', daliuren: '大六壬', tarot: '塔罗',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// ── 询问方向 ────────────────────────────────────────────
|
|
38
|
+
// 问事(六爻 / 梅花 / 大六壬 / 塔罗)时可选的方向。
|
|
39
|
+
// dim 指向五维度里最贴近的一条,会把该维度提到最前并在开头点明问题与方向,避免泛泛而谈。
|
|
40
|
+
export const DIRECTIONS = [
|
|
41
|
+
{ key: 'general', label: '综合', dim: null, focus: '' },
|
|
42
|
+
{ key: 'wealth', label: '财运', dim: 'work', focus: '钱财进出的落点主要看「工作与职业选择」与「事业发展」这两条。' },
|
|
43
|
+
{ key: 'career', label: '事业', dim: 'career', focus: '事业发展这条与你的问题最直接。' },
|
|
44
|
+
{ key: 'love', label: '感情', dim: 'love', focus: '感情这条与你的问题最直接。' },
|
|
45
|
+
{ key: 'health', label: '健康', dim: 'health', focus: '健康这条与你的问题最直接;下面只作提醒,不作任何诊断。' },
|
|
46
|
+
{ key: 'study', label: '学业', dim: 'career', focus: '学业与考试更贴近「事业发展」这条,讲的是长期积累与阶段进展。' },
|
|
47
|
+
{ key: 'travel', label: '出行', dim: 'overall', focus: '出行与迁动更贴近「整体运势」这条,看的是当下这一段的大环境。' },
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
export const DIRECTION_DEFAULT = 'general';
|
|
51
|
+
export const dirOf = (key) => DIRECTIONS.find((d) => d.key === key) || DIRECTIONS[0];
|
|
52
|
+
|
|
53
|
+
/** 归一化「所问之事 + 询问方向」,给出结构与回显串 */
|
|
54
|
+
function askOf(opts) {
|
|
55
|
+
const o = isObj(opts) ? opts : {};
|
|
56
|
+
const question = typeof o.question === 'string' ? o.question.trim().slice(0, 200) : '';
|
|
57
|
+
const d = dirOf(o.direction);
|
|
58
|
+
return {
|
|
59
|
+
question,
|
|
60
|
+
direction: d.key,
|
|
61
|
+
directionLabel: d.label,
|
|
62
|
+
echo: `问题:${question || '(未填写)'} | 询问方向:${d.label}`,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** 把问题与方向写进解析:聚焦维度提前 + 点明方向 + 引语回显 */
|
|
67
|
+
function applyAsk(dims, ask, lead) {
|
|
68
|
+
const list = Array.isArray(dims) ? dims.slice() : [];
|
|
69
|
+
const d = dirOf(ask && ask.direction);
|
|
70
|
+
if (d.dim) {
|
|
71
|
+
const i = list.findIndex((x) => x && x.key === d.dim);
|
|
72
|
+
if (i > 0) { const hit = list[i]; list.splice(i, 1); list.unshift(hit); }
|
|
73
|
+
if (list[0] && list[0].key === d.dim) {
|
|
74
|
+
const head = ask.question
|
|
75
|
+
? `就你所问的「${ask.question}」来看(${d.label}方向)——${d.focus}`
|
|
76
|
+
: `按${d.label}这个方向看——${d.focus}`;
|
|
77
|
+
list[0] = Object.assign({}, list[0], { text: `${head}${list[0].text}`, focused: true });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
let l = lead || '';
|
|
81
|
+
if (ask.question) l = `你问的是「${ask.question}」${d.key === 'general' ? '。' : `,方向是${d.label}。`}${l}`;
|
|
82
|
+
else if (d.key !== 'general') l = `方向是${d.label}。${l}`;
|
|
83
|
+
return { dims: list, lead: l };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 大运/流年档位 → 走势描述(非绝对判断)
|
|
87
|
+
const TIER_TEXT = {
|
|
88
|
+
大吉: '外部环境对你比较配合,属于可以主动争取的阶段',
|
|
89
|
+
吉: '整体偏顺,适合稳步推进手上的事',
|
|
90
|
+
平: '起伏不大,更适合打基础、补短板',
|
|
91
|
+
忌: '摩擦与消耗偏多,宜守成、减少冒进',
|
|
92
|
+
大忌: '压力相对集中,宜降低预期、先保住基本盘',
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const TIER_ADVICE = {
|
|
96
|
+
大吉: '想做的事可以排进日程,别只停在想法上',
|
|
97
|
+
吉: '按已有节奏走,把一件事做完整比开新头更划算',
|
|
98
|
+
平: '把精力投向积累:技能、资质、人脉都算数',
|
|
99
|
+
忌: '少做大的调整,先把手上的事收尾',
|
|
100
|
+
大忌: '给自己留出缓冲,重要决定不妨往后放一放',
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// ── 小工具 ────────────────────────────────────────────────
|
|
104
|
+
const isObj = (v) => v && typeof v === 'object';
|
|
105
|
+
const pick = (o, k, d = '') => (isObj(o) && o[k] != null ? o[k] : d);
|
|
106
|
+
const join = (arr, sep = '、') => (Array.isArray(arr) ? arr.filter(Boolean).join(sep) : String(arr || ''));
|
|
107
|
+
|
|
108
|
+
/** 查询卦意:全名 → 核心卦名 → 上下卦取象兜底 */
|
|
109
|
+
export function hexInfo(name, upper, lower) {
|
|
110
|
+
if (HEX64[name]) return { full: name, ...HEX64[name] };
|
|
111
|
+
const core = typeof name === 'string' && name.length > 2 ? name.slice(2) : name;
|
|
112
|
+
if (HEX_BY_CORE[core]) {
|
|
113
|
+
const full = HEX_BY_CORE[core];
|
|
114
|
+
return { full, ...HEX64[full] };
|
|
115
|
+
}
|
|
116
|
+
const u = TRIGRAM[upper] || {};
|
|
117
|
+
const l = TRIGRAM[lower] || {};
|
|
118
|
+
return {
|
|
119
|
+
full: name || '本卦',
|
|
120
|
+
meaning: `${u.nature || upper || ''}在${l.nature || lower || ''}上,${u.trait || ''}遇${l.trait || ''}`.trim(),
|
|
121
|
+
scene: '按上下卦的取象体会这一卦的大意',
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** 从格局名反推对应的十神(用于匹配行事风格) */
|
|
126
|
+
function godFromPattern(name) {
|
|
127
|
+
const s = String(name || '');
|
|
128
|
+
if (/七杀/.test(s)) return '七杀';
|
|
129
|
+
if (/正官/.test(s)) return '正官';
|
|
130
|
+
if (/正财/.test(s)) return '正财';
|
|
131
|
+
if (/偏财|财格/.test(s)) return '偏财';
|
|
132
|
+
if (/伤官/.test(s)) return '伤官';
|
|
133
|
+
if (/食神|食伤/.test(s)) return '食神';
|
|
134
|
+
if (/正印/.test(s)) return '正印';
|
|
135
|
+
if (/偏印|枭/.test(s)) return '偏印';
|
|
136
|
+
if (/劫财/.test(s)) return '劫财';
|
|
137
|
+
if (/比肩|比劫/.test(s)) return '比肩';
|
|
138
|
+
if (/官/.test(s)) return '正官';
|
|
139
|
+
if (/财/.test(s)) return '偏财';
|
|
140
|
+
if (/印/.test(s)) return '正印';
|
|
141
|
+
return '';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** 按爻位取爻辞大意 */
|
|
145
|
+
function yaoGist(pos, moving) {
|
|
146
|
+
const y = YAO_POSITION.find((x) => x.pos === pos) || YAO_POSITION[0];
|
|
147
|
+
return `${y.name}(${y.gist}):${y.tone}${moving ? ';此处发动,' + (moving.yinYang === '阳' ? MOVING_NATURE.yang : MOVING_NATURE.yin) : ''}`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// ══════════════════════════════════════════════════════════
|
|
151
|
+
// 八字
|
|
152
|
+
// ══════════════════════════════════════════════════════════
|
|
153
|
+
function baziInterpret(r) {
|
|
154
|
+
const dm = isObj(r.dayMaster) ? r.dayMaster : {};
|
|
155
|
+
const st = isObj(r.strength) ? r.strength : {};
|
|
156
|
+
const frame = isObj(r.frame) ? r.frame : {};
|
|
157
|
+
const ys = isObj(frame.yongshen) ? frame.yongshen : {};
|
|
158
|
+
const cli = r.climate || (isObj(ys.climate) ? ys.climate : (isObj(ys.tiaohou) ? ys.tiaohou : null));
|
|
159
|
+
const wx = isObj(r.wuxing) ? r.wuxing : {};
|
|
160
|
+
const level = pick(st, 'level', '中和');
|
|
161
|
+
const favor = Array.isArray(ys.favor) ? ys.favor : [];
|
|
162
|
+
const avoid = Array.isArray(ys.avoid) ? ys.avoid : [];
|
|
163
|
+
const primary = pick(frame, 'primaryName', '未取定');
|
|
164
|
+
const gender = pick(r.input, 'gender', '');
|
|
165
|
+
const isMale = gender === 'male';
|
|
166
|
+
const spouseKey = isMale ? '财' : '官杀';
|
|
167
|
+
|
|
168
|
+
// 当前大运与流年
|
|
169
|
+
const age = Number(pick(r.liunian?.[0], 'age', NaN));
|
|
170
|
+
const list = Array.isArray(r.dayun?.list) ? r.dayun.list : [];
|
|
171
|
+
let cur = null;
|
|
172
|
+
for (const d of list) {
|
|
173
|
+
if (Number.isFinite(age) && Number(d.startAge) <= age) cur = d;
|
|
174
|
+
}
|
|
175
|
+
if (!cur && list.length) cur = list[0];
|
|
176
|
+
const curLuck = isObj(cur?.luck) ? cur.luck : {};
|
|
177
|
+
const curTier = pick(curLuck, 'tier', '平');
|
|
178
|
+
const ln = isObj(r.liunian?.[0]) ? r.liunian[0] : {};
|
|
179
|
+
const lnLuck = isObj(ln.luck) ? ln.luck : {};
|
|
180
|
+
const lnTier = pick(lnLuck, 'tier', '平');
|
|
181
|
+
|
|
182
|
+
// 十神强弱排序
|
|
183
|
+
const groups = isObj(frame.godStats?.groups) ? frame.godStats.groups : {};
|
|
184
|
+
const top = Object.entries(groups).sort((a, b) => b[1] - a[1]);
|
|
185
|
+
const topName = top[0]?.[0] || '';
|
|
186
|
+
const secondName = top[1]?.[0] || '';
|
|
187
|
+
|
|
188
|
+
// 五行偏枯
|
|
189
|
+
const wxEntries = Object.entries(wx).sort((a, b) => b[1] - a[1]);
|
|
190
|
+
const strongest = wxEntries[0]?.[0] || '';
|
|
191
|
+
const weakest = wxEntries[wxEntries.length - 1]?.[0] || '';
|
|
192
|
+
const missing = Object.keys(wx).filter((k) => Number(wx[k]) === 0);
|
|
193
|
+
|
|
194
|
+
// 未来三步大运
|
|
195
|
+
const idx = cur ? list.indexOf(cur) : -1;
|
|
196
|
+
|
|
197
|
+
// ── 交叉判断:把两三个维度叠起来看,单看任一维度都会得出相反的结论 ──
|
|
198
|
+
const cross = [];
|
|
199
|
+
const GAN_WX = { 甲: '木', 乙: '木', 丙: '火', 丁: '火', 戊: '土', 己: '土', 庚: '金', 辛: '金', 壬: '水', 癸: '水' };
|
|
200
|
+
const ganWx = (gz) => GAN_WX[String(gz || '')[0]] || '';
|
|
201
|
+
const ZHI_WX = { 子: '水', 丑: '土', 寅: '木', 卯: '木', 辰: '土', 巳: '火', 午: '火', 未: '土', 申: '金', 酉: '金', 戌: '土', 亥: '水' };
|
|
202
|
+
// ① 用神 × 当前大运:这十年是「顺着走」还是「顶着走」
|
|
203
|
+
if (cur) {
|
|
204
|
+
const dw = ganWx(cur.ganzhi);
|
|
205
|
+
if (dw) {
|
|
206
|
+
if (favor.includes(dw)) cross.push(`当前大运 ${cur.ganzhi} 走${dw},正是喜用,这十年推事情比平时省力;${topName ? `可把力气放在${topName}对应的事上` : '适合把长期计划铺开'}。`);
|
|
207
|
+
else if (avoid.includes(dw)) cross.push(`当前大运 ${cur.ganzhi} 走${dw},落在忌神上,这十年更适合守成、补短板,不宜大杠杆扩张。`);
|
|
208
|
+
else cross.push(`当前大运 ${cur.ganzhi} 走${dw},既非喜用也非忌神,属于平运,结果更多取决于你在这段里做了什么。`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// ② 五行缺失 × 喜忌:缺的正好是忌神,反而是好事
|
|
212
|
+
if (missing.length) {
|
|
213
|
+
const good = missing.filter((m) => avoid.includes(m));
|
|
214
|
+
const bad = missing.filter((m) => favor.includes(m));
|
|
215
|
+
if (good.length) cross.push(`命局缺 ${good.join('、')},而它正是你的忌神——缺得刚好,不必刻意去补。`);
|
|
216
|
+
if (bad.length) cross.push(`命局缺 ${bad.join('、')},这恰是喜用,是这盘的短板:靠环境、行业与身边人来补,比自己硬扛有效。`);
|
|
217
|
+
}
|
|
218
|
+
// ③ 十神权重 × 格局:主格与最重十神一致=专注,冲突=拉扯
|
|
219
|
+
if (topName && primary) {
|
|
220
|
+
const godOfPattern = godFromPattern(primary);
|
|
221
|
+
if (godOfPattern && topName && godOfPattern === topName) cross.push(`格局 ${primary} 与最重的${topName}一致,说明你的能量集中在同一条线上,长处突出、短板也集中。`);
|
|
222
|
+
else if (godOfPattern) cross.push(`格局 ${primary}(偏${godOfPattern})与最重的${topName}不在一条线上,内在会有两股力气拉扯:一边是格局给你的路,一边是你本能投入最多的事。`);
|
|
223
|
+
}
|
|
224
|
+
// ④ 神煞 × 十神:羊刃与七杀并见,是压力型结构
|
|
225
|
+
const hasRen = Array.isArray(r.shensha) && r.shensha.some((g) => (g.items || []).some((i) => i.name === '羊刃'));
|
|
226
|
+
if (hasRen && Number(groups['官杀'] || 0) >= 1) {
|
|
227
|
+
cross.push('命见羊刃且官杀有力,属压力驱动型:遇强则强,但需要出口,长期憋着容易内耗;运动或竞技类爱好比"忍"更有用。');
|
|
228
|
+
}
|
|
229
|
+
// ⑤ 夫妻宫 × 配偶星:日支与财/官是否同气
|
|
230
|
+
if (r.pillars?.day) {
|
|
231
|
+
const isM = r.input?.gender === 'male';
|
|
232
|
+
const spouseGod = isM ? '财' : '官杀';
|
|
233
|
+
const spVal = Number(groups[spouseGod] || 0);
|
|
234
|
+
const zhiWx = ZHI_WX[r.pillars.day.branch] || '';
|
|
235
|
+
if (spVal >= 2 && zhiWx && favor.includes(zhiWx)) cross.push(`配偶星(${spouseGod})不弱,且日支 ${r.pillars.day.branch} 属喜用,感情中有实际助益,不只看感觉。`);
|
|
236
|
+
else if (spVal === 0) cross.push(`命局不见${spouseGod},感情多靠自己主动创造场景;日支 ${r.pillars.day.branch} 更像"对方的样子"而不是"缘分的强度"。`);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const ahead = idx >= 0 ? list.slice(idx + 1, idx + 4) : list.slice(0, 3);
|
|
240
|
+
// 依据:把每个维度"凭什么这么说"的盘面事实列出来,便于用户核对,也让文案不再是空口断语
|
|
241
|
+
const ev = (...xs) => xs.filter((x) => x != null && x !== '');
|
|
242
|
+
|
|
243
|
+
const dimensions = [
|
|
244
|
+
{
|
|
245
|
+
key: 'overall', label: '整体运势',
|
|
246
|
+
// level 本身已是「身强/偏强/中和/偏弱/身弱」,这里不能再拼一个「身」
|
|
247
|
+
text: `你的日主是${dm.stem}(五行属${dm.element}),命局${level}(${pick(st, 'score', '')} 分)。` +
|
|
248
|
+
`用神取向偏${join(favor)},忌${join(avoid)}——往${join(favor)}的方向走会更省力${ys.tiaohou && ys.tiaohou.note ? `;调候上${ys.tiaohou.note}` : ''}。` +
|
|
249
|
+
`目前走在${pick(cur, 'ganzhi', '当前')}大运(${curTier}),${pick(ln, 'year', '今年')}年流年${pick(ln, 'ganzhi', '')}为${lnTier}。`,
|
|
250
|
+
// 大运与流年各自给建议,不再把两个档位的文案并成一句(曾出现「起伏不大」后面接「留出缓冲」)
|
|
251
|
+
advice: `大运看:${TIER_TEXT[curTier] || TIER_TEXT.平};流年看:${TIER_ADVICE[lnTier] || TIER_ADVICE.平}。大方向定在${join(favor)}相关的领域,会比硬扛${join(avoid)}顺畅一些。`,
|
|
252
|
+
evidence: ev(
|
|
253
|
+
`日主 ${dm.stem}${dm.element}·${level}`,
|
|
254
|
+
st && st.parts && st.parts.season ? `月令 ${st.parts.season.branch}${st.parts.season.element}` : '',
|
|
255
|
+
`喜 ${join(favor)} / 忌 ${join(avoid)}`,
|
|
256
|
+
cur ? `大运 ${cur.ganzhi}·${curTier}` : '',
|
|
257
|
+
ln && ln.ganzhi ? `流年 ${ln.year}${ln.ganzhi}·${lnTier}` : '',
|
|
258
|
+
),
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
key: 'work', label: '工作与职业选择',
|
|
262
|
+
text: `按喜用神看,${join(favor)}这几类方向对你更有利,可参考的行业包括:${favor.slice(0, 2).map((e) => WUXING_INDUSTRY[e] || '').filter(Boolean).join(';') || '暂未取定,可先按兴趣与能力试'}。` +
|
|
263
|
+
`命局主格为${primary},这类结构的人通常${TENGOD_STYLE[godFromPattern(primary)] || '有自己稳定的节奏'}。` +
|
|
264
|
+
`十神中${topName}最重(${top[0]?.[1] ?? ''}),${secondName}次之,说明你在${topName}所代表的事项上投入的精力最多。`,
|
|
265
|
+
advice: `选岗位时可以偏向「${join(favor)}属性 + ${topName}对应的事务」;如果现在的工作明显偏${join(avoid)}且长期让你疲惫,可以参考上面方向做小幅试探,不必立刻大改。`,
|
|
266
|
+
evidence: ev(
|
|
267
|
+
`主格 ${primary}`,
|
|
268
|
+
`喜用五行 ${join(favor)}`,
|
|
269
|
+
top.length ? `十神 ${top.slice(0, 3).map(([k, v]) => `${k}${v}`).join(' ')}` : '',
|
|
270
|
+
),
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
key: 'career', label: '事业发展',
|
|
274
|
+
text: `${primary}的格局,配合十神里${topName}偏旺的结构,事业上更适合${topName === '财' ? '靠业绩与资源积累说话' : topName === '官杀' ? '在有规则的组织里按层级上升' : topName === '印' ? '凭资质、专业与口碑取胜' : topName === '食伤' ? '靠作品、技术与表达打开局面' : '与人并肩、共同承担的方式'}。` +
|
|
275
|
+
`接下来几步大运依次为:${ahead.map((d) => `${d.ganzhi}(${d.luck?.tier || '平'})`).join(' → ') || '暂未排出'},` +
|
|
276
|
+
`整体节奏是${ahead.length && ahead.filter((d) => ['吉', '大吉'].includes(d.luck?.tier)).length >= 2 ? '先抑后扬、后段更顺' : '需要一步步积累,中间偶有起伏'}。`,
|
|
277
|
+
advice: `把${ahead[0]?.ganzhi || '下一步'}这一步当作铺垫期,重点补${topName === '食伤' ? '作品与专业深度' : topName === '官杀' ? '资历与组织内的信任' : '可迁移的能力与资质'};遇到${join(avoid)}过重的年份,优先保住已有成果。`,
|
|
278
|
+
evidence: ev(
|
|
279
|
+
`格局 ${primary}`,
|
|
280
|
+
ahead.length ? `后续大运 ${ahead.map((d) => d.ganzhi).join(' → ')}` : '',
|
|
281
|
+
`当前 ${pick(cur, 'ganzhi', '—')}·${curTier}`,
|
|
282
|
+
),
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
key: 'love', label: '爱情与感情',
|
|
286
|
+
text: `${isMale ? '男命以财星看妻缘' : '女命以官杀看夫缘'},你命局中${isMale ? '财' : '官杀'}的力量为${groups[isMale ? '财' : '官杀'] ?? '—'},` +
|
|
287
|
+
`${Number(groups[isMale ? '财' : '官杀'] || 0) >= 2 ? '缘分出现的机会不算少' : '需要自己主动创造认识人的场景'}。` +
|
|
288
|
+
`日支(配偶宫)为${pick(r.pillars?.day, 'branch', '')},坐${pick(r.pillars?.day, 'zizuo', '')},` +
|
|
289
|
+
`这里的信号是:${Number(groups[isMale ? '财' : '官杀'] || 0) >= 2 ? '关系里你容易被主动靠近,但要留意筛选' : '感情推进偏慢,属于需要经营的类型'}。`,
|
|
290
|
+
advice: `不必急着要结果,先看清自己在关系里最在意什么。${Number(groups[isMale ? '财' : '官杀'] || 0) >= 2 ? '选项多时,明确标准反而更省心' : '可以把社交圈稍微扩大一点,但别为了脱单降低底线'};沟通上多说具体需求,少让对方猜。`,
|
|
291
|
+
evidence: ev(
|
|
292
|
+
`${isMale ? '财' : '官杀'} 权重 ${groups[isMale ? '财' : '官杀'] ?? '—'}`,
|
|
293
|
+
`日支 ${pick(r.pillars?.day, 'branch', '')}·${pick(r.pillars?.day, 'zizuo', '')}`,
|
|
294
|
+
`配偶星 ${isMale ? '财' : '官杀'}`,
|
|
295
|
+
),
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
key: 'health', label: '健康状况',
|
|
299
|
+
text: `五行分布上,${strongest}最旺、${weakest}最弱${missing.length ? `,其中${join(missing)}在命局中没有明现` : ''}。` +
|
|
300
|
+
`按五行与身体的对应,${strongest}偏旺时${WUXING_ORGAN[strongest]?.part || ''}负担相对重(${WUXING_ORGAN[strongest]?.note || ''});` +
|
|
301
|
+
`${weakest}偏弱则${WUXING_ORGAN[weakest]?.part || ''}偏弱一些,是更值得留意的部分。这只是传统命理的取象提示,不是诊断。`,
|
|
302
|
+
advice: `建议把作息规律放在第一位——尤其是睡眠时长尽量稳定;${WUXING_ORGAN[weakest]?.note ? weakest + '对应的' + WUXING_ORGAN[weakest].part + '可以按体检项目关注' : '按常规体检关注'}。任何不适请去看医生,别用命理结论替代检查。`,
|
|
303
|
+
evidence: ev(
|
|
304
|
+
`五行 ${Object.entries(wx).map(([k, v]) => `${k}${v}`).join(' ')}`,
|
|
305
|
+
`最旺 ${strongest} / 最弱 ${weakest}`,
|
|
306
|
+
missing.length ? `缺 ${join(missing)}` : '',
|
|
307
|
+
),
|
|
308
|
+
},
|
|
309
|
+
];
|
|
310
|
+
|
|
311
|
+
const sections = [
|
|
312
|
+
...(cross.length ? [{ key: 'cross', label: '交叉判断', text: cross.join(' ') }] : []),
|
|
313
|
+
{
|
|
314
|
+
key: 'reasoning', label: '看盘顺序',
|
|
315
|
+
// 把「先看什么、后看什么」摊开:用户能照着复核,也避免只给结论不给路径
|
|
316
|
+
text: [
|
|
317
|
+
`① 先看月令:${st.parts && st.parts.season ? `${st.parts.season.branch}月,日主${dm.element}${st.parts.season.word}(${st.parts.season.weight})` : '月令已定'},得旺衰 ${level}(${pick(st, 'score', '—')} 分)。这一步定的是"你有没有力气"。`,
|
|
318
|
+
`② 再定用神:身强则取泄、耗、制——喜${join(favor)}(${join(ys.favorRoles || [])}),忌${join(avoid)}(${join(ys.avoidRoles || [])})。这一步定的是"往哪走省力"。`,
|
|
319
|
+
`③ 看格局:主格${primary}${(() => {
|
|
320
|
+
const others = (Array.isArray(frame.geju) ? frame.geju : []).map((g) => g.name).filter((n) => n && n !== primary);
|
|
321
|
+
return others.length ? `,另有${others.join('、')}` : '';
|
|
322
|
+
})()}。格局与前两步同向时可信度更高;冲突时以用神为先。`,
|
|
323
|
+
`④ 看大运:当前${pick(cur, 'ganzhi', '—')}(${curTier})${ln && ln.year ? `,${ln.year} 年流年${ln.ganzhi}为${lnTier}` : ''}。行运的吉凶不看名字,看它落在喜用还是忌神(下方「时间窗」给了理由)。`,
|
|
324
|
+
`⑤ 落到维度:工作看喜用五行与十神权重;感情看配偶星与日支;健康看最旺与最弱的五行。五维度都只是这套推导的应用,不是另一套算法。`,
|
|
325
|
+
].join('\n'),
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
key: 'timeline', label: '时间窗',
|
|
329
|
+
text: (() => {
|
|
330
|
+
const curSpan = cur && cur.startAge != null ? `${cur.startAge}–${cur.startAge + 9}岁,${curTier}${curLuck.reasons && curLuck.reasons.length ? `;${curLuck.reasons.join(',')}` : ''}` : '—';
|
|
331
|
+
const nextTwo = (ahead || []).slice(0, 2).map((d) => `${d.ganzhi}(${d.startAge}–${d.startAge + 9}岁,${d.luck?.tier || '平'})`).join(' → ') || '—';
|
|
332
|
+
const years = (r.liunian || []).slice(0, 5).map((l) => {
|
|
333
|
+
const lk = isObj(l.luck) ? l.luck : {};
|
|
334
|
+
const why = (lk.reasons || []).slice(0, 2).join(',');
|
|
335
|
+
return `${l.year} ${l.ganzhi}·${l.stemTenGod || ''}·${lk.tier || '平'}${why ? `(${why})` : ''}`;
|
|
336
|
+
}).join(';');
|
|
337
|
+
return `当前大运:${pick(cur, 'ganzhi', '—')}(${curSpan})。后续两步:${nextTwo}。\n近五年流年:${years || '—'}。\n读法:大运管"这十年的大环境",流年管"今年的具体天气";两者打架时,以能否动到用神为准。`;
|
|
338
|
+
})(),
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
key: 'checks', label: '交叉校验',
|
|
342
|
+
text: (() => {
|
|
343
|
+
const favorScore = favor.reduce((sum, el) => sum + (Number(wx[el]) || 0), 0);
|
|
344
|
+
const avoidScore = avoid.reduce((sum, el) => sum + (Number(wx[el]) || 0), 0);
|
|
345
|
+
const out = [];
|
|
346
|
+
out.push(favorScore < avoidScore
|
|
347
|
+
? `喜用合计 ${favorScore.toFixed?.(1) ?? favorScore} 低于忌神合计 ${avoidScore.toFixed?.(1) ?? avoidScore}:原局里"顺风的条件"偏少,靠行运与外部环境补更现实,别硬扛。`
|
|
348
|
+
: `喜用合计 ${favorScore} 不低于忌神合计 ${avoidScore}:原局自带可用的条件,行运只是把它放大或压住。`);
|
|
349
|
+
if (curTier && lnTier) {
|
|
350
|
+
const good = ['吉', '大吉'];
|
|
351
|
+
if (good.includes(curTier) && !good.includes(lnTier)) out.push('大运顺、当年逆:方向可以按大运走,具体动作挑流年的顺月做,不必因为一年不顺就推翻长期计划。');
|
|
352
|
+
else if (!good.includes(curTier) && good.includes(lnTier)) out.push('大运逆、当年顺:今年适合借势处理具体事务,但不宜把长期结构性问题押在这一年解决。');
|
|
353
|
+
else if (!good.includes(curTier) && !good.includes(lnTier)) out.push('大运与流年都偏逆:以守住基本盘为主,减少新增承诺。');
|
|
354
|
+
else out.push('大运与流年同向偏顺:可以把想做但一直拖着的事排上日程。');
|
|
355
|
+
}
|
|
356
|
+
const th = ys.tiaohou && ys.tiaohou.need ? ys.tiaohou : null;
|
|
357
|
+
if (th) {
|
|
358
|
+
out.push(th.clash
|
|
359
|
+
? `调候要${th.need.stem}${th.need.element},扶抑不在喜用里:两套取法有分歧,本盘按调候优先——寒暖失衡时,再补强弱也难受。`
|
|
360
|
+
: `调候要${th.need.stem}${th.need.element},与扶抑用神同向:取用上不打架,${th.need.element}相关的行业与环境优先。`);
|
|
361
|
+
}
|
|
362
|
+
return out.join(' ');
|
|
363
|
+
})(),
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
key: 'yongshen', label: '用神与忌神',
|
|
367
|
+
// detail 里通常已含调候说明,这里不再补一句,避免同一段出现两次「调候上…」
|
|
368
|
+
text: `喜用:${join(favor)}(对应十神:${join(ys.favorTenGods || ys.favorRoles || [])});忌:${join(avoid)}(对应十神:${join(ys.avoidTenGods || ys.avoidRoles || [])})。` +
|
|
369
|
+
`${pick(ys, 'detail', '')}`,
|
|
370
|
+
},
|
|
371
|
+
...(cli ? [{
|
|
372
|
+
key: 'climate', label: '寒暖燥湿',
|
|
373
|
+
text: `${cli.narration}${cli.need
|
|
374
|
+
? `调候取${cli.need.stem}${cli.need.element},忌${cli.avoidElement};${cli.clash ? '与扶抑冲突,本盘以调候为先' : '与扶抑同向'}`
|
|
375
|
+
: '气候平和,调候不作主取'}。`,
|
|
376
|
+
}] : []),
|
|
377
|
+
...(ys.qt ? [{
|
|
378
|
+
key: 'qiongtong', label: '穷通宝鉴',
|
|
379
|
+
text: `${ys.qt.label}:用神 ${ys.qt.yong.join('、')}(首取 ${ys.qt.primary})。原文:「${ys.qt.quote}」` +
|
|
380
|
+
`(《穷通宝鉴》第 ${ys.qt.chapter} 章${ys.qt.note ? ';' + ys.qt.note : ''})`,
|
|
381
|
+
}] : []),
|
|
382
|
+
{
|
|
383
|
+
key: 'geju', label: '格局依据',
|
|
384
|
+
text: (Array.isArray(frame.geju) ? frame.geju : []).map((g) => `${g.name}(${g.kind}):${g.evidence}`).join(';') || '未取到格局',
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
key: 'quant', label: '量化口径',
|
|
388
|
+
text: `本报告的量化只到「档位」:事业看十神权重(${topName} ${top[0]?.[1] ?? '—'})、财富看财星权重(${groups['财'] ?? 0})、感情看配偶星权重(${spouseKey} ${groups[spouseKey] ?? 0});大运/流年用「大吉 / 吉 / 平 / 忌」四档。不换算金额、不给健康诊断——那需要地域、家庭、行业与体检数据,命盘本身推不出来。`,
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
key: 'limits', label: '未纳入',
|
|
392
|
+
text: '本盘没有计算:流月与流日、神煞的加权轻重、地支藏干的动态引化(合冲后再论)。取用按「调候优先、扶抑校验」;调候由月令与全局寒暖燥湿判定,并按《穷通宝鉴》120 格给出用神顺序(整理表口径,原文摘句照录,异文处已标 note);各派取法仍有分歧;真太阳时未含历史时区与夏令时。把这些补上会改变"强弱"的边际判断,所以这里只给方向,不下断语。',
|
|
393
|
+
},
|
|
394
|
+
];
|
|
395
|
+
|
|
396
|
+
// 一页读懂:报告顶部的五条结论(整体 / 事业 / 财富 / 感情 / 节奏)。
|
|
397
|
+
// 只做「摘要」,不引入新判断——全部取自下面已经算好的字段。
|
|
398
|
+
const outline = [
|
|
399
|
+
{ key: 'overall', label: '整体', text: `${level},喜${join(favor) || '—'}、忌${join(avoid) || '—'}` },
|
|
400
|
+
{ key: 'career', label: '事业', text: `主格${primary},${topName}偏旺` },
|
|
401
|
+
{ key: 'wealth', label: '财富', text: `财星权重 ${groups['财'] ?? 0}${favor.includes('金') ? ',喜金助财' : ''}` },
|
|
402
|
+
{ key: 'love', label: '感情', text: `${spouseKey}星权重 ${groups[spouseKey] ?? 0},日支 ${pick(r.pillars?.day, 'branch', '—')}` },
|
|
403
|
+
{ key: 'rhythm', label: '节奏', text: `当前${pick(cur, 'ganzhi', '—')}(${curTier}),${pick(ln, 'year', '')} ${pick(ln, 'ganzhi', '')}(${lnTier})` },
|
|
404
|
+
];
|
|
405
|
+
// 三张表:大运 / 流年 / 触发事件。都是「把已有字段摊平」,不新增算法。
|
|
406
|
+
const tables = [
|
|
407
|
+
{
|
|
408
|
+
key: 'dayun', title: '大运表', columns: ['大运', '年龄', '十神', '档位', '理由'],
|
|
409
|
+
rows: list.map((d) => [d.ganzhi, `${d.startAge}–${d.startAge + 9}`, d.stemTenGod || '', d.luck?.tier || '平', (d.luck?.reasons || []).join(',')]),
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
key: 'liunian', title: '流年表(近十年)', columns: ['年份', '干支', '十神', '档位', '与原局'],
|
|
413
|
+
rows: (r.liunian || []).slice(0, 10).map((l) => [String(l.year), l.ganzhi, l.stemTenGod || '', l.luck?.tier || '平', (l.relations || []).join('、')]),
|
|
414
|
+
},
|
|
415
|
+
];
|
|
416
|
+
const triggerRows = (r.liunian || [])
|
|
417
|
+
.filter((l) => Array.isArray(l.relations) && l.relations.length)
|
|
418
|
+
.slice(0, 10)
|
|
419
|
+
.map((l) => [String(l.year), l.relations.join('、'), `流年${l.ganzhi}与原局地支:${l.relations.join('、')}`]);
|
|
420
|
+
if (triggerRows.length) {
|
|
421
|
+
tables.push({ key: 'triggers', title: '触发事件表', columns: ['年份', '触发', '依据'], rows: triggerRows });
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return {
|
|
425
|
+
lead: `下面按五个维度拆开说。所有内容来自你这张命盘的结构,讲的是倾向与建议,不是预言——方向供你参考,怎么走在你自己。`,
|
|
426
|
+
dimensions, sections, outline, tables,
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// ══════════════════════════════════════════════════════════
|
|
431
|
+
// 紫微斗数
|
|
432
|
+
// ══════════════════════════════════════════════════════════
|
|
433
|
+
const ZW_MAIN = Object.keys(ZIWEI_STARS);
|
|
434
|
+
|
|
435
|
+
function zwPalace(r, name) {
|
|
436
|
+
return (r.palaces || []).find((p) => p.palace === name) || null;
|
|
437
|
+
}
|
|
438
|
+
function zwMainStar(p) {
|
|
439
|
+
if (!p) return null;
|
|
440
|
+
const s = (p.stars || []).find((x) => ZW_MAIN.includes(x.name));
|
|
441
|
+
return s ? s.name : null;
|
|
442
|
+
}
|
|
443
|
+
function zwSha(p) {
|
|
444
|
+
return (p?.stars || []).filter((s) => s.type === '煞星').map((s) => s.name);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// 四化的固定读法顺序:禄 → 权 → 科 → 忌
|
|
448
|
+
const SIHUA_ORDER = ['禄', '权', '科', '忌'];
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* 取本盘的生年四化(年干四化)落宫清单,按 禄权科忌 排序。
|
|
452
|
+
* 落宫以盘面上真正标出的 mutagen 为准;若该星在这张盘里没有落点(辅星偶有此情况),
|
|
453
|
+
* palace 返回 null —— 交给文案如实写成「未上盘」,绝不补一个宫位上去。
|
|
454
|
+
* @param {object} r 紫微排盘结果
|
|
455
|
+
* @returns {Array<{star: string, type: string, palace: string|null}>} 生年四化清单
|
|
456
|
+
*/
|
|
457
|
+
function zwNatalSihua(r) {
|
|
458
|
+
const palaces = Array.isArray(r?.palaces) ? r.palaces : [];
|
|
459
|
+
|
|
460
|
+
// 星名 → {type, palace}:一宫可能同时坐两颗化星(如迁移宫天机化禄 + 太阴化忌),按星名去重
|
|
461
|
+
const placed = new Map();
|
|
462
|
+
for (const p of palaces) {
|
|
463
|
+
for (const s of (p.stars || [])) {
|
|
464
|
+
if (!s || !s.mutagen || placed.has(s.name)) continue;
|
|
465
|
+
placed.set(s.name, { type: s.mutagen, palace: p.palace || null });
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// 年干四化表:用来补齐「盘上没有落点」的那几颗,以及保证输出顺序
|
|
470
|
+
const ganzhi = pick(r, 'yearGanzhi', '');
|
|
471
|
+
const yearStem = typeof ganzhi === 'string' ? ganzhi.slice(0, 1) : '';
|
|
472
|
+
const table = MUTAGEN[yearStem] || {};
|
|
473
|
+
const starOfType = {};
|
|
474
|
+
for (const [star, type] of Object.entries(table)) starOfType[type] = star;
|
|
475
|
+
|
|
476
|
+
const out = [];
|
|
477
|
+
for (const type of SIHUA_ORDER) {
|
|
478
|
+
// 年干表查不到时退回到盘面自身标注的那一颗
|
|
479
|
+
let star = starOfType[type] || '';
|
|
480
|
+
if (!star) {
|
|
481
|
+
for (const [name, info] of placed) {
|
|
482
|
+
if (info.type === type) { star = name; break; }
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
if (!star) continue;
|
|
486
|
+
const hit = placed.get(star);
|
|
487
|
+
out.push({ star, type, palace: hit ? hit.palace : null });
|
|
488
|
+
}
|
|
489
|
+
return out;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* 把四化清单拼成一句人话。palace 为 null 时写「未上盘」。
|
|
494
|
+
* @param {Array<{star: string, type: string, palace: string|null}>} list 四化清单
|
|
495
|
+
* @returns {string} 如「天机化禄于迁移、天梁化权于夫妻、紫微化科于疾厄、太阴化忌于迁移」
|
|
496
|
+
*/
|
|
497
|
+
function zwSihuaText(list) {
|
|
498
|
+
if (!Array.isArray(list) || !list.length) return '';
|
|
499
|
+
return list
|
|
500
|
+
.map((m) => (m.palace ? `${m.star}化${m.type}于${m.palace}` : `${m.star}化${m.type}(未上盘)`))
|
|
501
|
+
.join('、');
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
function ziweiInterpret(r) {
|
|
505
|
+
const soul = zwPalace(r, '命宫') || (r.palaces || [])[0];
|
|
506
|
+
const career = zwPalace(r, '官禄');
|
|
507
|
+
const wealth = zwPalace(r, '财帛');
|
|
508
|
+
const spouse = zwPalace(r, '夫妻');
|
|
509
|
+
const health = zwPalace(r, '疾厄');
|
|
510
|
+
const move = zwPalace(r, '迁移');
|
|
511
|
+
|
|
512
|
+
// 命宫主星:命宫无主星时借对宫(迁移),再退到命主星;同时记下来源,避免与「命无正曜」格局打架
|
|
513
|
+
const soulOwn = zwMainStar(soul);
|
|
514
|
+
const moveStar = zwMainStar(move);
|
|
515
|
+
const lifeM = ZW_MAIN.includes(pick(r, 'lifeMaster')) ? r.lifeMaster : null;
|
|
516
|
+
let soulStar = soulOwn || moveStar || lifeM || '紫微';
|
|
517
|
+
const soulFrom = soulOwn
|
|
518
|
+
? `你的命宫主星是${soulStar}`
|
|
519
|
+
: moveStar
|
|
520
|
+
? `你的命宫无正曜,按紫微的规则借对宫(迁移)来看,主星是${soulStar}`
|
|
521
|
+
: `你的命宫与对宫都没有正曜,这里按命主星${soulStar}来看`;
|
|
522
|
+
const S = ZIWEI_STARS[soulStar] || ZIWEI_STARS.紫微;
|
|
523
|
+
|
|
524
|
+
const careerStar = zwMainStar(career);
|
|
525
|
+
const wealthStar = zwMainStar(wealth);
|
|
526
|
+
const spouseStar = zwMainStar(spouse);
|
|
527
|
+
const healthStar = zwMainStar(health);
|
|
528
|
+
|
|
529
|
+
const age = Number(pick(r.liunian?.[0], 'age', NaN));
|
|
530
|
+
let daxianPalace = null;
|
|
531
|
+
for (const p of r.palaces || []) {
|
|
532
|
+
const d = p.daxian || {};
|
|
533
|
+
if (Number.isFinite(age) && Number(d.start) <= age && age <= Number(d.end)) daxianPalace = p;
|
|
534
|
+
}
|
|
535
|
+
const patterns = Array.isArray(r.patterns) ? r.patterns : [];
|
|
536
|
+
const patText = patterns.length
|
|
537
|
+
? patterns.slice(0, 3).map((p) => `${p.name}(${p.tone === 'good' ? '偏吉' : p.tone === 'bad' ? '需留意' : '中性'}:${p.evidence})`).join(';')
|
|
538
|
+
: '本盘未触发常见格局条目';
|
|
539
|
+
// 流年四化:四项全列,不要截断 —— 少了化科/化忌会让用户以为盘子算漏了
|
|
540
|
+
const lnMutagen = Array.isArray(r.liunian?.[0]?.mutagen) ? r.liunian[0].mutagen.slice(0, 4).join('、') : '';
|
|
541
|
+
// 生年四化:这才是用户最想看到的部分——自己盘上的化科落在哪颗星、哪个宫
|
|
542
|
+
const natalSihua = zwNatalSihua(r);
|
|
543
|
+
const natalSihuaText = zwSihuaText(natalSihua);
|
|
544
|
+
|
|
545
|
+
const dimensions = [
|
|
546
|
+
{
|
|
547
|
+
key: 'overall', label: '整体运势',
|
|
548
|
+
text: `${soulFrom},性格底色上${S.trait}。本盘${patText}。` +
|
|
549
|
+
`当前大限走在${daxianPalace ? `${daxianPalace.palace}(${daxianPalace.daxian.start}–${daxianPalace.daxian.end}岁)` : '当前阶段'},` +
|
|
550
|
+
`${lnMutagen ? `流年四化为${lnMutagen},本年的变化感主要落在这几颗星上` : '流年四化信号不明显'}。` +
|
|
551
|
+
(r.flow ? `再往下一层,当前流月命宫是${r.flow.month.ganzhi},落在原局${r.flow.month.palace || '未上盘'},本月的变化更容易在这一宫代表的事情上显出来。` : '') +
|
|
552
|
+
(natalSihuaText
|
|
553
|
+
? `另外你本命的生年四化落在:${natalSihuaText}——这是你这辈子比较稳定的底色,不随某一年改变。`
|
|
554
|
+
: ''),
|
|
555
|
+
advice: `这一阶段的主题更接近「${daxianPalace ? daxianPalace.palace : '命宫'}」代表的事——把它当作今年的主线,其余事围绕它安排;${S.trait}是你的优势,也是需要留意别用过头的地方。`,
|
|
556
|
+
evidence: [
|
|
557
|
+
`命宫 ${soulStar}${soulOwn ? '' : '(借对宫)'}`,
|
|
558
|
+
daxianPalace ? `大限 ${daxianPalace.palace} ${daxianPalace.daxian.start}–${daxianPalace.daxian.end}岁` : '',
|
|
559
|
+
lnMutagen ? `流年四化 ${lnMutagen}` : '',
|
|
560
|
+
`格局 ${patterns.length} 条`,
|
|
561
|
+
].filter(Boolean),
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
key: 'work', label: '工作与职业选择',
|
|
565
|
+
text: `命宫${soulStar}给出的是底层偏好:${S.work}。官禄宫${careerStar ? `主星为${careerStar},${ZIWEI_STARS[careerStar]?.work || '有其自身的做事方式'}` : '无正曜,工作方式更多受环境与他人影响,适合配合型岗位'}。` +
|
|
566
|
+
`两者合起来看,你更适合${careerStar && careerStar !== soulStar ? `用${soulStar}的方式去做${careerStar}擅长的事` : '在稳定的框架里发挥自己的特点'}。`,
|
|
567
|
+
advice: `挑工作时可以优先看岗位内容是否匹配上面这条;如果暂时不能换,试着在现有岗位里争取靠近这部分的事务,会比硬熬更容易做出成绩。`,
|
|
568
|
+
evidence: [`命宫 ${soulStar}`, `官禄 ${careerStar || '无正曜'}`, `财帛 ${wealthStar || '无正曜'}`],
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
key: 'career', label: '事业发展',
|
|
572
|
+
text: `财帛宫${wealthStar ? `见${wealthStar},${ZIWEI_STARS[wealthStar]?.trait || ''}` : '无正曜'},官禄宫${careerStar || '无正曜'},` +
|
|
573
|
+
`${wealthStar && careerStar ? '财与事业两宫都有主星坐守,说明这两块是可以主动经营的部分' : '有一宫无主星,说明该块更容易受外部条件牵动,宜借势而非强求'}。` +
|
|
574
|
+
`大限推进上,${daxianPalace ? `目前落在${daxianPalace.palace}` : '当前阶段'},下一步会转入相邻的宫位,重心也会跟着挪。`,
|
|
575
|
+
advice: `事业上建议做两件事:一是把可积累的东西(技能、资质、作品)做厚;二是${careerStar ? `发挥${careerStar}的优势——${ZIWEI_STARS[careerStar]?.trait || ''}` : '找一个能带你的前辈或平台'}。遇到四化化忌的年份,先守成再谈扩张。`,
|
|
576
|
+
evidence: [
|
|
577
|
+
`财帛 ${wealthStar || '无正曜'}`,
|
|
578
|
+
`官禄 ${careerStar || '无正曜'}`,
|
|
579
|
+
daxianPalace ? `当前大限 ${daxianPalace.palace}` : '',
|
|
580
|
+
].filter(Boolean),
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
key: 'love', label: '爱情与感情',
|
|
584
|
+
text: `夫妻宫${spouseStar ? `主星为${spouseStar},感情上的倾向是${ZIWEI_STARS[spouseStar]?.love || '有自己相处的节奏'}` : '无正曜,关系状态更多由对方与互动方式决定'}。` +
|
|
585
|
+
`${zwSha(spouse).length ? `夫妻宫同时见${join(zwSha(spouse))},相处中容易出现摩擦或第三者干扰的暗示,但煞星不等于定局,更多是提醒你留意沟通方式` : '夫妻宫未见明显煞星,关系的基调相对平顺'}。`,
|
|
586
|
+
advice: `感情里${spouseStar ? `参考${spouseStar}的特点:${ZIWEI_STARS[spouseStar]?.love || ''}` : '可以更主动地表达自己的需求'}。有分歧时先说清事实与感受,别急着下结论;关系的好坏取决于两个人怎么做,不取决于这张盘。`,
|
|
587
|
+
evidence: [
|
|
588
|
+
`夫妻宫 ${spouseStar || '无正曜'}`,
|
|
589
|
+
`煞星 ${join(zwSha(spouse)) || '无'}`,
|
|
590
|
+
`夫妻宫支 ${spouse && spouse.branch ? spouse.branch : '—'}`,
|
|
591
|
+
],
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
key: 'health', label: '健康状况',
|
|
595
|
+
text: `疾厄宫${healthStar ? `见${healthStar},传统取象上${ZIWEI_STARS[healthStar]?.health || '需要留意自身的薄弱环节'}` : '无正曜,身体状态更多受生活作息直接影响'}。` +
|
|
596
|
+
`${zwSha(health).length ? `同时见${join(zwSha(health))},提示这一块值得比其他部位多一分留意。` : ''}这些都是象征性的提示,不构成任何医学判断。`,
|
|
597
|
+
advice: `把${healthStar ? ZIWEI_STARS[healthStar]?.health?.replace('留意', '').replace('需要留意', '') || '常规' : '常规'}当作体检时重点关注的参考;真正管用的还是规律作息、适度运动与定期检查。身体不舒服请直接就医。`,
|
|
598
|
+
evidence: [
|
|
599
|
+
`疾厄宫 ${healthStar || '无正曜'}`,
|
|
600
|
+
`煞星 ${join(zwSha(health)) || '无'}`,
|
|
601
|
+
],
|
|
602
|
+
},
|
|
603
|
+
];
|
|
604
|
+
|
|
605
|
+
const sections = [
|
|
606
|
+
{ key: 'palaces', label: '关键宫位', text: `命宫${soulStar} 官禄${careerStar || '无正曜'} 财帛${wealthStar || '无正曜'} 夫妻${spouseStar || '无正曜'} 疾厄${healthStar || '无正曜'}` },
|
|
607
|
+
{ key: 'patterns', label: '格局', text: patText },
|
|
608
|
+
{
|
|
609
|
+
key: 'reasoning', label: '看盘顺序',
|
|
610
|
+
text: [
|
|
611
|
+
`① 先看命宫:${soulFrom}${S.trait ? `,底色是「${S.trait}」` : ''}。命宫回答的是"你是谁",不是"会遇到什么"。`,
|
|
612
|
+
`② 再看三方四正:${(soul && soul.sanfang) ? soul.sanfang.join('、') : '命/财/官/迁'},会到的主星是${(() => {
|
|
613
|
+
const names = (soul && soul.sanfang ? soul.sanfang : [])
|
|
614
|
+
.map((n) => zwMainStar(zwPalace(r, n)))
|
|
615
|
+
.filter(Boolean);
|
|
616
|
+
const uniq = [...new Set(names)];
|
|
617
|
+
return uniq.length ? uniq.join('、') : '无正曜';
|
|
618
|
+
})()}——这是你与外界打交道时的常用手法。`,
|
|
619
|
+
natalSihuaText ? `③ 生年四化:${natalSihuaText}。四化比星曜更能指出"你在意什么、哪里会反复"。` : '③ 生年四化:本盘四化信号不明显。',
|
|
620
|
+
`④ 大限:${daxianPalace ? `${daxianPalace.palace}(${daxianPalace.daxian.start}–${daxianPalace.daxian.end}岁)` : '当前阶段'}。紫微里大限比流年重:十年的主题定下来,流年只是其中一年的天气。`,
|
|
621
|
+
lnMutagen ? `⑤ 流年四化:${lnMutagen}${r.flow && r.flow.month ? `;流月命宫 ${r.flow.month.ganzhi}${r.flow.month.palace ? `(${r.flow.month.palace})` : ''}` : ''}。` : '⑤ 流年四化:信号不明显。',
|
|
622
|
+
'⑥ 落到维度:工作看命宫与官禄的配合;感情看夫妻宫与煞星;健康看疾厄宫——五维度都是上面几步的应用。',
|
|
623
|
+
].join('\n'),
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
key: 'timeline', label: '时间窗',
|
|
627
|
+
text: (() => {
|
|
628
|
+
const list = (r.daxianList || []).slice().sort((a, b) => a.ages[0] - b.ages[0]);
|
|
629
|
+
const idx = list.findIndex((d) => Number.isFinite(age) && age >= d.ages[0] && age <= d.ages[1]);
|
|
630
|
+
const pick3 = list.slice(idx >= 0 ? idx : 0, (idx >= 0 ? idx : 0) + 3);
|
|
631
|
+
const dx = pick3.map((d) => `${d.palace} ${d.ages[0]}–${d.ages[1]}岁·会${(d.mainStars || []).join('') || '—'}${(d.mutagenHits || []).length ? `·${d.mutagenHits.map((m) => m.star + m.type).join('')}` : ''}`).join(' → ');
|
|
632
|
+
const yrs = (r.liunian || []).slice(0, 5).map((l) => `${l.year} ${l.ganzhi} ${l.age}岁·命宫${l.lifePalace ? l.lifePalace.palace : '—'}`).join(';');
|
|
633
|
+
return `大限:${dx || '—'}。\n近五年流年:${yrs || '—'}。\n读法:大限定十年的主题,流年四化指出今年往哪边偏;两层方向相反时,以守住大限主题为主。`;
|
|
634
|
+
})(),
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
key: 'quant', label: '量化口径',
|
|
638
|
+
text: '紫微这边只数「宫位里有什么」:大限看落宫与四化命中数、流年看命宫与四化星数;不把星曜折算成分数,也不预测金额与疾病诊断。四化命中数只是结构计数,不等于吉凶强度。',
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
key: 'limits', label: '未纳入',
|
|
642
|
+
text: '本盘没有计算:飞星四化(宫干引发的连锁)、小限与大限的加权、流日流时的具体事项定位,以及双星组合的强弱细分。四化表取中州派常用口径,其他流派(如飞星派)结论会不同;这些不改变盘面事实,只影响轻重,所以只作方向参考。',
|
|
643
|
+
},
|
|
644
|
+
];
|
|
645
|
+
if (natalSihua.length) {
|
|
646
|
+
const ke = natalSihua.find((m) => m.type === '科') || null;
|
|
647
|
+
// 宫位名本身可能已带「宫」(如命宫),拼的时候别叠出「命宫宫」
|
|
648
|
+
const palaceWord = (p) => `${p}${String(p).endsWith('宫') ? '' : '宫'}`;
|
|
649
|
+
const kePart = ke
|
|
650
|
+
? `其中化科是${ke.star}${ke.palace ? `落在${palaceWord(ke.palace)}` : '未上盘'},`
|
|
651
|
+
: '';
|
|
652
|
+
sections.push({
|
|
653
|
+
key: 'sihua', label: '生年四化',
|
|
654
|
+
text: `你出生年的天干定下四颗化星,落在:${natalSihuaText}。` +
|
|
655
|
+
`读法上,化禄的宫位做起来比较顺手、也容易有人帮忙;化权的宫位偏向由你拿主意、但也更容易用力过猛;化科的宫位自带一层体面与贵人缘,遇到事多半能体面收场;化忌的宫位是你容易在意、也容易反复的地方。` +
|
|
656
|
+
`${kePart}这几处只是长期倾向,落到具体某一年还要配上流年四化一起看,不必把它当成结论。`,
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
// 流月/流日/流时:流年只回答「今年」,再往下才是「这个月」「这两天」
|
|
661
|
+
if (r.flow) {
|
|
662
|
+
const f = r.flow;
|
|
663
|
+
const at = (p) => `${p.ganzhi || '—'}${p.palace ? `落${p.palace}` : ''}`;
|
|
664
|
+
const hits = (p) => (p.mutagenHits || []).map((m) => `${m.star}化${m.type}${m.palace ? `→${m.palace}` : ''}`).join('、');
|
|
665
|
+
sections.push({
|
|
666
|
+
key: 'flow',
|
|
667
|
+
label: '流月 · 流日 · 流时',
|
|
668
|
+
text: `以 ${f.asOf.solar}(农历 ${f.asOf.lunar},流年 ${f.asOf.yearGanzhi},斗君 ${f.year.doujun})为准往下推:` +
|
|
669
|
+
`流月命宫 ${at(f.month)},四化 ${hits(f.month) || '不明显'};` +
|
|
670
|
+
`流日命宫 ${at(f.day)},四化 ${hits(f.day) || '不明显'};` +
|
|
671
|
+
`流时命宫 ${at(f.hour)},四化 ${hits(f.hour) || '不明显'}。` +
|
|
672
|
+
`这三层的读法不一样:流月管的是一整个月的节奏,适合拿来做「这个月该推进还是该收」的判断;` +
|
|
673
|
+
`流日和流时颗粒度太细,更容易被临时因素打断,看它们不如说是在看「今明两天的情绪底色」,不必逐条对号入座。`,
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// 一页读懂:五条结论(整体 / 事业 / 财富 / 感情 / 节奏),全部取自下面已算好的字段
|
|
678
|
+
const outline = [
|
|
679
|
+
{ key: 'overall', label: '整体', text: `命宫${soulStar}${soulOwn ? '' : '(借对宫)'}${S.trait ? `,${S.trait}` : ''}` },
|
|
680
|
+
{ key: 'career', label: '事业', text: `官禄${careerStar || '无正曜'}` },
|
|
681
|
+
{ key: 'wealth', label: '财富', text: `财帛${wealthStar || '无正曜'}` },
|
|
682
|
+
{ key: 'love', label: '感情', text: `夫妻${spouseStar || '无正曜'}` },
|
|
683
|
+
{
|
|
684
|
+
key: 'rhythm', label: '节奏',
|
|
685
|
+
text: daxianPalace && daxianPalace.daxian
|
|
686
|
+
? `当前大限${daxianPalace.palace}(${daxianPalace.daxian.start}–${daxianPalace.daxian.end}岁)${r.liunian?.[0]?.year ? `,${r.liunian[0].year} 流年` : ''}`
|
|
687
|
+
: '当前大限未取到',
|
|
688
|
+
},
|
|
689
|
+
];
|
|
690
|
+
// 三张表:大限 / 流年 / 触发事件(大限四化)。只摊平已有字段,不加新判断。
|
|
691
|
+
const daxianSorted = (r.daxianList || []).slice().sort((a, b) => a.ages[0] - b.ages[0]);
|
|
692
|
+
const tables = [
|
|
693
|
+
{
|
|
694
|
+
key: 'daxian', title: '大限表', columns: ['大限', '年龄', '会主星', '四化'],
|
|
695
|
+
rows: daxianSorted.map((d) => [
|
|
696
|
+
d.palace,
|
|
697
|
+
`${d.ages[0]}–${d.ages[1]}`,
|
|
698
|
+
(d.mainStars || []).join('、'),
|
|
699
|
+
(d.mutagenHits || []).map((m) => `${m.star}${m.type}→${m.palace}`).join('、'),
|
|
700
|
+
]),
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
key: 'liunian', title: '流年表(近六年)', columns: ['年份', '干支', '年龄', '命宫', '四化'],
|
|
704
|
+
rows: (r.liunian || []).slice(0, 6).map((l) => [
|
|
705
|
+
String(l.year),
|
|
706
|
+
l.ganzhi,
|
|
707
|
+
String(l.age),
|
|
708
|
+
l.lifePalace ? l.lifePalace.palace : '—',
|
|
709
|
+
(l.mutagen || []).join('、'),
|
|
710
|
+
]),
|
|
711
|
+
},
|
|
712
|
+
];
|
|
713
|
+
const triggerRows = daxianSorted
|
|
714
|
+
.flatMap((d) => (d.mutagenHits || []).map((m) => [
|
|
715
|
+
`${d.palace}(${d.ages[0]}–${d.ages[1]}岁)`,
|
|
716
|
+
`${m.star}化${m.type}→${m.palace}`,
|
|
717
|
+
`大限${d.palace}引动`,
|
|
718
|
+
]))
|
|
719
|
+
.slice(0, 12);
|
|
720
|
+
if (triggerRows.length) {
|
|
721
|
+
tables.push({ key: 'triggers', title: '触发事件表(大限四化)', columns: ['大限', '触发', '依据'], rows: triggerRows });
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
return {
|
|
725
|
+
lead: `紫微斗数看的是你与环境的互动方式。下面按五个维度拆开,讲的是性格与处境的倾向,具体怎么选仍然在你。`,
|
|
726
|
+
dimensions, sections, outline, tables,
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// ══════════════════════════════════════════════════════════
|
|
731
|
+
// 卦象通用:卦辞 / 爻辞 / 动爻 / 生活落点
|
|
732
|
+
// ══════════════════════════════════════════════════════════
|
|
733
|
+
function hexSections({ benName, benUpper, benLower, bianName, bianUpper, bianLower, movingLine, moving }) {
|
|
734
|
+
const ben = hexInfo(benName, benUpper, benLower);
|
|
735
|
+
const sections = [
|
|
736
|
+
{
|
|
737
|
+
key: 'guaCi', label: '卦名与卦辞大意',
|
|
738
|
+
text: `本卦为「${ben.full}」,卦辞大意是:${ben.meaning}。这一卦讲的是事情当下的整体走势——你可以先记住这句,后面每个维度都会回到它。`,
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
key: 'yaoCi', label: '爻辞与动爻',
|
|
742
|
+
text: moving ? yaoGist(moving.position, moving) : '本卦无动爻,事情处于相对静止的状态,短期内变化的动力不强,宜按现状维持。',
|
|
743
|
+
},
|
|
744
|
+
];
|
|
745
|
+
if (bianName) {
|
|
746
|
+
const bian = hexInfo(bianName, bianUpper, bianLower);
|
|
747
|
+
sections.push({
|
|
748
|
+
key: 'bianGua', label: '变卦与走向',
|
|
749
|
+
text: `动爻变化之后得到「${bian.full}」,${bian.meaning}。变卦往往指向事情后来的样子:从「${ben.full}」走到「${bian.full}」,可以理解为局面会从${ben.scene}转为${bian.scene}。`,
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
sections.push({
|
|
753
|
+
key: 'scene', label: '落到生活里',
|
|
754
|
+
text: `把这一卦放进日常:${ben.scene}。${bianName ? `而后续的方向是${hexInfo(bianName, bianUpper, bianLower).scene}。` : ''}你可以对照着看看,眼下哪件事最像这个描述。`,
|
|
755
|
+
});
|
|
756
|
+
return { sections, ben, bian: bianName ? hexInfo(bianName, bianUpper, bianLower) : null };
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
// ══════════════════════════════════════════════════════════
|
|
760
|
+
// 六爻
|
|
761
|
+
// ══════════════════════════════════════════════════════════
|
|
762
|
+
const LIUQIN_USE = {
|
|
763
|
+
妻财: '钱财、收入、订单,也指男命的妻缘',
|
|
764
|
+
官鬼: '工作、职位、上司、考核,也指压力与疾病',
|
|
765
|
+
父母: '文书、合同、学历、长辈、房子',
|
|
766
|
+
子孙: '下属、客户、创意、消解压力的出口',
|
|
767
|
+
兄弟: '同事、同行、竞争者,多与破财相关',
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
function liuyaoInterpret(r) {
|
|
771
|
+
const ben = isObj(r.ben) ? r.ben : {};
|
|
772
|
+
const bian = isObj(r.bian) ? r.bian : {};
|
|
773
|
+
const lines = Array.isArray(ben.lines) ? ben.lines : [];
|
|
774
|
+
const moving = lines.find((l) => l.moving) || null;
|
|
775
|
+
const { sections, ben: benInfo, bian: bianInfo } = hexSections({
|
|
776
|
+
benName: ben.name, benUpper: ben.upper, benLower: ben.lower,
|
|
777
|
+
bianName: bian.name, bianUpper: bian.upper, bianLower: bian.lower,
|
|
778
|
+
moving,
|
|
779
|
+
});
|
|
780
|
+
|
|
781
|
+
const shiLine = lines.find((l) => l.position === ben.shi);
|
|
782
|
+
const yingLine = lines.find((l) => l.position === ben.ying);
|
|
783
|
+
const palaceEl = pick(ben, 'palaceElement', '');
|
|
784
|
+
const movingLiuqin = moving?.liuqin || '';
|
|
785
|
+
const movingLiushen = moving?.liushen || '';
|
|
786
|
+
const dayGZ = pick(r.dayGanZhi, 'name', '');
|
|
787
|
+
// 取象依据:卦象类的"依据"就是卦面本身,提炼成一行便于核对
|
|
788
|
+
const cnt = (k) => lines.filter((l) => l.liuqin === k).length;
|
|
789
|
+
const lineEv = (l) => (l ? `${l.position}爻${l.liuqin}${l.liushen ? '·' + l.liushen : ''}${l.moving ? '(动)' : ''}` : '—');
|
|
790
|
+
const ev = (...xs) => xs.filter((x) => x != null && x !== '');
|
|
791
|
+
|
|
792
|
+
sections.push({
|
|
793
|
+
key: 'liuqin', label: '六亲取用',
|
|
794
|
+
text: `这一卦里,${movingLiuqin ? `动爻落在${movingLiuqin}(${LIUQIN_USE[movingLiuqin] || ''})` : '没有发动的六亲'}。` +
|
|
795
|
+
`如果你心里有具体问题,可以对号入座:${Object.entries(LIUQIN_USE).map(([k, v]) => `${k}主${v.split(',')[0]}`).join(';')}。`,
|
|
796
|
+
});
|
|
797
|
+
|
|
798
|
+
// 看卦顺序:卦象类的"依据"是卦面本身,但先看什么、后看什么同样要讲清
|
|
799
|
+
sections.push({
|
|
800
|
+
key: 'reasoning', label: '看卦顺序',
|
|
801
|
+
text: [
|
|
802
|
+
`① 先定卦宫:本卦「${ben.name || '—'}」属${String(pick(ben, 'palace', '—')).replace(/宫$/, '')}宫(${palaceEl || '—'}),六亲由此排定——宫变了,同一个字的六亲就变了。`,
|
|
803
|
+
`② 再看世应:世在${ben.shi}爻(${shiLine ? `${shiLine.liuqin}${shiLine.liushen ? `·${shiLine.liushen}` : ''}` : '—'}),应在${ben.ying}爻(${yingLine ? `${yingLine.liuqin}` : '—'});世代表你,应代表对方与环境。`,
|
|
804
|
+
`③ 看动爻:${moving ? `${moving.position}爻${moving.liuqin}${moving.liushen ? `(${moving.liushen})` : ''}发动,事情的变化点在这里` : '六爻安静,短期不会有大的转折'}。`,
|
|
805
|
+
`④ 定用神:按所问之事取六亲——问工作看官鬼、文书看父母、求财与感情(男)看妻财、健康看官鬼与子孙;用神不上卦时,看伏神或借日月。`,
|
|
806
|
+
`⑤ 看日辰:${dayGZ || '—'}日起六神、定旬空;日辰能生克动爻,但不被爻所伤。`,
|
|
807
|
+
`⑥ 看变卦:${bian.name ? `变出「${bian.name}」,是事情后续的走向` : '本卦无变,以静卦论'}。以上每一步都能在下方「依据」里对上号。`,
|
|
808
|
+
].join('\n'),
|
|
809
|
+
});
|
|
810
|
+
sections.push({
|
|
811
|
+
key: 'limits', label: '未纳入',
|
|
812
|
+
text: '本卦没有计算:月建对爻的旺衰(只用了日辰)、伏神与飞神的完整生克链、进神退神与反吟伏吟的细节,以及用神多重时的取舍权重。这些会改变"旺不旺"的判断,所以这里只给取象与方向。',
|
|
813
|
+
});
|
|
814
|
+
|
|
815
|
+
const dimensions = [
|
|
816
|
+
{
|
|
817
|
+
key: 'overall', label: '整体运势',
|
|
818
|
+
text: `这一卦是「${benInfo.full}」,${benInfo.meaning}。${movingLiushen ? `动爻带${movingLiushen},事情带一点${movingLiushen === '青龙' ? '喜庆顺遂' : movingLiushen === '白虎' ? '压力与阻碍' : movingLiushen === '朱雀' ? '口舌与是非' : movingLiushen === '玄武' ? '不明朗、需要核实' : '反复与牵扯'}的色彩。` : ''}` +
|
|
819
|
+
`日辰为${dayGZ},卦宫属${palaceEl},整体更像是${benInfo.scene}的阶段。`,
|
|
820
|
+
advice: `${benInfo.scene}——顺着这句做就行。${moving ? '既然有动爻,说明事情还在变化,先观察几天再定也不迟。' : '暂无动爻,说明短期内不会有大的转折,维持现状反而是稳妥选择。'}`,
|
|
821
|
+
evidence: ev(
|
|
822
|
+
`本卦 ${ben.name || '—'}(${ben.upper || ''}/${ben.lower || ''})`,
|
|
823
|
+
moving ? `动爻 ${lineEv(moving)}` : '无动爻',
|
|
824
|
+
`日辰 ${dayGZ || '—'}`,
|
|
825
|
+
`卦宫 ${pick(ben, 'palace', '—')}·${palaceEl || '—'}`,
|
|
826
|
+
),
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
key: 'work', label: '工作与职业选择',
|
|
830
|
+
text: `问工作看官鬼与父母:本卦中${(lines.filter((l) => l.liuqin === '官鬼').length ? `官鬼出现${lines.filter((l) => l.liuqin === '官鬼').length}处,${lines.find((l) => l.liuqin === '官鬼').moving ? '且有发动,岗位或考核层面会有动作' : '但未发动,职位层面暂时平稳'}` : '未见官鬼,工作这件事在卦中不是主要矛盾')};` +
|
|
831
|
+
`${(lines.filter((l) => l.liuqin === '父母').length ? '父母(文书、合同、资质)有出现,涉及手续与材料的事要提前准备' : '父母未现,手续类事务暂无明显阻碍')}。`,
|
|
832
|
+
advice: `如果正在看机会,建议先把合同、岗位职责这些落到纸面上的东西问清楚;${moving?.liuqin === '官鬼' ? '动爻在官鬼,工作层面近期有变动的迹象,可以主动谈,但别先辞再找。' : '工作层面暂无强动象,稳住手上的事更划算。'}`,
|
|
833
|
+
evidence: ev(
|
|
834
|
+
`官鬼 ${cnt('官鬼')} 现`,
|
|
835
|
+
`父母 ${cnt('父母')} 现`,
|
|
836
|
+
movingLiuqin ? `动爻六亲 ${movingLiuqin}` : '无动爻',
|
|
837
|
+
),
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
key: 'career', label: '事业发展',
|
|
841
|
+
text: `世爻(代表你)在${ben.shi}爻${shiLine ? `,六亲为${shiLine.liuqin},${shiLine.moving ? '且发动' : '安静未动'}` : ''};应爻(代表对方与环境)在${ben.ying}爻${yingLine ? `,六亲为${yingLine.liuqin}` : ''}。` +
|
|
842
|
+
`世应之间${shiLine && yingLine ? (shiLine.liuqin === yingLine.liuqin ? '同气相求,双方立场接近' : '立场有别,需要多沟通') : '信号不明'},` +
|
|
843
|
+
`${bianInfo ? `变卦「${bianInfo.full}」提示后续走向是${bianInfo.scene}` : '暂无变卦'}。`,
|
|
844
|
+
advice: `事业上的建议是:${shiLine?.moving ? '你自己这边有主动变化的意思,那就把想法说出来、把动作做出来' : '先不动,把手上的事做扎实'};${bianInfo ? `按${bianInfo.scene}的方向去准备,会比被动等结果好。` : ''}`,
|
|
845
|
+
evidence: ev(
|
|
846
|
+
`世 ${lineEv(shiLine)}`,
|
|
847
|
+
`应 ${lineEv(yingLine)}`,
|
|
848
|
+
bian.name ? `变卦 ${bian.name}` : '无变卦',
|
|
849
|
+
),
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
key: 'love', label: '爱情与感情',
|
|
853
|
+
text: `问感情,男看妻财、女看官鬼。本卦中${(lines.filter((l) => l.liuqin === '妻财').length ? `妻财${lines.filter((l) => l.liuqin === '妻财').length}现${lines.find((l) => l.liuqin === '妻财').moving ? '且发动,感情层面有动静' : '但安静,关系暂时平缓'}` : '妻财未现,感情不是当前卦象的重点')};` +
|
|
854
|
+
`${(lines.filter((l) => l.liuqin === '官鬼').length ? '官鬼有现,对方或关系中的压力面是被看到的' : '官鬼未现')}。${benInfo.meaning},放在关系里就是${benInfo.scene}。`,
|
|
855
|
+
advice: `关系里${moving?.liuqin === '妻财' || moving?.liuqin === '官鬼' ? '近期有变化的可能,适合把话说开,别憋着' : '暂时平稳,可以按自己的节奏相处'}。卦象只给倾向,真正决定关系的是你们怎么沟通。`,
|
|
856
|
+
evidence: ev(
|
|
857
|
+
`妻财 ${cnt('妻财')} 现`,
|
|
858
|
+
`官鬼 ${cnt('官鬼')} 现`,
|
|
859
|
+
`世应 ${lineEv(shiLine)} / ${lineEv(yingLine)}`,
|
|
860
|
+
),
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
key: 'health', label: '健康状况',
|
|
864
|
+
text: `问健康,看官鬼(病)与子孙(医药、消散)。本卦中${(lines.filter((l) => l.liuqin === '官鬼').length ? `官鬼有现${lines.find((l) => l.liuqin === '官鬼').moving ? '且发动,提示身体上可能有需要留意的地方' : ',但安静,暂无明显变化'}` : '官鬼未现,卦象未指向明显的身体问题')};` +
|
|
865
|
+
`${(lines.filter((l) => l.liuqin === '子孙').length ? '子孙有现,恢复与调养的出口是有的' : '子孙未现,休息与调养需要自己主动安排')}。${movingLiushen === '白虎' ? '动爻带白虎,尤其别忽视突发的身体信号。' : ''}`,
|
|
866
|
+
advice: `这一卦在健康上的提醒是${(lines.filter((l) => l.liuqin === '官鬼').length ? '别硬扛,累了就休息,有机会就做一次检查' : '维持现有作息即可,别自己吓自己')}。任何不适请就医,卦象不能替代诊断。`,
|
|
867
|
+
evidence: ev(
|
|
868
|
+
`官鬼 ${cnt('官鬼')} 现`,
|
|
869
|
+
`子孙 ${cnt('子孙')} 现`,
|
|
870
|
+
movingLiushen ? `动爻六神 ${movingLiushen}` : '',
|
|
871
|
+
),
|
|
872
|
+
},
|
|
873
|
+
];
|
|
874
|
+
|
|
875
|
+
return {
|
|
876
|
+
lead: `这一卦问的是眼下的具体事。下面先讲卦理,再分五个维度落到生活里——卦象给的是倾向,不是定论。`,
|
|
877
|
+
dimensions, sections,
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
// ══════════════════════════════════════════════════════════
|
|
882
|
+
// 梅花易数
|
|
883
|
+
// ══════════════════════════════════════════════════════════
|
|
884
|
+
function meihuaInterpret(r) {
|
|
885
|
+
const ben = isObj(r.ben) ? r.ben : {};
|
|
886
|
+
const hu = isObj(r.hu) ? r.hu : {};
|
|
887
|
+
const bian = isObj(r.bian) ? r.bian : {};
|
|
888
|
+
const cuo = isObj(r.cuo) ? r.cuo : {};
|
|
889
|
+
const zong = isObj(r.zong) ? r.zong : {};
|
|
890
|
+
const bu = isObj(r.bodyUse) ? r.bodyUse : {};
|
|
891
|
+
const lines = Array.isArray(r.lines) ? r.lines : [];
|
|
892
|
+
const movingLine = lines.find((l) => l.moving) || (Number(r.moving) ? lines[Number(r.moving) - 1] : null);
|
|
893
|
+
const { sections, ben: benInfo, bian: bianInfo } = hexSections({
|
|
894
|
+
benName: ben.name, benUpper: ben.upper, benLower: ben.lower,
|
|
895
|
+
bianName: bian.name, bianUpper: bian.upper, bianLower: bian.lower,
|
|
896
|
+
moving: movingLine,
|
|
897
|
+
});
|
|
898
|
+
|
|
899
|
+
const bodyEl = pick(bu.body, 'element', '');
|
|
900
|
+
const useEl = pick(bu.use, 'element', '');
|
|
901
|
+
const relation = pick(bu, 'relation', '');
|
|
902
|
+
const mhLevel = pick(bu, 'level', '');
|
|
903
|
+
const isJi = /吉/.test(mhLevel);
|
|
904
|
+
const isXiong = /凶/.test(mhLevel);
|
|
905
|
+
|
|
906
|
+
sections.splice(1, 0, {
|
|
907
|
+
key: 'tiYong', label: '体用关系',
|
|
908
|
+
text: `体卦为${pick(bu.body, 'trigram', '')}(${bodyEl}),代表你自己;用卦为${pick(bu.use, 'trigram', '')}(${useEl}),代表对方与环境。${relation}(${mhLevel})。` +
|
|
909
|
+
`梅花易数看体用生克:${isJi ? '用卦对体卦有利,事情推进会相对顺' : isXiong ? '用卦克体或消耗体卦,推进中会感到阻力,宜缓不宜急' : '体用关系平和,事情按常态发展'}。`,
|
|
910
|
+
});
|
|
911
|
+
sections.splice(3, 0, {
|
|
912
|
+
key: 'huGua', label: '互卦与过程',
|
|
913
|
+
text: `互卦为「${pick(hu, 'name', '')}」,${hexInfo(hu.name, hu.upper, hu.lower).meaning}——互卦看事情中间的过程,这一段大致是这个味道。` +
|
|
914
|
+
`错卦「${pick(cuo, 'name', '')}」是换个立场看同一件事,综卦「${pick(zong, 'name', '')}」是站在对方位置看,可以参考着换个角度想。`,
|
|
915
|
+
});
|
|
916
|
+
|
|
917
|
+
const dimensions = [
|
|
918
|
+
{
|
|
919
|
+
key: 'overall', label: '整体运势',
|
|
920
|
+
text: `本卦「${benInfo.full}」,${benInfo.meaning}。体${bodyEl}用${useEl},${relation},判定为${mhLevel}。` +
|
|
921
|
+
`${isJi ? '整体的倾向是顺的:外部环境对你不算苛刻,可以正常推进' : isXiong ? '整体有阻力:不是不能做,而是要多留余量与耐心' : '整体平稳,不会有大的起落'}。`,
|
|
922
|
+
advice: `${benInfo.scene}。${isXiong ? '建议把节奏放慢,先解决卡点再谈推进' : isJi ? '可以趁势把想做的事往前推一步' : '按原计划走,不必刻意改变'}。`,
|
|
923
|
+
evidence: [
|
|
924
|
+
`本卦 ${benInfo.full}`,
|
|
925
|
+
`互卦 ${pick(hu, 'name', '—')}`,
|
|
926
|
+
`变卦 ${pick(bian, 'name', '—')}`,
|
|
927
|
+
`体${bodyEl} / 用${useEl}·${relation || '—'}`,
|
|
928
|
+
`判定 ${mhLevel || '—'}`,
|
|
929
|
+
].filter(Boolean),
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
key: 'work', label: '工作与职业选择',
|
|
933
|
+
text: `梅花里工作看用卦与体卦的生克:现在用卦${useEl}${isJi ? '对体卦有利,说明当下的工作环境或岗位与你的匹配度还不错' : isXiong ? '与体卦相耗,说明眼下这份工作消耗感偏重' : '与体卦关系平和,属于不好不坏'}` +
|
|
934
|
+
`。本卦${benInfo.meaning},对应到工作里就是${benInfo.scene}。`,
|
|
935
|
+
advice: `${isXiong ? '如果长期觉得被消耗,可以先在内部争取调整职责,再考虑外部机会' : isJi ? '适合主动争取更多责任或更好的岗位' : '把手上的事做好,等一个明确的信号再动'}。选工作时优先考虑让你舒服的环境,长期看比短期收益重要。`,
|
|
936
|
+
evidence: [`体卦 ${bodyEl}`, `用卦 ${useEl}`, `体用 ${relation || '—'}`],
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
key: 'career', label: '事业发展',
|
|
940
|
+
text: `变卦「${bianInfo ? bianInfo.full : ''}」代表事情的结局方向,${bianInfo ? bianInfo.meaning : ''}。互卦「${pick(hu, 'name', '')}」代表过程,${hexInfo(hu.name, hu.upper, hu.lower).meaning}。` +
|
|
941
|
+
`合起来看:过程${hexInfo(hu.name, hu.upper, hu.lower).scene},结果${bianInfo ? bianInfo.scene : '暂不明朗'}。`,
|
|
942
|
+
advice: `按这个结构,建议${isJi ? '现在就把关键的一步迈出去' : isXiong ? '先补短板、攒条件,等下一轮再动' : '小步推进,边做边看'}。动爻在${pick(r, 'movingName', '某爻')},变化点就在那里,值得重点关注。`,
|
|
943
|
+
evidence: [
|
|
944
|
+
`互卦 ${pick(hu, 'name', '—')}`,
|
|
945
|
+
`变卦 ${pick(bian, 'name', '—')}`,
|
|
946
|
+
`动爻 ${pick(r, 'movingName', '—')}`,
|
|
947
|
+
],
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
key: 'love', label: '爱情与感情',
|
|
951
|
+
text: `感情上看体用是否相合:体${bodyEl}与用${useEl}之间是${relation},${isJi ? '这种组合在关系里意味着双方相处比较顺,彼此能给到支撑' : isXiong ? '这种组合提示相处中有一方付出更多,需要留意平衡' : '关系处在常态,没有特别的张力'}` +
|
|
952
|
+
`。本卦${benInfo.meaning},放到两人之间就是${benInfo.scene}。`,
|
|
953
|
+
advice: `${isXiong ? '别把不满攒着,找个合适的时机说清楚;也别指望对方猜' : isJi ? '可以主动推进关系,做一些共同的事' : '维持现在的相处节奏就好'}。卦象看的是当下的气氛,关系的走向取决于你们怎么经营。`,
|
|
954
|
+
evidence: [
|
|
955
|
+
`体 ${bodyEl} / 用 ${useEl}`,
|
|
956
|
+
`体用 ${relation || '—'}`,
|
|
957
|
+
`本卦 ${benInfo.full}`,
|
|
958
|
+
],
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
key: 'health', label: '健康状况',
|
|
962
|
+
text: `梅花里健康看体卦的强弱:体卦${pick(bu.body, 'trigram', '')}属${bodyEl},${isXiong ? '被用卦所耗,传统取象上提示近期精力消耗偏大' : isJi ? '得到生扶,精力状态相对好' : '平顺,无明显偏枯'}。` +
|
|
963
|
+
`${WUXING_ORGAN[bodyEl] ? `${bodyEl}对应${WUXING_ORGAN[bodyEl].part},${WUXING_ORGAN[bodyEl].note}。` : ''}这是取象提示,不是诊断。`,
|
|
964
|
+
advice: `${isXiong ? '近期别硬撑,睡眠与饮食先稳住,有条件做一次常规体检' : '保持现在的作息即可,顺势多动一动更好'}。身体有明确的症状请直接看医生。`,
|
|
965
|
+
evidence: [
|
|
966
|
+
`体卦 ${pick(bu.body, 'trigram', '—')}属${bodyEl}`,
|
|
967
|
+
`用卦 ${pick(bu.use, 'trigram', '—')}属${useEl}`,
|
|
968
|
+
`体用 ${relation || '—'}`,
|
|
969
|
+
],
|
|
970
|
+
},
|
|
971
|
+
];
|
|
972
|
+
|
|
973
|
+
return {
|
|
974
|
+
lead: `梅花易数重「体用」——你与这件事之间的关系。下面先讲卦理与体用,再分五个维度落到生活场景。`,
|
|
975
|
+
dimensions, sections,
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
// ══════════════════════════════════════════════════════════
|
|
980
|
+
// 大六壬
|
|
981
|
+
// ══════════════════════════════════════════════════════════
|
|
982
|
+
function daliurenInterpret(r) {
|
|
983
|
+
const sc = isObj(r.sanChuan) ? r.sanChuan : {};
|
|
984
|
+
const chu = isObj(sc.chu) ? sc.chu : {};
|
|
985
|
+
const zhong = isObj(sc.zhong) ? sc.zhong : {};
|
|
986
|
+
const mo = isObj(sc.mo) ? sc.mo : {};
|
|
987
|
+
const gj = isObj(r.geJu) ? r.geJu : {};
|
|
988
|
+
const ke = Array.isArray(r.siKe) ? r.siKe : [];
|
|
989
|
+
const jiangOf = (x) => LIUREN_JIANG[x?.jiangFull] || LIUREN_JIANG[x?.jiang] || '';
|
|
990
|
+
// 这几个值在「看课顺序」里就要用到,必须先声明再拼 sections(否则 TDZ 报错被 catch 吞掉)
|
|
991
|
+
const chuQin = pick(chu, 'liuQin', '');
|
|
992
|
+
const moQin = pick(mo, 'liuQin', '');
|
|
993
|
+
const hasKong = !!(chu.xunKong || zhong.xunKong || mo.xunKong);
|
|
994
|
+
const scText = JSON.stringify(sc);
|
|
995
|
+
const has = (x) => scText.includes(x);
|
|
996
|
+
const chuan = `初${pick(chu, 'zhi', '—')} → 中${pick(zhong, 'zhi', '—')} → 末${pick(mo, 'zhi', '—')}`;
|
|
997
|
+
|
|
998
|
+
const sections = [
|
|
999
|
+
{
|
|
1000
|
+
key: 'sanChuan', label: '三传与事体走向',
|
|
1001
|
+
text: `初传${pick(chu, 'zhi', '')}(${pick(chu, 'jiangFull', '')}·${pick(chu, 'liuQin', '')}${chu.xunKong ? '·旬空' : ''}):${jiangOf(chu) || '发端的信号'};` +
|
|
1002
|
+
`中传${pick(zhong, 'zhi', '')}(${pick(zhong, 'jiangFull', '')}·${pick(zhong, 'liuQin', '')}${zhong.xunKong ? '·旬空' : ''}):${jiangOf(zhong) || '过程的信号'};` +
|
|
1003
|
+
`末传${pick(mo, 'zhi', '')}(${pick(mo, 'jiangFull', '')}·${pick(mo, 'liuQin', '')}${mo.xunKong ? '·旬空' : ''}):${jiangOf(mo) || '结局的信号'}。` +
|
|
1004
|
+
`三传讲的是一件事从发端、经过到落定的过程,可以按这个顺序对照你的处境。`,
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
key: 'geju', label: '课体与四课',
|
|
1008
|
+
text: `本课为${pick(gj, 'name', '未定')}${gj.detail ? `(${gj.detail})` : ''}。${ke.length ? `四课:${ke.map((k, i) => `${i + 1}课 ${k.shang || ''}上${k.xia || ''}下`).join(' ')}` : ''}`,
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
key: 'reasoning', label: '看课顺序',
|
|
1012
|
+
text: [
|
|
1013
|
+
`① 先看月将加时:月将${pick(r.yueJiang, 'name', '—')}${pick(r.yueJiang, 'zhi', '')}加在${pick(r, 'hourZhi', '—')}时上,定出天地盘——后面所有关系都从这张盘推。`,
|
|
1014
|
+
`② 再看四课:日干寄宫起一课,日支起二课,依次得三、四课;四课是"事情的四个面"。`,
|
|
1015
|
+
`③ 看三传:初传${pick(chu, 'zhi', '—')}(${chuQin || '—'})起,中传${pick(zhong, 'zhi', '—')}(${pick(zhong, 'liuQin', '—')}),末传${pick(mo, 'zhi', '—')}(${moQin || '—'})落——发端、过程、结局。`,
|
|
1016
|
+
`④ 定课体:${pick(gj, 'name', '未定')}${gj.detail ? `(${gj.detail})` : ''};课体决定这件事"以什么方式"推进,不是吉凶标签。`,
|
|
1017
|
+
`⑤ 看神将:月将、贵人与旬空决定信号强弱;旬空处多为"看着有、实则虚",须核实。`,
|
|
1018
|
+
'⑥ 落到维度:工作看官鬼与青龙、朱雀;感情看六合、天后与妻财;健康看白虎与子孙——都是上面几步的应用。',
|
|
1019
|
+
].join('\n'),
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
key: 'limits', label: '未纳入',
|
|
1023
|
+
text: '本课没有计算:年命与行年(命上神)、神煞的加权轻重、伏吟反吟的细分,以及课体之间的互涉。三传只取九宗门里的主要取法,其他流派(如以贵神起课)结论可能不同;这些只影响轻重,不改变课面事实。',
|
|
1024
|
+
},
|
|
1025
|
+
];
|
|
1026
|
+
|
|
1027
|
+
const dimensions = [
|
|
1028
|
+
{
|
|
1029
|
+
key: 'overall', label: '整体运势',
|
|
1030
|
+
text: `这一课${pick(gj, 'name', '')}${gj.detail ? `·${gj.detail}` : ''},发端在${pick(chu, 'zhi', '')}(${jiangOf(chu) || ''}),落定在${pick(mo, 'zhi', '')}(${jiangOf(mo) || ''})。` +
|
|
1031
|
+
`${hasKong ? '课中有旬空,提示事情里有「看着有、实则虚」的部分,涉及承诺与数字的要核实。' : '课中无旬空,事情相对实在。'}` +
|
|
1032
|
+
`整体倾向是:${/吉|生|合/.test(jiangOf(chu) + jiangOf(mo)) ? '开局与结局的象都不差,可以正常推进' : /虎|蛇|勾|空/.test(jiangOf(chu) + jiangOf(mo)) ? '过程中有牵绊与不明朗处,宜慢不宜快' : '平顺中带一点摩擦' }。`,
|
|
1033
|
+
advice: `${hasKong ? '先把信息核实清楚,别在含糊的基础上做决定' : '按你原本的计划推进即可'}。${/虎/.test(jiangOf(chu)) ? '开局带白虎,头几天别硬碰,先观察。' : ''}事情的局面是动态的,这一课看的是当下这一刻的气象。`,
|
|
1034
|
+
evidence: [
|
|
1035
|
+
`课体 ${pick(gj, 'name', '—')}`,
|
|
1036
|
+
`三传 ${chuan}`,
|
|
1037
|
+
`月将 ${pick(r.yueJiang, 'name', '—')}`,
|
|
1038
|
+
hasKong ? '课中见旬空' : '无旬空',
|
|
1039
|
+
],
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
key: 'work', label: '工作与职业选择',
|
|
1043
|
+
text: `工作看官鬼与青龙、太常:本课${chuQin === '官鬼' ? '初传即见官鬼,事情一上来就与职位、考核或上级有关' : `初传为${chuQin || '未取'},${jiangOf(chu) || ''}`}。` +
|
|
1044
|
+
`${/青龙/.test(JSON.stringify(sc)) ? '课中见青龙,工作层面有喜庆与进益的象' : '课中未见青龙,工作层面属常态推进'};` +
|
|
1045
|
+
`${/朱雀/.test(JSON.stringify(sc)) ? '见朱雀,文书、沟通与口舌要留意,材料务必留底' : ''}`,
|
|
1046
|
+
advice: `涉及岗位与待遇的事,建议把口头承诺落成文字;${/朱雀/.test(JSON.stringify(sc)) ? '沟通时少说满话,多留余地。' : '正常沟通即可。'}选工作时优先考虑课象中显示出支撑力的方向。`,
|
|
1047
|
+
evidence: [
|
|
1048
|
+
`初传 ${pick(chu, 'zhi', '—')}·${chuQin || '未取'}·${jiangOf(chu) || '—'}`,
|
|
1049
|
+
has('青龙') ? '见青龙' : '无青龙',
|
|
1050
|
+
has('朱雀') ? '见朱雀' : '无朱雀',
|
|
1051
|
+
],
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
key: 'career', label: '事业发展',
|
|
1055
|
+
text: `末传${pick(mo, 'zhi', '')}(${moQin || ''}·${jiangOf(mo) || ''})主结局,${moQin === '官鬼' ? '结局落在官鬼,事业这条线会有明确的结果或位置变化' : moQin === '妻财' ? '结局落在妻财,更多体现为收入与资源的落袋' : moQin === '子孙' ? '结局落在子孙,压力会消散,适合收尾与转向' : '结局的信号相对中性'}。` +
|
|
1056
|
+
`${mo.xunKong ? '末传旬空,结局有落空的可能,别把预期定得太满。' : '末传不空,结果相对实在。'}`,
|
|
1057
|
+
advice: `按三传的顺序安排节奏:初传阶段先摸清情况,中传阶段处理摩擦,末传阶段收果。${mo.xunKong ? '对结果保留一点弹性,Plan B 提前想好。' : '可以朝着末传给出的方向去准备。'}`,
|
|
1058
|
+
evidence: [
|
|
1059
|
+
`末传 ${pick(mo, 'zhi', '—')}·${moQin || '未取'}·${jiangOf(mo) || '—'}`,
|
|
1060
|
+
mo.xunKong ? '末传旬空' : '末传不空',
|
|
1061
|
+
`三传 ${chuan}`,
|
|
1062
|
+
],
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
key: 'love', label: '爱情与感情',
|
|
1066
|
+
text: `感情看妻财与天后、六合:本课${/六合/.test(JSON.stringify(sc)) ? '见六合,有和合、契约之象,关系层面是往一起走的' : '未见六合,关系层面没有明显的和合信号'};` +
|
|
1067
|
+
`${/天后/.test(JSON.stringify(sc)) ? '见天后,有被照顾、被回应的象' : ''}${/玄武/.test(JSON.stringify(sc)) ? '见玄武,提示信息不明或有隐瞒,重要的事要当面问清' : ''}` +
|
|
1068
|
+
`${/妻财/.test(JSON.stringify(sc)) ? '课中见妻财,感情这条线是被看到的' : ''}。`,
|
|
1069
|
+
advice: `${/玄武/.test(JSON.stringify(sc)) ? '关系里有看不清的地方,别猜,直接问。' : '按你感受到的相处状态来判断就好。'}卦象只反映当下的气氛,关系如何取决于两个人怎么做。`,
|
|
1070
|
+
evidence: [
|
|
1071
|
+
has('六合') ? '见六合' : '无六合',
|
|
1072
|
+
has('天后') ? '见天后' : '无天后',
|
|
1073
|
+
has('妻财') ? '见妻财' : '无妻财',
|
|
1074
|
+
],
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
key: 'health', label: '健康状况',
|
|
1078
|
+
text: `健康看白虎与子孙:本课${/白虎/.test(JSON.stringify(sc)) ? '见白虎,传统取象上提示身体有需要留意的地方,尤其突发的不适别忽视' : '未见白虎,卦象未指向明显的身体问题'};` +
|
|
1079
|
+
`${/子孙/.test(JSON.stringify(sc)) ? '见子孙,医药与调养的出口是有的,恢复的象在' : '未见子孙,休息与调养需要自己主动安排'}。这些都是象征提示,不构成医学判断。`,
|
|
1080
|
+
advice: `${/白虎/.test(JSON.stringify(sc)) ? '近期别熬夜、别硬扛,有条件做一次检查' : '保持现有作息,适度运动即可'}。任何不适请就医,这一课不能替代诊断。`,
|
|
1081
|
+
evidence: [
|
|
1082
|
+
has('白虎') ? '见白虎' : '无白虎',
|
|
1083
|
+
has('子孙') ? '见子孙' : '无子孙',
|
|
1084
|
+
`课体 ${pick(gj, 'name', '—')}`,
|
|
1085
|
+
],
|
|
1086
|
+
},
|
|
1087
|
+
];
|
|
1088
|
+
|
|
1089
|
+
return {
|
|
1090
|
+
lead: `大六壬看的是一件事的来龙去脉。三传给出「发端—过程—结局」的顺序,下面按这个结构分五个维度说。`,
|
|
1091
|
+
dimensions, sections,
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
// ══════════════════════════════════════════════════════════
|
|
1096
|
+
// 塔罗
|
|
1097
|
+
// ══════════════════════════════════════════════════════════
|
|
1098
|
+
function tarotInterpret(r) {
|
|
1099
|
+
const cards = Array.isArray(r.cards) ? r.cards : [];
|
|
1100
|
+
const n = cards.length;
|
|
1101
|
+
const major = cards.filter((c) => c.arcana === '大阿卡纳');
|
|
1102
|
+
const upright = cards.filter((c) => c.upright);
|
|
1103
|
+
const reversed = cards.filter((c) => !c.upright);
|
|
1104
|
+
const court = cards.filter((c) => /国王|王后|骑士|侍从/.test(String(c.name)));
|
|
1105
|
+
|
|
1106
|
+
// 元素分布
|
|
1107
|
+
const elCount = {};
|
|
1108
|
+
for (const c of cards) if (c.element) elCount[c.element] = (elCount[c.element] || 0) + 1;
|
|
1109
|
+
const elText = Object.entries(elCount).map(([k, v]) => `${k}×${v}`).join('、') || '分布不明';
|
|
1110
|
+
const lack = ['火', '水', '风', '土'].filter((e) => !elCount[e]);
|
|
1111
|
+
|
|
1112
|
+
// 主轴:优先未来位/最后一张,其次第一张
|
|
1113
|
+
const axis = cards.find((c) => /未来|结果|建议/.test(String(c.position))) || cards[cards.length - 1] || null;
|
|
1114
|
+
|
|
1115
|
+
// 整体叙事:把各张串成一条线,避免各说各话
|
|
1116
|
+
const narrative = cards.map((c, i) => {
|
|
1117
|
+
const turn = c.upright ? '顺' : '滞';
|
|
1118
|
+
return `${c.position}(${c.positionHint || ''})${c.name}${c.orientation}:${c.core || (c.keywords || []).join('、')},这一环是${turn}的`;
|
|
1119
|
+
}).join(';');
|
|
1120
|
+
|
|
1121
|
+
const sections = [
|
|
1122
|
+
{
|
|
1123
|
+
key: 'narrative', label: '整盘连贯解读',
|
|
1124
|
+
text: `先把几张牌串成一条线来看:${narrative}。` +
|
|
1125
|
+
`${axis ? `整盘的主轴是「${axis.name}」(${axis.position}·${axis.orientation})——${axis.core || ''}。其余几张可以理解为这条主线在不同阶段的样貌:${cards.filter((c) => c !== axis).map((c) => `${c.position}的${c.name}说明${c.core || (c.keywords || []).join('、')}`).join(',')}。` : ''}` +
|
|
1126
|
+
`所以这张牌阵讲的不是几件不相干的事,而是同一件事在不同时间位置上的样子。`,
|
|
1127
|
+
},
|
|
1128
|
+
{
|
|
1129
|
+
key: 'structure', label: '牌面结构',
|
|
1130
|
+
text: `${n} 张牌中有 ${major.length} 张大阿卡纳(占 ${Math.round((major.length / n) * 100)}%),${major.length >= Math.ceil(n / 2) ? '大牌过半,事情牵动的层面较深,与环境、阶段性的课题有关' : '大牌不到半数,重点更偏日常层面的具体人事'}。` +
|
|
1131
|
+
`元素分布:${elText}${lack.length ? `;缺${join(lack)},这一块容易被忽略` : ''}。` +
|
|
1132
|
+
`正逆位 ${upright.length} 正 ${reversed.length} 逆,${reversed.length > upright.length ? '逆位偏多,说明阻滞主要来自内部状态而非外部条件' : '整体偏顺,逆位那张是全盘的关节'}。`,
|
|
1133
|
+
},
|
|
1134
|
+
];
|
|
1135
|
+
|
|
1136
|
+
const dimBase = (key) => {
|
|
1137
|
+
const hit = cards.find((c) => {
|
|
1138
|
+
const kw = (c.keywords || []).join('') + String(c.core || '');
|
|
1139
|
+
if (key === 'love') return /爱|情感|关系|圣杯|恋人|伴侣/.test(kw) || (c.domain === '情感与关系');
|
|
1140
|
+
if (key === 'work') return /工作|事业|职场|权杖|星币|金币/.test(kw) || (c.domain === '工作与事业');
|
|
1141
|
+
if (key === 'career') return /成就|成功|目标|进展|资源/.test(kw);
|
|
1142
|
+
if (key === 'health') return /健康|休息|疲惫|压力|疗愈/.test(kw);
|
|
1143
|
+
return true;
|
|
1144
|
+
});
|
|
1145
|
+
return hit;
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1148
|
+
const dimensions = [
|
|
1149
|
+
{
|
|
1150
|
+
key: 'overall', label: '整体运势',
|
|
1151
|
+
text: `整盘的主轴落在「${axis ? axis.name : '—'}」(${axis ? axis.orientation : ''}),${axis ? axis.core || (axis.keywords || []).join('、') : ''}。` +
|
|
1152
|
+
`${reversed.length ? `其中${join(reversed.map((c) => `${c.name}(${c.position})`))}是逆位,逆位不等于凶,更像那股力量还没顺过来或用力过猛,它是这张牌阵里最值得你先看的部分。` : '全部为正位,说明牌面呈现的状态与你当下的处境是通的。'}` +
|
|
1153
|
+
`${lack.length ? `元素上缺${join(lack)},${lack.map((e) => TAROT_ELEMENT_FOCUS[e]?.area).filter(Boolean).join('、')}这一块容易被忽略。` : ''}`,
|
|
1154
|
+
advice: `${reversed.length ? `先把${reversed[0].name}指出的卡点处理掉(${(reversed[0].keywords || []).join('、')}),暂时不要加码推进` : '按牌面呈现的节奏走'};${lack.length ? `补一点${lack[0]}的力量:${TAROT_ELEMENT_FOCUS[lack[0]]?.advice || ''}` : '把注意力放在能立刻做的小事上,先动一件'}。牌是镜子,照的是你此刻的状态。`,
|
|
1155
|
+
evidence: [
|
|
1156
|
+
`牌阵 ${n} 张(${cards.map((c) => c.position).join(' / ')})`,
|
|
1157
|
+
`主轴 ${axis ? `${axis.name}·${axis.position}·${axis.orientation}` : '—'}`,
|
|
1158
|
+
`逆位 ${reversed.length} / 正位 ${upright.length}`,
|
|
1159
|
+
lack.length ? `缺 ${join(lack)}` : '五行元素齐',
|
|
1160
|
+
],
|
|
1161
|
+
},
|
|
1162
|
+
{
|
|
1163
|
+
key: 'work', label: '工作与职业选择',
|
|
1164
|
+
text: `${dimBase('work') ? `牌面上与工作最相关的是「${dimBase('work').name}」(${dimBase('work').position}·${dimBase('work').orientation}):${dimBase('work').core || (dimBase('work').keywords || []).join('、')}。` : '牌面上没有明确指向工作的牌。'}` +
|
|
1165
|
+
`${court.length ? `牌中有宫廷牌${join(court.map((c) => c.name))},说明局面里有具体的人(也可能就是你自己的某个侧面)在起作用。` : ''}` +
|
|
1166
|
+
`${elCount.土 ? '有土元素,现实条件与资源是被这张牌阵看到的。' : '缺土元素,现实条件与资源这块容易估计不足。'}`,
|
|
1167
|
+
advice: `工作上建议:${elCount.土 ? '把计划落到预算与时间表上,别停在口头' : '先把现实条件摸清楚——薪资、工时、稳定性,再谈喜好'};${dimBase('work') && !dimBase('work').upright ? '这张相关牌是逆位,说明当下的不适主要来自状态而非岗位本身,可以调状态再看。' : ''}`,
|
|
1168
|
+
evidence: [
|
|
1169
|
+
`工作相关牌 ${dimBase('work') ? `${dimBase('work').name}·${dimBase('work').position}·${dimBase('work').orientation}` : '无'}`,
|
|
1170
|
+
`宫廷牌 ${court.length} 张`,
|
|
1171
|
+
`土元素 ${elCount.土 || 0} 张`,
|
|
1172
|
+
],
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
key: 'career', label: '事业发展',
|
|
1176
|
+
text: `从牌阵的时间线看:${cards.map((c) => `${c.position}是${c.name}${c.orientation}`).join(',')}。` +
|
|
1177
|
+
`${major.length >= Math.ceil(n / 2) ? '大牌过半,事业这条线牵动的不只是岗位,还有你对自己要往哪走的判断' : '变化更多发生在具体事务层面,先把眼前的项目做成'}` +
|
|
1178
|
+
`${axis ? `;结局位置的「${axis.name}」给出的方向是${axis.core || ''}` : ''}。`,
|
|
1179
|
+
advice: `建议把${cards[0]?.position || '最初'}这一环的课题先收尾,再往${axis?.position || '结果'}的方向推进;${elCount.火 ? '火的能量在,适合主动出击一步' : '缺火时别等热情来,先用流程推着自己动'}。事业发展是长线,牌面只反映当前这一段。`,
|
|
1180
|
+
evidence: [
|
|
1181
|
+
`时间线 ${cards.map((c) => `${c.position}·${c.name}${c.orientation}`).join(' → ')}`,
|
|
1182
|
+
`大阿卡纳 ${major.length}/${n}`,
|
|
1183
|
+
],
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
key: 'love', label: '爱情与感情',
|
|
1187
|
+
text: `${dimBase('love') ? `与感情最相关的是「${dimBase('love').name}」(${dimBase('love').position}·${dimBase('love').orientation}):${dimBase('love').core || (dimBase('love').keywords || []).join('、')}。` : '牌面上没有明确指向感情的牌,当下这段关系不是主要议题。'}` +
|
|
1188
|
+
`${elCount.水 ? '有水元素,情感与感受在这件事里占的分量不轻。' : '缺水元素,容易用理性压过感受,留意别忽略自己的情绪。'}`,
|
|
1189
|
+
advice: `${elCount.水 ? '先照顾好感受再谈效率:把想说的话说出口,比猜对方心思有效' : '给自己留一点感受情绪的时间,别把所有事都当任务处理'};${dimBase('love') && !dimBase('love').upright ? '相关牌为逆位,提示关系里有没说开的地方,找个合适时机讲清楚。' : ''}关系取决于你们怎么做,牌只帮你把问题问清楚。`,
|
|
1190
|
+
evidence: [
|
|
1191
|
+
`感情相关牌 ${dimBase('love') ? `${dimBase('love').name}·${dimBase('love').position}·${dimBase('love').orientation}` : '无'}`,
|
|
1192
|
+
`水元素 ${elCount.水 || 0} 张`,
|
|
1193
|
+
],
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
key: 'health', label: '健康状况',
|
|
1197
|
+
text: `牌阵里${dimBase('health') ? `与健康状态最贴近的是「${dimBase('health').name}」:${dimBase('health').core || (dimBase('health').keywords || []).join('、')}` : '没有直接指向身体的牌'}。` +
|
|
1198
|
+
`${reversed.length >= 2 ? `${reversed.length} 张逆位,提示内在消耗偏大,身体往往是第一个反映出来的` : '整体状态与牌面呈现的相对一致'}` +
|
|
1199
|
+
`${elCount.土 || elCount.水 ? '' : ';缺土与水,作息与身体的基本盘容易被牺牲'}。这些是象征性的提示,不是诊断。`,
|
|
1200
|
+
advice: `${reversed.length >= 2 ? '建议先把睡眠与饮食稳住,别在这个阶段额外加压' : '维持现有作息,适度运动即可'};${lack.length ? `补${lack[0]}所代表的${TAROT_ELEMENT_FOCUS[lack[0]]?.area || ''}:${TAROT_ELEMENT_FOCUS[lack[0]]?.advice || ''}` : ''}身体有明确不适请就医,牌面不能替代专业意见。`,
|
|
1201
|
+
evidence: [
|
|
1202
|
+
`健康相关牌 ${dimBase('health') ? `${dimBase('health').name}·${dimBase('health').position}` : '无'}`,
|
|
1203
|
+
`逆位 ${reversed.length} 张`,
|
|
1204
|
+
`元素 土${elCount.土 || 0} / 水${elCount.水 || 0}`,
|
|
1205
|
+
],
|
|
1206
|
+
},
|
|
1207
|
+
];
|
|
1208
|
+
|
|
1209
|
+
return {
|
|
1210
|
+
lead: `塔罗是一套象征系统而不是判决。下面先给整盘的连贯解读(把几张牌串成一条线),再分五个维度落到生活里。`,
|
|
1211
|
+
dimensions, sections,
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
// ══════════════════════════════════════════════════════════
|
|
1216
|
+
// 统一入口
|
|
1217
|
+
// ══════════════════════════════════════════════════════════
|
|
1218
|
+
const BUILDERS = {
|
|
1219
|
+
bazi: baziInterpret,
|
|
1220
|
+
ziwei: ziweiInterpret,
|
|
1221
|
+
liuyao: liuyaoInterpret,
|
|
1222
|
+
meihua: meihuaInterpret,
|
|
1223
|
+
daliuren: daliurenInterpret,
|
|
1224
|
+
tarot: tarotInterpret,
|
|
1225
|
+
};
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* 生成解析与详解
|
|
1229
|
+
* @param {object} r compute() 的返回值
|
|
1230
|
+
* @param {object} [opts] 可选:{ question 所问之事, direction 询问方向 key }
|
|
1231
|
+
* 传了就把最贴近的维度提前、在该维度点明问题与方向,并给出回显串
|
|
1232
|
+
* @returns {object|null} 结构化解析对象
|
|
1233
|
+
*/
|
|
1234
|
+
import { interpretQimen } from './qimen-interpret.js';
|
|
1235
|
+
import { buildAnswer, buildPlain, buildGlossary, buildFollowups, dimensionPlain } from './interpret-plain.js';
|
|
1236
|
+
import { knowledgeFor, caveatsFor, STATUS_LABEL } from './interpret-knowledge.js';
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* 给任意体系的解析结果补上「白话四层」:直答 / 说人话 / 每维一句话 / 追问建议。
|
|
1240
|
+
* 单独抽出来,是为了让奇门(走 qimen-interpret 的另一条路径)也能共用同一套口吻。
|
|
1241
|
+
*/
|
|
1242
|
+
function enrichPlain(result, r, ask) {
|
|
1243
|
+
if (!result) return result;
|
|
1244
|
+
const dims = (result.dimensions || []).map((d) => {
|
|
1245
|
+
const p = dimensionPlain(d.key, r, {});
|
|
1246
|
+
// 知识条目挂在维度下:讲「为什么这样断」,与结论、依据形成三层
|
|
1247
|
+
const know = knowledgeFor(r.system, d.key).map((k) => ({
|
|
1248
|
+
id: k.id,
|
|
1249
|
+
gist: k.gist,
|
|
1250
|
+
detail: k.detail,
|
|
1251
|
+
source: k.source,
|
|
1252
|
+
status: k.status,
|
|
1253
|
+
statusLabel: STATUS_LABEL[k.status] || k.status,
|
|
1254
|
+
note: k.note || '',
|
|
1255
|
+
}));
|
|
1256
|
+
return { ...d, ...(p ? { plain: p } : {}), ...(know.length ? { knowledge: know } : {}) };
|
|
1257
|
+
});
|
|
1258
|
+
const texts = [
|
|
1259
|
+
result.lead,
|
|
1260
|
+
...dims.map((d) => [d.label, d.text, d.advice, d.plain, ...(d.knowledge || []).map((k) => k.detail)].filter(Boolean).join('')),
|
|
1261
|
+
...(result.sections || []).map((x) => x.text),
|
|
1262
|
+
].filter(Boolean);
|
|
1263
|
+
|
|
1264
|
+
// 文末的诚实声明:把「各家有异说 / 还没做」的部分摊开,而不是藏在专业感里
|
|
1265
|
+
const caveats = caveatsFor(r.system);
|
|
1266
|
+
const caveatLine = caveats.length
|
|
1267
|
+
? caveats.slice(0, 4).map((k) => `· ${k.gist}(${STATUS_LABEL[k.status] || k.status})${k.note ? `——${k.note}` : ''}`).join('\n')
|
|
1268
|
+
: '';
|
|
1269
|
+
const secs = [...(result.sections || [])];
|
|
1270
|
+
if (caveatLine) {
|
|
1271
|
+
secs.push({
|
|
1272
|
+
key: 'caveats',
|
|
1273
|
+
label: '这套规则有多稳',
|
|
1274
|
+
text: `下列几条各家说法不一,本插件取其中一派并把分歧标出来,供你判断可信度:\n${caveatLine}`,
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
const todos = caveats.filter((k) => k.status === 'todo');
|
|
1278
|
+
if (todos.length) {
|
|
1279
|
+
secs.push({
|
|
1280
|
+
key: 'todo',
|
|
1281
|
+
label: '尚未实现(不猜)',
|
|
1282
|
+
text: todos.map((k) => `· ${k.gist}${k.note ? `——${k.note}` : ''}`).join('\n'),
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
return {
|
|
1287
|
+
...result,
|
|
1288
|
+
dimensions: dims,
|
|
1289
|
+
sections: secs,
|
|
1290
|
+
answer: result.answer || buildAnswer(r, ask, {}),
|
|
1291
|
+
plain: result.plain || buildPlain(r, ask, {}),
|
|
1292
|
+
followups: buildFollowups(r, ask),
|
|
1293
|
+
glossary: buildGlossary(texts, r.system),
|
|
1294
|
+
knowledgeCount: dims.reduce((n, d) => n + ((d.knowledge || []).length), 0),
|
|
1295
|
+
caveats: caveats.map((k) => ({ id: k.id, gist: k.gist, status: k.status, statusLabel: STATUS_LABEL[k.status] || k.status })),
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
/** 各体系采用的技法标签:证据卡第一行要写「这条结论是用什么方法得出的」 */
|
|
1300
|
+
const TECHNIQUE = {
|
|
1301
|
+
bazi: '八字(月令 · 十神 · 大运流年)',
|
|
1302
|
+
ziwei: '紫微(宫位 · 四化 · 大限流年)',
|
|
1303
|
+
liuyao: '六爻(卦宫 · 世应 · 动爻 · 日辰)',
|
|
1304
|
+
meihua: '梅花(体用 · 互卦 · 变卦)',
|
|
1305
|
+
daliuren: '六壬(月将加时 · 四课 · 三传)',
|
|
1306
|
+
qimen: '奇门(九宫 · 值符值使 · 用神)',
|
|
1307
|
+
tarot: '塔罗(牌阵 · 正逆位 · 元素)',
|
|
1308
|
+
hepan: '合盘(日主 · 夫妻宫 · 五行互补)',
|
|
1309
|
+
};
|
|
1310
|
+
|
|
1311
|
+
/** 置信度:只按公开证据条数分档,不引入新算法——3 条以上「强」、2 条「中」、其余「弱」 */
|
|
1312
|
+
const confidenceOf = (dim) => {
|
|
1313
|
+
const n = Array.isArray(dim && dim.evidence) ? dim.evidence.length : 0;
|
|
1314
|
+
return n >= 3 ? '强' : n >= 2 ? '中' : '弱';
|
|
1315
|
+
};
|
|
1316
|
+
|
|
1317
|
+
const withReportMeta = (body, r, ask) => enrichPlain({
|
|
1318
|
+
...body,
|
|
1319
|
+
moduleType: MODULE_TYPE[r.system] || 'natal',
|
|
1320
|
+
system: r.system,
|
|
1321
|
+
systemLabel: SYSTEM_LABEL[r.system] || r.system,
|
|
1322
|
+
title: '解析与详解',
|
|
1323
|
+
dimensions: (body.dimensions || []).map((d) => ({ ...d, confidence: d.confidence || confidenceOf(d) })),
|
|
1324
|
+
sections: body.sections || [],
|
|
1325
|
+
outline: body.outline || [],
|
|
1326
|
+
tables: body.tables || [],
|
|
1327
|
+
technique: TECHNIQUE[r.system] || SYSTEM_LABEL[r.system] || r.system,
|
|
1328
|
+
disclaimer: body.disclaimer || DISCLAIMER,
|
|
1329
|
+
ask,
|
|
1330
|
+
}, r, ask);
|
|
1331
|
+
|
|
1332
|
+
export function interpret(r, opts) {
|
|
1333
|
+
if (!isObj(r) || !r.system) return null;
|
|
1334
|
+
const ask = askOf(opts);
|
|
1335
|
+
if (r.system === 'qimen') return withReportMeta(interpretQimen(r, opts), r, ask);
|
|
1336
|
+
const fn = BUILDERS[r.system];
|
|
1337
|
+
if (!fn) return null;
|
|
1338
|
+
let body;
|
|
1339
|
+
try {
|
|
1340
|
+
body = fn(r);
|
|
1341
|
+
} catch (e) {
|
|
1342
|
+
return {
|
|
1343
|
+
moduleType: MODULE_TYPE[r.system] || 'natal',
|
|
1344
|
+
system: r.system,
|
|
1345
|
+
systemLabel: SYSTEM_LABEL[r.system] || r.system,
|
|
1346
|
+
title: '解析与详解',
|
|
1347
|
+
lead: '这一盘的解析暂未生成,请稍后重试。',
|
|
1348
|
+
dimensions: [],
|
|
1349
|
+
sections: [],
|
|
1350
|
+
outline: [],
|
|
1351
|
+
tables: [],
|
|
1352
|
+
technique: TECHNIQUE[r.system] || '',
|
|
1353
|
+
disclaimer: DISCLAIMER,
|
|
1354
|
+
error: String(e && e.message),
|
|
1355
|
+
ask,
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1358
|
+
const tuned = applyAsk(body.dimensions || [], ask, body.lead || '');
|
|
1359
|
+
return withReportMeta({
|
|
1360
|
+
lead: tuned.lead,
|
|
1361
|
+
dimensions: tuned.dims,
|
|
1362
|
+
sections: body.sections || [],
|
|
1363
|
+
outline: body.outline || [],
|
|
1364
|
+
tables: body.tables || [],
|
|
1365
|
+
}, r, ask);
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
export default interpret;
|
|
1369
|
+
|
|
1370
|
+
|