新增注释

This commit is contained in:
2026-05-09 17:50:40 +08:00
parent d5c053e59d
commit 8504838ccb
19 changed files with 404 additions and 217 deletions
+4 -1
View File
@@ -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