fix bug
This commit is contained in:
@@ -1,5 +1,32 @@
|
||||
package strategy
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"git.apinb.com/quant/gostock/internal/impl"
|
||||
"git.apinb.com/quant/gostock/internal/models"
|
||||
)
|
||||
|
||||
func Boot() {
|
||||
InitCacheByAll()
|
||||
}
|
||||
|
||||
func BootAiStart(key string, ymd int) {
|
||||
var datas []models.StratModel
|
||||
err := impl.DBService.Where("strat_key=? and ymd=? and ai_score=0", key, ymd).Find(&datas).Error
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, row := range datas {
|
||||
go BootAiTask(row.ID, row.Code)
|
||||
}
|
||||
}
|
||||
|
||||
func BootAiTask(id uint, code string) {
|
||||
result, err := AiAnalysis(code)
|
||||
if err != nil {
|
||||
log.Println("ERROR BootAiTask", err.Error())
|
||||
return
|
||||
}
|
||||
impl.DBService.Model(&models.StratModel{}).Where("id=?", id).Updates(result)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user