Skip to content

Commit

Permalink
self 改成 m 用来解决golint 的报警告问题
Browse files Browse the repository at this point in the history
  • Loading branch information
warrially committed Jul 28, 2021
1 parent 6f653ca commit 5e08ba1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
33 changes: 15 additions & 18 deletions jieqi.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,41 +59,38 @@ func GetJieQiFromNumber(nValue int) string {
}

// IsJie 节气是否是节, 节气分成节和气,
func (self *TJieQi) IsJie() bool {
n := self.Value()
if n%2 == 0 {
return true
}
return false
func (m *TJieQi) IsJie() bool {
n := m.Value()
return n%2 == 0
}

// ToString 转换成可阅读的字符串
func (self *TJieQi) ToString() string {
return self.String()
func (m *TJieQi) ToString() string {
return m.String()
}

// ToInt 转换成int
func (self *TJieQi) ToInt() int {
return self.Value()
func (m *TJieQi) ToInt() int {
return m.Value()
}

// Month 节气月份
func (self *TJieQi) Month() int {
return self.ToMonth()
func (m *TJieQi) Month() int {
return m.ToMonth()
}

// ToMonth 转成节气月
func (self *TJieQi) ToMonth() int {
func (m *TJieQi) ToMonth() int {
// 节气0 是立春 是1月
return self.Value()/2 + 1
return m.Value()/2 + 1
}

// Value 转换成int
func (self *TJieQi) Value() int {
return (int)(*self)
func (m *TJieQi) Value() int {
return (int)(*m)
}

// String 转换成可阅读的字符串
func (self *TJieQi) String() string {
return GetJieQiFromNumber(self.Value())
func (m *TJieQi) String() string {
return GetJieQiFromNumber(m.Value())
}
8 changes: 4 additions & 4 deletions jieqidate.go
Original file line number Diff line number Diff line change
Expand Up @@ -54497,8 +54497,8 @@ var jieqilist = []*TJieQiDate{
}

// ToSolarDate 节气日期 转成 普通日期用
func (self *TJieQiDate) ToSolarDate() *TSolarDate {
return NewSolarDate(self.Year, self.Month, self.Day, self.Hour, self.Minute, self.Second)
func (m *TJieQiDate) ToSolarDate() *TSolarDate {
return NewSolarDate(m.Year, m.Month, m.Day, m.Hour, m.Minute, m.Second)
}

// GetJieQiDate 获取某个日期的节气, 和前后两个节气的日期
Expand All @@ -54525,7 +54525,7 @@ func GetJieQiDate(pSolarDate *TSolarDate) (*TJieQiDate, *TJieQiDate) {
}

// String
func (self *TJieQiDate) String() string {
func (m *TJieQiDate) String() string {
return fmt.Sprintf("节气:%d年%02d月%02d日 %02d:%02d:%02d (%v)",
self.Year, self.Month, self.Day, self.Hour, self.Minute, self.Second, self.JieQi.String())
m.Year, m.Month, m.Day, m.Hour, m.Minute, m.Second, m.JieQi.String())
}

0 comments on commit 5e08ba1

Please sign in to comment.