紫徽斗数

基于Go语言开发的紫微斗数排盘微服务,提供阳历/农历两种排盘方式。

art-and-culture

637 查看 · 2026-07-07 更新

简介

基于Go语言开发的紫微斗数排盘微服务,提供阳历/农历两种排盘方式。

简介

基于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

ParameterTypeRequiredDescription
yearNumberYesYear (e.g., 2024)
monthNumberYesMonth (1-12)
dayNumberYesDay (1-31)
hourNumberYesHour (0-23)
minuteNumberYesMinute (0-59)
sexStringYesGender (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

Dependencies

  • mcp-go v0.20.1
  • goja JavaScript engine
  • iztro iztro.min.js core logic file for Purple Star Astrology charting (located in the project root directory)

来源