修复workday没有要更新时会报错的问题 "no element on slice when insert"

This commit is contained in:
钱纯净
2025-10-19 22:46:06 +08:00
parent 456a0af9a5
commit d7b6963bd6

View File

@@ -89,7 +89,7 @@ func (this *Workday) Update() error {
//获取沪市指数的日K线,用作历史是否节假日的判断依据
//判断日K线是否拉取过
//获取全部工作日
all := []*WorkdayModel(nil)
if err := this.db.Find(&all); err != nil {
@@ -119,6 +119,10 @@ func (this *Workday) Update() error {
}
}
if len(inserts) == 0 {
return nil
}
_, err = this.db.Insert(inserts)
return err