mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
refactor(data):优化数据处理和格式化
- 修改 OpenAI 消息内容格式,增加日期信息 - 重置股票指数和基本信息的 ID 为 0,以确保正确插入数据库
This commit is contained in:
parent
5ccbbb6bb5
commit
0ff14fc01c
@ -179,7 +179,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[
|
|||||||
}
|
}
|
||||||
msg = append(msg, map[string]interface{}{
|
msg = append(msg, map[string]interface{}{
|
||||||
"role": "assistant",
|
"role": "assistant",
|
||||||
"content": stock + "当前价格:" + price,
|
"content": stock + time.Now().Format(time.DateOnly) + "价格:" + price,
|
||||||
})
|
})
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -226,6 +226,7 @@ func (receiver StockDataApi) GetIndexBasic() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
index.ID = 0
|
||||||
db.Dao.Model(&IndexBasic{}).FirstOrCreate(index, &IndexBasic{TsCode: index.TsCode}).Where("ts_code = ?", index.TsCode).Updates(index)
|
db.Dao.Model(&IndexBasic{}).FirstOrCreate(index, &IndexBasic{TsCode: index.TsCode}).Where("ts_code = ?", index.TsCode).Updates(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,6 +275,7 @@ func (receiver StockDataApi) GetStockBaseInfo() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
stock.ID = 0
|
||||||
db.Dao.Model(&StockBasic{}).FirstOrCreate(stock, &StockBasic{TsCode: stock.TsCode}).Where("ts_code = ?", stock.TsCode).Updates(stock)
|
db.Dao.Model(&StockBasic{}).FirstOrCreate(stock, &StockBasic{TsCode: stock.TsCode}).Where("ts_code = ?", stock.TsCode).Updates(stock)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user