mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
fix(main):修复美股信息更新逻辑
- 将 return 语句替换为 continue,以修复在发现已有数据时提前退出循环的问题 - 优化了股票信息的更新逻辑,确保在数据库已存在记录时跳过当前迭代
This commit is contained in:
parent
f0e5dbe278
commit
11f0b66360
2
main.go
2
main.go
@ -200,7 +200,7 @@ func initStockDataUS() {
|
|||||||
var count int64
|
var count int64
|
||||||
db.Dao.Model(&models.StockInfoUS{}).Count(&count)
|
db.Dao.Model(&models.StockInfoUS{}).Count(&count)
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
return
|
continue
|
||||||
}
|
}
|
||||||
db.Dao.Model(&models.StockInfoUS{}).Create(&item)
|
db.Dao.Model(&models.StockInfoUS{}).Create(&item)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user