# Key Resonance Destiny Analysis
## 键共振命理判局系统
**Developer:** Jason Li（黎哲深）  
**Copyright:** © 2026 Jason Li. All rights reserved.  
**App:** Key Resonance Destiny Analysis

Cross-platform GanZhi judgment system with true-solar time correction (Beijing meridian 120°E), key-network analysis, resonance/entanglement, Liu Qin positioning, and structured reports (531 boundary · max accuracy 80%).

---

### Projects

| Path | Platform | Stack |
|------|----------|--------|
| `flutter_app/` | Android + iOS (one codebase) | Flutter / Dart |
| `ios_app/` | iOS (native) | SwiftUI |

---

### Core engine (shared rules)

1. **Time correction** — origin 东经120°; 4 min/°; day boundary 23:00; Pacific→Atlantic date-line offset for western longitudes  
2. **Chart** — year by 立春, month by solar terms (南半球月支对冲), day by Beijing time, hour by local 时辰 + 五鼠遁  
3. **Keys** — 合/冲/刑/害/破/生/克/同字/同行  
4. **Resonance** — energy ×1–×6; entanglement syncs peer/clash/combine  
5. **Liu Qin** — male/female tables; 有星看星、无星看宫; three layers (家内/家外)  
6. **531** — fate 50% + luck 30% + geo 10% + will 5% + heaven 5% → **80% cap**

Validated against tutorial cases:

| Case | Result |
|------|--------|
| Jason 1973-10-15 12:00 Beijing | **癸丑 壬戌 甲申 庚午** |
| Beijing 2008-12-03 02:08 | 戊子 癸亥 丁丑 辛丑 |
| Beijing 2008-12-03 02:08 | 戊子 癸亥 丁丑 辛丑 |
| Chicago 87°W | 戊子 癸亥 戊寅 癸丑 |
| London 0° | 戊子 癸亥 丁丑 辛丑 |
| Melbourne south | **戊子 癸巳 丁丑 辛丑**（教程日时笔误已更正） |

---

### Flutter (Android / iOS / **Web**)

```bash
cd flutter_app
flutter pub get
flutter test
flutter run -d chrome          # Web 本地
flutter build web --release    # 产出 build/web
# 静态托管：
python3 -m http.server 8080 --directory build/web
```

Stripe: pass `--dart-define=STRIPE_PK=pk_live_...` (dev mode unlocks reports without a real key).

Author unlock (web): open with query `?unlock=master#/` — reports unlock without payment.
Example: `http://HOST:8080/?unlock=master#/`
---

### Native iOS (SwiftUI)

See `ios_app/KeyResonanceDestiny/README_IOS.md`.

```bash
cd ios_app
# On macOS with Swift toolchain:
swift test
# Then create an iOS App target in Xcode and add KeyResonanceDestiny/ sources
```

---

### Features
### Features

- Birth input (name, gender, local datetime, lat/lon, city presets)  
- Full judgment report (tutorial format) + 流年穿透  
- Cross-chart key resonance (跨命局键共振)  
- Tutorial case verification (Jason / brother / father)  
- EN / 中文 / 日本語  
- Stripe payment stub → report delivery token  
- Privacy policy screen  

---

### Payments

Configure Stripe (SSN-registered US account per your setup) before production. Replace placeholder publishable keys in:

- `flutter_app/lib/services/stripe_service.dart`
- `ios_app/KeyResonanceDestiny/Services/StripeService.swift`

---

### License

© 2026 Jason Li. All rights reserved.
