diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index e8a87306..83f126da 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -2,21 +2,20 @@ name: Build Linux on: push: - branches: [ master ] + branches: [main] pull_request: - branches: [ master ] + branches: [main] env: UPLOAD_BIN_FILE: true jobs: - build: name: Build strategy: matrix: - go-version: [ 1.19.x ] - platform: [ ubuntu-latest ] - arch: [ 386, amd64 ] + go-version: [1.19.x] + platform: [ubuntu-latest] + arch: [386, amd64] runs-on: ${{ matrix.platform }} steps: - name: Check out code into the Go module directory @@ -31,17 +30,17 @@ jobs: if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest') && matrix.arch == 'amd64' && env.UPLOAD_BIN_FILE id: build_linux_amd64 env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' + ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" run: | go mod tidy export GOARCH=${{ matrix.arch }} export CGO_ENABLED=1 echo "FATENAME=fate_$(go env GOOS)_$(go env GOARCH)" >> $GITHUB_ENV echo "$(go env GOOS) $(go env GOARCH)" - + echo "building" go build -o fate_$(go env GOOS)_$(go env GOARCH) -v ./cmd/console - + echo "compress" tar -zcvf fate_$(go env GOOS)_$(go env GOARCH).tar.gz ./fate_$(go env GOOS)_$(go env GOARCH) @@ -49,7 +48,7 @@ jobs: if: matrix.platform == 'ubuntu-latest' && matrix.arch == '386' && env.UPLOAD_BIN_FILE id: build_linux_386 env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' + ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" run: | go mod tidy export GOARCH=${{ matrix.arch }} @@ -60,10 +59,10 @@ jobs: export CC="/usr/bin/i686-linux-gnu-gcc -m32" echo "FATENAME=fate_$(go env GOOS)_$(go env GOARCH)" >> $GITHUB_ENV echo "$(go env GOOS) $(go env GOARCH)" - + echo "building" go build -o fate_$(go env GOOS)_$(go env GOARCH) -v ./cmd/console - + echo "compress" tar -zcvf fate_$(go env GOOS)_$(go env GOARCH).tar.gz ./fate_$(go env GOOS)_$(go env GOARCH) @@ -71,7 +70,7 @@ jobs: uses: actions/upload-artifact@master if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest') && env.UPLOAD_BIN_FILE env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' + ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" with: name: ${{ env.FATENAME }}.tar.gz path: ${{ env.FATENAME }}.tar.gz @@ -82,7 +81,7 @@ jobs: uses: ncipollo/release-action@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' + ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" with: artifacts: "${{ env.FATENAME }}.tar.gz" allowUpdates: true @@ -94,4 +93,3 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} draft: false prerelease: false - diff --git a/.github/workflows/build_macos.yml b/.github/workflows/build_macos.yml index 4a0a2418..09d789e7 100644 --- a/.github/workflows/build_macos.yml +++ b/.github/workflows/build_macos.yml @@ -2,9 +2,9 @@ name: Build Macos on: push: - branches: [ master ] + branches: [ main ] pull_request: - branches: [ master ] + branches: [ main ] env: UPLOAD_BIN_FILE: true diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index aa00f3c3..d6a495c3 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -2,9 +2,9 @@ name: Build Windows on: push: - branches: [ master ] + branches: [ main ] pull_request: - branches: [ master ] + branches: [ main ] env: UPLOAD_BIN_FILE: true diff --git a/README.md b/README.md index 004af48d..ed86d7f4 100644 --- a/README.md +++ b/README.md @@ -36,21 +36,22 @@ Github上第一个开源的中文取名项目(The first chinese name create tool 1. 编写运行go代码,接口调用生成姓名 ```go - //使用前请导入database的数据(测试字库已基本完善, 保险起见生成姓名后可以去一些测名网站验证下) - //加载配置(具体参数参考example/create_a_name) + // 使用前请导入database的数据(测试字库已基本完善, 保险起见生成姓名后可以去一些测名网站验证下) + // 加载配置(具体参数参考example/create_a_name) cfg := config.Default() - //生日: + // 生日: born := chronos.New("2020/01/23 11:31") - //姓氏: + // 姓氏: lastName := "张" - //第一参数:姓氏 - //第二参数:生日 + // 第一参数:姓氏 + // 第二参数:生日 f := fate.NewFate(lastName, born.Solar().Time(), fate.ConfigOption(cfg)) e := f.MakeName(context.Background()) if e != nil { t.Fatal(e) } + ``` 2. 使用预编译二进制文件生成姓名 @@ -64,8 +65,8 @@ Github上第一个开源的中文取名项目(The first chinese name create tool ``` 3. ~~针对没有安装Go环境的用户,使用二进制文件在运行前务必把zoneinfo.zip下载并和二进制文件放在一起(不要解压),不然会报错.~~ - ~~[zoneinfo文件](https://github.com/babyname/fate/blob/master/zoneinfo.zip)~~ - 最新编译的版本使用了Go新版编译, 已经不再需要手动下载`zoneinfo.zip`文件了. + ~~[zoneinfo文件](https://github.com/babyname/fate/blob/master/zoneinfo.zip)~~ + 最新编译的版本使用了Go新版编译, 已经不再需要手动下载`zoneinfo.zip`文件了. ### 常见问题 @@ -93,11 +94,11 @@ Github上第一个开源的中文取名项目(The first chinese name create tool ``` 3. 数据库配置, 替换config.json中相关部分 - - MYSQL配置: - - host填写mysql数据库的地址 - - user填写mysql数据库的用户名 - - pwd填写mysql数据库的密码 - - name填写mysql数据库的库名 + - MYSQL配置: + - host填写mysql数据库的地址 + - user填写mysql数据库的用户名 + - pwd填写mysql数据库的密码 + - name填写mysql数据库的库名 ```json "database": { @@ -116,8 +117,8 @@ Github上第一个开源的中文取名项目(The first chinese name create tool }, ``` - - SQLITE3配置: - - name填写本地sqlite的数据库名字, 放在fate同一目录下 + - SQLITE3配置: + - name填写本地sqlite的数据库名字, 放在fate同一目录下 ```json "database": { @@ -152,12 +153,12 @@ FATE使用了以下算法,查询字典库自动生成匹配规则的名字. 按照每种算法的准确度,使用程度也有高有低,不会一概而否,也不会偏向单独某种算法. 不会按照个人喜好做出选择. -- 周易卦象 -- 大衍之数 -- 三才五格 -- 喜用神(平衡用神) -- 生肖用字 -- 八字吉凶 +- 周易卦象 +- 大衍之数 +- 三才五格 +- 喜用神(平衡用神) +- 生肖用字 +- 八字吉凶 目前Fate以六大派为基准综合计算生成名字: @@ -170,31 +171,31 @@ FATE使用了以下算法,查询字典库自动生成匹配规则的名字. 目前使用到的一些库: -- 八字计算(用于计算生辰): +- 八字计算(用于计算生辰): - 字典数据(一个爬虫工具填充字典数据库): -如果谁有更好用的可以告诉我. + 如果谁有更好用的可以告诉我. ### 资料查询 1. 全国及各省重名查询网址汇总 - 网友提供:`https://zhuanlan.zhihu.com/p/89654568`(**请谨慎访问非本站点地址**) - [本仓库地址](./docs/chinese_name_query.md) + 网友提供:`https://zhuanlan.zhihu.com/p/89654568`(**请谨慎访问非本站点地址**) + [本仓库地址](./docs/chinese_name_query.md) ## 一些废话 - 在过去的几年中虽然Fate经过了好几个版本的改进, 但是仍然有许多不足之处. - 包括生成的名字太多不容易筛选, - 有些用户遇到了一些和Go相关的问题, - 一些用户不知道如何导入数据库等. - 这些问题都只能慢慢想办法去解决. - - 还有些用户因为字典库生成的名字中有些字的寓意不好, 你可以手动删掉你不喜欢字, 却来恶意中伤作者. - 我想说的是这个字也不是我造的, 你如果有问题可以去找造那个字的人. - 如果觉得这个工具不好你可以不用. - - 最近一年中因为作者个人原因导致Fate更新缓慢, 在这里向大家道个歉. - 大家也知道现在国内的IT环境, 毕竟我也要生活, 生活所迫没有太多时间放在业余的项目上. - 我只能尽量抽出时间来完善Fate的规则和代码. - 在这里同样要感谢支持我的朋友们, 大家的出发点我相信是一样的. - 用这个工具目的都是为了给孩子取一个好名字. \ No newline at end of file +在过去的几年中虽然Fate经过了好几个版本的改进, 但是仍然有许多不足之处. +包括生成的名字太多不容易筛选, +有些用户遇到了一些和Go相关的问题, +一些用户不知道如何导入数据库等. +这些问题都只能慢慢想办法去解决. + +还有些用户因为字典库生成的名字中有些字的寓意不好, 你可以手动删掉你不喜欢字, 却来恶意中伤作者. +我想说的是这个字也不是我造的, 你如果有问题可以去找造那个字的人. +如果觉得这个工具不好你可以不用. + +最近一年中因为作者个人原因导致Fate更新缓慢, 在这里向大家道个歉. +大家也知道现在国内的IT环境, 毕竟我也要生活, 生活所迫没有太多时间放在业余的项目上. +我只能尽量抽出时间来完善Fate的规则和代码. +在这里同样要感谢支持我的朋友们, 大家的出发点我相信是一样的. +用这个工具目的都是为了给孩子取一个好名字. \ No newline at end of file diff --git a/README_EN.md b/README_EN.md index ce930375..6d5a17bf 100644 --- a/README_EN.md +++ b/README_EN.md @@ -8,6 +8,7 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/babyname/fate)](https://goreportcard.com/report/github.com/babyname/fate) ## Introduce + A modern science chinese name create tool. The first chinese name create tool in github It uses some traditional Chinese algorithms. It is used to get a good name for a newborn baby. \ No newline at end of file diff --git a/bazi.go b/bazi.go index 8d224418..a6678d7b 100644 --- a/bazi.go +++ b/bazi.go @@ -1,8 +1,9 @@ package fate import ( - "github.com/godcong/chronos" "strings" + + "github.com/godcong/chronos" ) var diIndex = map[string]int{ @@ -13,7 +14,7 @@ var tianIndex = map[string]int{ "甲": 0, "乙": 1, "丙": 2, "丁": 3, "戊": 4, "己": 5, "庚": 6, "辛": 7, "壬": 8, "癸": 9, } -//天干强度表 +// 天干强度表 var tiangan = [][]int{ {1200, 1200, 1000, 1000, 1000, 1000, 1000, 1000, 1200, 1200}, {1060, 1060, 1000, 1000, 1100, 1100, 1140, 1140, 1100, 1100}, @@ -29,7 +30,7 @@ var tiangan = [][]int{ {1200, 1200, 1000, 1000, 1000, 1000, 1000, 1000, 1140, 1140}, } -//地支强度表 +// 地支强度表 var dizhi = []map[string][]int{ { "癸": {1200, 1100, 1000, 1000, 1040, 1060, 1000, 1000, 1200, 1200, 1060, 1140}, @@ -98,12 +99,12 @@ var wuXingDiZhi = map[string]string{ "亥": "水", } -//WuXingTianGan 五行天干 +// WuXingTianGan 五行天干 func WuXingTianGan(s string) string { return wuXingTianGan[s] } -//WuXingDiZhi 五行地支 +// WuXingDiZhi 五行地支 func WuXingDiZhi(s string) string { return wuXingDiZhi[s] } @@ -115,7 +116,7 @@ type BaZi struct { xiyong *XiYong } -//NewBazi 创建八字 +// NewBazi 创建八字 func NewBazi(calendar chronos.Calendar) *BaZi { ec := calendar.Lunar().EightCharacter() return &BaZi{ @@ -129,18 +130,18 @@ func (z *BaZi) String() string { return strings.Join(z.baZi, "") } -//RiZhu 日主 +// RiZhu 日主 func (z *BaZi) RiZhu() string { return z.baZi[4] } func (z *BaZi) calcXiYong() { z.xiyong = &XiYong{} - //TODO:need fix - z.point().calcSimilar().calcHeterogeneous() //.yongShen().xiShen() + // TODO:need fix + z.point().calcSimilar().calcHeterogeneous() // .yongShen().xiShen() } -//XiYong 喜用神 +// XiYong 喜用神 func (z *BaZi) XiYong() *XiYong { if z.xiyong == nil { z.calcXiYong() @@ -148,7 +149,7 @@ func (z *BaZi) XiYong() *XiYong { return z.xiyong } -//XiYongShen 平衡用神 +// XiYongShen 平衡用神 func (z *BaZi) XiYongShen() string { return z.XiYong().Shen() } @@ -180,7 +181,7 @@ func baziToWuXing(bazi []string) []string { return wx } -//计算同类 +// 计算同类 func (z *BaZi) calcSimilar() *BaZi { for i := range sheng { if wuXingTianGan[z.RiZhu()] == sheng[i] { @@ -200,7 +201,7 @@ func (z *BaZi) calcSimilar() *BaZi { return z } -//计算异类 +// 计算异类 func (z *BaZi) calcHeterogeneous() *BaZi { for i := range sheng { for ti := range z.xiyong.Similar { diff --git a/bazi_test.go b/bazi_test.go index 225458bb..237ed714 100644 --- a/bazi_test.go +++ b/bazi_test.go @@ -1,10 +1,12 @@ package fate_test import ( - "github.com/godcong/chronos" - "github.com/babyname/fate" "log" "testing" + + "github.com/godcong/chronos" + + "github.com/babyname/fate" ) func TestPoint(t *testing.T) { diff --git a/character.go b/character.go index 28042986..f6f35aab 100644 --- a/character.go +++ b/character.go @@ -3,35 +3,36 @@ package fate import ( "crypto/sha256" "fmt" + "github.com/xormsharp/builder" "github.com/xormsharp/xorm" ) -//Character 字符 +// Character 字符 type Character struct { Hash string `xorm:"pk hash"` - PinYin []string `xorm:"default() notnull pin_yin"` //拼音 - Ch string `xorm:"default() notnull ch"` //字符 - ScienceStroke int `xorm:"default(0) notnull science_stroke" json:"science_stroke"` //科学笔画 - Radical string `xorm:"default() notnull radical"` //部首 - RadicalStroke int `xorm:"default(0) notnull radical_stroke"` //部首笔画 - Stroke int `xorm:"default() notnull stroke"` //总笔画数 - IsKangXi bool `xorm:"default(0) notnull is_kang_xi"` //是否康熙字典 - KangXi string `xorm:"default() notnull kang_xi"` //康熙 - KangXiStroke int `xorm:"default(0) notnull kang_xi_stroke"` //康熙笔画 - SimpleRadical string `xorm:"default() notnull simple_radical"` //简体部首 - SimpleRadicalStroke int `xorm:"default(0) notnull simple_radical_stroke"` //简体部首笔画 - SimpleTotalStroke int `xorm:"default(0) notnull simple_total_stroke"` //简体笔画 - TraditionalRadical string `xorm:"default() notnull traditional_radical"` //繁体部首 - TraditionalRadicalStroke int `xorm:"default(0) notnull traditional_radical_stroke"` //繁体部首笔画 - TraditionalTotalStroke int `xorm:"default(0) notnull traditional_total_stroke"` //简体部首笔画 - NameScience bool `xorm:"default(0) notnull name_science"` //姓名学 - WuXing string `xorm:"default() notnull wu_xing"` //五行 - Lucky string `xorm:"default() notnull lucky"` //吉凶寓意 - Regular bool `xorm:"default(0) notnull regular"` //常用 - TraditionalCharacter []string `xorm:"default() notnull traditional_character"` //繁体字 - VariantCharacter []string `xorm:"default() notnull variant_character"` //异体字 - Comment []string `xorm:"default() notnull comment"` //解释 + PinYin []string `xorm:"default() notnull pin_yin"` // 拼音 + Ch string `xorm:"default() notnull ch"` // 字符 + ScienceStroke int `xorm:"default(0) notnull science_stroke" json:"science_stroke"` // 科学笔画 + Radical string `xorm:"default() notnull radical"` // 部首 + RadicalStroke int `xorm:"default(0) notnull radical_stroke"` // 部首笔画 + Stroke int `xorm:"default() notnull stroke"` // 总笔画数 + IsKangXi bool `xorm:"default(0) notnull is_kang_xi"` // 是否康熙字典 + KangXi string `xorm:"default() notnull kang_xi"` // 康熙 + KangXiStroke int `xorm:"default(0) notnull kang_xi_stroke"` // 康熙笔画 + SimpleRadical string `xorm:"default() notnull simple_radical"` // 简体部首 + SimpleRadicalStroke int `xorm:"default(0) notnull simple_radical_stroke"` // 简体部首笔画 + SimpleTotalStroke int `xorm:"default(0) notnull simple_total_stroke"` // 简体笔画 + TraditionalRadical string `xorm:"default() notnull traditional_radical"` // 繁体部首 + TraditionalRadicalStroke int `xorm:"default(0) notnull traditional_radical_stroke"` // 繁体部首笔画 + TraditionalTotalStroke int `xorm:"default(0) notnull traditional_total_stroke"` // 简体部首笔画 + NameScience bool `xorm:"default(0) notnull name_science"` // 姓名学 + WuXing string `xorm:"default() notnull wu_xing"` // 五行 + Lucky string `xorm:"default() notnull lucky"` // 吉凶寓意 + Regular bool `xorm:"default(0) notnull regular"` // 常用 + TraditionalCharacter []string `xorm:"default() notnull traditional_character"` // 繁体字 + VariantCharacter []string `xorm:"default() notnull variant_character"` // 异体字 + Comment []string `xorm:"default() notnull comment"` // 解释 } // InsertOrUpdateCharacter ... @@ -84,10 +85,10 @@ func Stoker(s int, options ...CharacterOptions) func(engine *xorm.Engine) *xorm. return func(engine *xorm.Engine) *xorm.Session { session := engine.Where("pin_yin IS NOT NULL"). And(builder.Eq{"science_stroke": s}) - //Or(builder.Eq{"stroke": s}). - //Or(builder.Eq{"kang_xi_stroke": s}). - //Or(builder.Eq{"simple_total_stroke": s}). - //Or(builder.Eq{"traditional_total_stroke": s})) + // Or(builder.Eq{"stroke": s}). + // Or(builder.Eq{"kang_xi_stroke": s}). + // Or(builder.Eq{"simple_total_stroke": s}). + // Or(builder.Eq{"traditional_total_stroke": s})) for _, option := range options { session = option(session) } diff --git a/database.go b/database.go index 6df6ae22..c0b1d436 100644 --- a/database.go +++ b/database.go @@ -123,8 +123,8 @@ func initSQL(database config.Database) *xorm.Engine { eng.ShowSQL(true) } - //if database.ShowExecTime { + // if database.ShowExecTime { // eng.ShowExecTime(true) - //} + // } return eng } diff --git a/dayan.go b/dayan.go index ced4de0c..90cef82c 100644 --- a/dayan.go +++ b/dayan.go @@ -98,22 +98,22 @@ type DaYan struct { Number int Lucky string Max bool - Sex Sex //male(false),female(true) + Sex Sex // male(false),female(true) SkyNine string Comment string } -//IsNotSuitableSex 女性不宜此数 +// IsNotSuitableSex 女性不宜此数 func (dy DaYan) IsNotSuitableSex() bool { return dy.Sex == SexGirl } -//IsMax 是否最大好运数 +// IsMax 是否最大好运数 func (dy DaYan) IsMax() bool { return dy.Max } -//GetDaYan 获取大衍之数 +// GetDaYan 获取大衍之数 func GetDaYan(idx int) DaYan { if idx <= 0 { panic("wrong idx") diff --git a/fate.go b/fate.go index 097cac5c..79d82f3b 100644 --- a/fate.go +++ b/fate.go @@ -4,12 +4,14 @@ import ( "context" "errors" "fmt" - "github.com/babyname/fate/config" - "github.com/goextension/log" - "github.com/xormsharp/xorm" "strings" "time" + "github.com/goextension/log" + "github.com/xormsharp/xorm" + + "github.com/babyname/fate/config" + "github.com/godcong/chronos" "github.com/godcong/yi" ) @@ -87,7 +89,7 @@ func Debug() Options { } } -//NewFate 所有的入口,新建一个fate对象 +// NewFate 所有的入口,新建一个fate对象 func NewFate(lastName string, born time.Time, options ...Options) Fate { f := &fateImpl{ last: strings.Split(lastName, ""), @@ -119,7 +121,7 @@ func (f *fateImpl) getLastCharacter() error { } else if size > 2 { return fmt.Errorf("%d characters last name was not supported", size) } else { - //ok + // ok } for i, c := range f.last { @@ -139,6 +141,7 @@ func (f *fateImpl) MakeName(ctx context.Context) (e error) { if e != nil { return Wrap(e, "write head failed") } + defer f.out.Finish() e = f.RunInit() if e != nil { return Wrap(e, "init failed") @@ -161,7 +164,7 @@ func (f *fateImpl) MakeName(ctx context.Context) (e error) { }() var tmpChar []*Character - //supplyFilter := false + // supplyFilter := false for n := range name { select { case <-ctx.Done(): @@ -172,19 +175,19 @@ func (f *fateImpl) MakeName(ctx context.Context) (e error) { tmpChar = n.FirstName tmpChar = append(tmpChar, n.LastName...) - //filter bazi + // filter bazi if f.config.SupplyFilter && !filterXiYong(f.XiYong().Shen(), tmpChar...) { - //log.Infow("supply", "name", n.String()) + // log.Infow("supply", "name", n.String()) continue } - //filter zodiac + // filter zodiac if f.config.ZodiacFilter && !filterZodiac(f.born, n.FirstName...) { - //log.Infow("zodiac", "name", n.String()) + // log.Infow("zodiac", "name", n.String()) continue } - //filter bagua + // filter bagua if f.config.BaguaFilter && !filterYao(n.BaGua(), "凶") { - //log.Infow("bagua", "name", n.String()) + // log.Infow("bagua", "name", n.String()) continue } ben := n.BaGua().Get(yi.BenGua) @@ -227,7 +230,7 @@ func (f *fateImpl) init() { f.out = initOutputWithConfig(f.config.FileOutput) } -//SetBornData 设定生日 +// SetBornData 设定生日 func (f *fateImpl) SetBornData(t time.Time) { f.born = chronos.New(t) } @@ -250,7 +253,7 @@ func (f *fateImpl) getWugeName(name chan<- *Name) (e error) { bazi := NewBazi(f.born) for l := range lucky { if f.config.FilterMode == config.FilterModeCustom { - //TODO + // TODO } if bool(f.sex) && filterSex(l) { diff --git a/fate_test.go b/fate_test.go index 84558467..b3ddf917 100644 --- a/fate_test.go +++ b/fate_test.go @@ -11,7 +11,7 @@ import ( ) func init() { - //trait.NewZapFileSugar("fate.log") + // trait.NewZapFileSugar("fate.log") } func TestFate_RunMakeName(t *testing.T) { @@ -46,7 +46,7 @@ func TestFate_RunMakeName(t *testing.T) { } f := fate.NewFate(last, born, fate.ConfigOption(cfg), fate.SexOption(fate.SexGirl)) - //f.SetDB(eng) + // f.SetDB(eng) e := f.MakeName(context.Background()) if e != nil { t.Fatal(e) @@ -85,7 +85,7 @@ func TestFate_RunMakeNameWithLocalDatabase(t *testing.T) { } f := fate.NewFate(last, born, fate.ConfigOption(cfg), fate.SexOption(fate.SexGirl)) - //f.SetDB(eng) + // f.SetDB(eng) e := f.MakeName(context.Background()) if e != nil { t.Fatal(e) diff --git a/go.mod b/go.mod index 8b35ea8e..e590b204 100644 --- a/go.mod +++ b/go.mod @@ -1,14 +1,14 @@ module github.com/babyname/fate require ( - github.com/go-sql-driver/mysql v1.7.0 + github.com/go-sql-driver/mysql v1.7.1 github.com/godcong/chronos v0.0.3 github.com/godcong/yi v1.0.2 github.com/goextension/log v0.0.2 github.com/google/uuid v1.3.0 - github.com/mattn/go-sqlite3 v1.14.16 + github.com/mattn/go-sqlite3 v1.14.17 github.com/rakyll/statik v0.1.6 - github.com/spf13/cobra v1.6.1 + github.com/spf13/cobra v1.10.2 github.com/xormsharp/builder v0.3.8 github.com/xormsharp/xorm v1.0.4 go.uber.org/zap v1.24.0 diff --git a/go.sum b/go.sum index e0468265..c27d73dd 100644 --- a/go.sum +++ b/go.sum @@ -3,15 +3,15 @@ github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBK github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= -github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= +github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/godcong/chronos v0.0.3 h1:zIV7UuAeN9t/pYpa0oqu3xs8w7+YZTmAWi2uHliNeLg= github.com/godcong/chronos v0.0.3/go.mod h1:4OsnZGNIqlutzCmguDKhDcM4Vk9E4IU1FgIW+LJer3o= github.com/godcong/yi v1.0.2 h1:WdaiL78ftYir3f1ITbmJDQR8MR8LDb0wVR2osWoSE9I= @@ -28,16 +28,16 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= -github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= -github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM= +github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -51,10 +51,10 @@ github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs= github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -86,6 +86,7 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/god.go b/god.go index c137c14c..4feb4d34 100644 --- a/god.go +++ b/god.go @@ -2,11 +2,11 @@ package fate // LikeUseGod ... type LikeUseGod struct { - LikeGod string //喜神 - UseGod string //用神 - Gold string //五行:金 - Wood string //五行:木 - Water string //五行:水 - Fire string //五行:火 - Soil string //五行:土 + LikeGod string // 喜神 + UseGod string // 用神 + Gold string // 五行:金 + Wood string // 五行:木 + Water string // 五行:水 + Fire string // 五行:火 + Soil string // 五行:土 } diff --git a/iterator.go b/iterator.go index 6add3160..9ee5e8d7 100644 --- a/iterator.go +++ b/iterator.go @@ -16,12 +16,12 @@ func newIterator() *iterator { } } -//HasNext check next +// HasNext check next func (i *iterator) HasNext() bool { return i.index < len(i.data) } -//Next get next +// Next get next func (i *iterator) Next() interface{} { defer func() { i.index++ @@ -33,22 +33,22 @@ func (i *iterator) Next() interface{} { return nil } -//Reset reset index +// Reset reset index func (i *iterator) Reset() { i.index = 0 } -//Add add radical +// Add add radical func (i *iterator) Add(v interface{}) { i.data = append(i.data, v) } -//Size iterator data size +// Size iterator data size func (i *iterator) Size() int { return len(i.data) } -//Iterator an default iterator +// Iterator an default iterator func (i *iterator) Iterator(f IteratorFunc) error { i.Reset() for i.HasNext() { diff --git a/martial.go b/martial.go index 889608de..0446704a 100644 --- a/martial.go +++ b/martial.go @@ -1,11 +1,11 @@ package fate -//Martial six martials +// Martial six martials type Martial struct { - BiHua bool `bson:"bi_hua" json:"bi_hua"` //笔画 - SanCai bool `bson:"san_cai" json:"san_cai"` //三才 - BaZi bool `bson:"ba_zi" json:"ba_zi"` //八字 - GuaXiang bool `bson:"gua_xiang" json:"gua_xiang"` //卦象 - TianYun bool `bson:"tian_yun" json:"tian_yun"` //天运 - ShengXiao bool `bson:"sheng_xiao" json:"sheng_xiao"` //生肖 + BiHua bool `bson:"bi_hua" json:"bi_hua"` // 笔画 + SanCai bool `bson:"san_cai" json:"san_cai"` // 三才 + BaZi bool `bson:"ba_zi" json:"ba_zi"` // 八字 + GuaXiang bool `bson:"gua_xiang" json:"gua_xiang"` // 卦象 + TianYun bool `bson:"tian_yun" json:"tian_yun"` // 天运 + ShengXiao bool `bson:"sheng_xiao" json:"sheng_xiao"` // 生肖 } diff --git a/name.go b/name.go index 06b24077..2f669cfa 100644 --- a/name.go +++ b/name.go @@ -1,19 +1,20 @@ package fate import ( - "github.com/godcong/chronos" - "github.com/godcong/yi" "strconv" "strings" + + "github.com/godcong/chronos" + "github.com/godcong/yi" ) -//Name 姓名 +// Name 姓名 type Name struct { - FirstName []*Character //名姓 + FirstName []*Character // 名姓 LastName []*Character born *chronos.Calendar baZi *BaZi - baGua *yi.Yi //周易八卦 + baGua *yi.Yi // 周易八卦 zodiac *Zodiac zodiacPoint int } diff --git a/name_stroke.go b/name_stroke.go index 71cd4cfe..5687d802 100644 --- a/name_stroke.go +++ b/name_stroke.go @@ -2,7 +2,7 @@ package fate // NameStroke ... type NameStroke struct { - //ID bson.ObjectId `bson:"_id,omitempty"` + // ID bson.ObjectId `bson:"_id,omitempty"` Last1 int `bson:"last_1"` Last2 int `bson:"last_2"` First1 int `bson:"first_1"` @@ -19,7 +19,7 @@ type nameStroke struct { type SanCaiWuGe interface { } -//SanCaiWuGe 三才五格 +// SanCaiWuGe 三才五格 func (s *NameStroke) SanCaiWuGe() SanCaiWuGe { l1, l2, f1, f2 := s.Last1, s.Last2, s.First1, s.First2 wuGe := &WuGe{ diff --git a/nayin.go b/nayin.go index 3bf638cb..03259331 100644 --- a/nayin.go +++ b/nayin.go @@ -2,12 +2,12 @@ package fate import "github.com/godcong/chronos" -//NaYin 纳音 +// NaYin 纳音 type NaYin struct { calendar *chronos.Calendar } -//NewNaYin 创建纳音 +// NewNaYin 创建纳音 func NewNaYin(calendar *chronos.Calendar) *NaYin { return &NaYin{ calendar: calendar, diff --git a/sancai.go b/sancai.go index 08127e16..e9247aff 100644 --- a/sancai.go +++ b/sancai.go @@ -13,11 +13,11 @@ type SanCai struct { renCaiYinYang string `bson:"ren_cai_yin_yang"` diCai string `bson:"di_cai"` diCaiYingYang string `bson:"di_cai_ying_yang"` - fortune string `bson:"fortune"` //吉凶 - comment string `bson:"comment"` //说明 + fortune string `bson:"fortune"` // 吉凶 + comment string `bson:"comment"` // 说明 } -//NewSanCai 新建一个三才对象 +// NewSanCai 新建一个三才对象 func NewSanCai(tian, ren, di int) *SanCai { return &SanCai{ tianCai: sanCaiAttr(tian), @@ -29,7 +29,7 @@ func NewSanCai(tian, ren, di int) *SanCai { } } -//Check 检查三才属性 +// Check 检查三才属性 func Check(engine *xorm.Engine, cai *SanCai, point int) bool { wx := FindWuXing(engine, cai.tianCai, cai.renCai, cai.diCai) if wx.Luck.Point() >= point { diff --git a/stroke.go b/stroke.go index 36d3c883..d466ffd8 100644 --- a/stroke.go +++ b/stroke.go @@ -1,16 +1,16 @@ package fate -//Strokes 推荐笔画数 +// Strokes 推荐笔画数 type Strokes struct { - SimplifiedChinese int //简体中文 - TraditionalChinese int //繁体中文 - KangxiDictionary int //康熙字典 - GodBook int //神册 + SimplifiedChinese int // 简体中文 + TraditionalChinese int // 繁体中文 + KangxiDictionary int // 康熙字典 + GodBook int // 神册 } -//FindCharacterStrokes 通过文字查询推荐笔画数 +// FindCharacterStrokes 通过文字查询推荐笔画数 func FindCharacterStrokes(char string) int { - //TODO:find + // TODO:find s := &Strokes{} if s.GodBook > 0 { return s.GodBook diff --git a/version.go b/version.go index 9e8741a9..43dc5729 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ package fate // Version ... -const Version = "v3.5.3" +const Version = "v3.5.7" diff --git a/wuge.go b/wuge.go index c9b5f12c..49bf887c 100644 --- a/wuge.go +++ b/wuge.go @@ -67,8 +67,8 @@ func tianGe(l1, l2, _, _ int) int { // 人格(单姓单名)姓加名 //  人格(单姓复名)姓加名的第一字 func renGe(l1, l2, f1, _ int) int { - //人格(复姓)姓氏的第二字的笔画加名的第一字 - //人格(复姓单名)姓的第二字加名 + // 人格(复姓)姓氏的第二字的笔画加名的第一字 + // 人格(复姓单名)姓的第二字加名 if l2 != 0 { return l2 + f1 } @@ -91,19 +91,19 @@ func diGe(_, _, f1, f2 int) int { // 外格(单姓复名)一加名的最后一个字 // 外格(单姓单名)一加一 func waiGe(l1, l2, _, f2 int) (n int) { - //单姓单名 + // 单姓单名 if l2 == 0 && f2 == 0 { n = 1 + 1 } - //单姓复名 + // 单姓复名 if l2 == 0 && f2 != 0 { n = 1 + f2 } - //复姓单名 + // 复姓单名 if l2 != 0 && f2 == 0 { n = l1 + 1 } - //复姓复名 + // 复姓复名 if l2 != 0 && f2 != 0 { n = l1 + f2 } @@ -113,7 +113,7 @@ func waiGe(l1, l2, _, f2 int) (n int) { // zongGe input the ScienceStrokes with name // 总格,姓加名的笔画总数  数理五行分类 func zongGe(l1, l2, f1, f2 int) int { - //归1 + // 归1 zg := (l1 + l2 + f1 + f2) - 1 if zg < 0 { zg = zg + 81 diff --git a/wuge_test.go b/wuge_test.go index db483fa9..b94632da 100644 --- a/wuge_test.go +++ b/wuge_test.go @@ -2,9 +2,10 @@ package fate_test import ( "fmt" - "github.com/babyname/fate" "log" "testing" + + "github.com/babyname/fate" ) // TestWuGe_WaiGe ... diff --git a/wuxing.go b/wuxing.go index 4d240ff0..11953b16 100644 --- a/wuxing.go +++ b/wuxing.go @@ -2,6 +2,7 @@ package fate import ( "errors" + "github.com/xormsharp/xorm" ) @@ -25,14 +26,14 @@ func ToLuck(s string) (l Luck, e error) { return Luck(0), errors.New("parse error") } -//WuXing 五行:five elements of metal,wood,water,fire and earth +// WuXing 五行:five elements of metal,wood,water,fire and earth type WuXing struct { WuXing string `json:"wu_xing"` Luck Luck `json:"luck"` Comment string `json:"comment"` } -//FindWuXing find a wuxing +// FindWuXing find a wuxing func FindWuXing(engine *xorm.Engine, s ...string) *WuXing { var wx WuXing _, e := engine.Where("first = ?", s[0]).And("second = ?", s[1]).And("third = ?", s[2]).Get(&wx) diff --git a/xiyong.go b/xiyong.go index 769a4df5..051113a3 100644 --- a/xiyong.go +++ b/xiyong.go @@ -5,19 +5,19 @@ import ( "strings" ) -//XiYong 喜用神 +// XiYong 喜用神 type XiYong struct { WuXingFen map[string]int - Similar []string //同类 + Similar []string // 同类 SimilarPoint int - Heterogeneous []string //异类 + Heterogeneous []string // 异类 HeterogeneousPoint int } var sheng = []string{"木", "火", "土", "金", "水"} var ke = []string{"木", "土", "水", "火", "金"} -//AddFen 五行分 +// AddFen 五行分 func (xy *XiYong) AddFen(s string, point int) { if xy.WuXingFen == nil { xy.WuXingFen = make(map[string]int) @@ -30,7 +30,7 @@ func (xy *XiYong) AddFen(s string, point int) { } } -//GetFen 取得分 +// GetFen 取得分 func (xy *XiYong) GetFen(s string) (point int) { if xy.WuXingFen == nil { return 0 @@ -54,7 +54,7 @@ func (xy *XiYong) minFenWuXing(ss ...string) (wx string) { return } -//Shen 喜用神 +// Shen 喜用神 func (xy *XiYong) Shen() string { if !xy.QiangRuo() { return xy.minFenWuXing(xy.Similar...) @@ -62,7 +62,7 @@ func (xy *XiYong) Shen() string { return xy.minFenWuXing(xy.Heterogeneous...) } -//QiangRuo 八字偏强(true)弱(false) +// QiangRuo 八字偏强(true)弱(false) func (xy *XiYong) QiangRuo() bool { return xy.SimilarPoint > xy.HeterogeneousPoint } diff --git a/yao.go b/yao.go index 8dc94ca3..c9fc429d 100644 --- a/yao.go +++ b/yao.go @@ -4,8 +4,8 @@ import "github.com/godcong/yi" // GuaYao ... type GuaYao struct { - Yao string `bson:"er_yao"` //二爻 - JiXiong string `bson:"er_yao_ji_xiong"` //二爻吉凶 + Yao string `bson:"er_yao"` // 二爻 + JiXiong string `bson:"er_yao_ji_xiong"` // 二爻吉凶 } func getYao(xiang *yi.GuaXiang, yao int) GuaYao { diff --git a/zhouyi.go b/zhouyi.go index b465108e..056b9a46 100644 --- a/zhouyi.go +++ b/zhouyi.go @@ -4,7 +4,7 @@ import ( "github.com/godcong/yi" ) -//QiGua 起卦 +// QiGua 起卦 func QiGua(xia, shang int) *yi.Yi { return yi.NumberQiGua(shang, xia) } diff --git a/zodiac.go b/zodiac.go index 788149c7..f2846c94 100644 --- a/zodiac.go +++ b/zodiac.go @@ -23,12 +23,12 @@ const ( ZodiacPig = "猪" ) -//Zodiac 生肖 +// Zodiac 生肖 type Zodiac struct { Name string - Xi string //喜 + Xi string // 喜 XiRadical string - Ji string //忌 + Ji string // 忌 JiRadical string } @@ -125,7 +125,7 @@ func filterZodiac(c chronos.Calendar, chars ...*Character) bool { return GetZodiac(c).PointCheck(3, chars...) } -//PointCheck 检查point +// PointCheck 检查point func (z *Zodiac) PointCheck(limit int, chars ...*Character) bool { for _, c := range chars { if z.Point(c) < limit { @@ -135,7 +135,7 @@ func (z *Zodiac) PointCheck(limit int, chars ...*Character) bool { return true } -//Point 喜忌对冲,理论上喜忌都有的话,最好不要选给1,忌给0,喜给5,都没有给3 +// Point 喜忌对冲,理论上喜忌都有的话,最好不要选给1,忌给0,喜给5,都没有给3 func (z *Zodiac) Point(character *Character) int { dp := 3 dp += z.zodiacJi(character)