紫徽斗数
基于Go语言开发的紫微斗数排盘微服务,提供阳历/农历两种排盘方式。
服务介绍
Purple Star Astrology Charting Service
Project Overview
A microservice for Purple Star Astrology charting developed in Go, providing both Gregorian and Lunar calendar charting methods.
Features
- Gregorian Calendar Charting Endpoint:
/ziwei_yangli - Lunar Calendar Charting Endpoint:
/ziwei_nongli - Automatic conversion of time periods
- Returns data in standard JSON format
Getting Started
Environment Requirements
- Go 1.23+
Compilation and Execution
bash
go mod tidy
go run main.go
API Documentation
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| year | Number | Yes | Year (e.g., 2024) |
| month | Number | Yes | Month (1-12) |
| day | Number | Yes | Day (1-31) |
| hour | Number | Yes | Hour (0-23) |
| minute | Number | Yes | Minute (0-59) |
| sex | String | Yes | Gender (Male/Female) |
Time Period Conversion Table
The service automatically converts hours into traditional Chinese time periods:
0: Zi Period (23:00-01:00)
1: Chou Period (01:00-03:00)
...
11: Hai Period (21:00-23:00)
Service Configuration
Configure through command line arguments:
bash
Specify the listening address and port
go run main.go --host 127.0.0.1 --port 3000