新增注释
This commit is contained in:
@@ -5,10 +5,12 @@ import (
|
||||
"level_go/internal/model"
|
||||
)
|
||||
|
||||
// CommonService 提供通用基础数据查询能力。
|
||||
type CommonService struct {
|
||||
DB *gorm.DB
|
||||
DB *gorm.DB // 数据库连接。
|
||||
}
|
||||
|
||||
// GetTradeCalendar 查询上交所全部开市日期,并返回最新开市日期。
|
||||
func (s *CommonService) GetTradeCalendar() (model.CalendarResponse, error) {
|
||||
var results []struct {
|
||||
DateStr string `gorm:"column:ds"`
|
||||
@@ -24,6 +26,7 @@ func (s *CommonService) GetTradeCalendar() (model.CalendarResponse, error) {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// 按日期升序扫描,因此循环中最后一次赋值即为最大开市日期。
|
||||
for _, r := range results {
|
||||
resp.OpenDates = append(resp.OpenDates, r.DateStr)
|
||||
resp.MaxDate = r.DateStr
|
||||
|
||||
Reference in New Issue
Block a user