fix bug
This commit is contained in:
@@ -16,5 +16,5 @@ func main() {
|
||||
log.Println("Mock Cli!")
|
||||
config.New(ServiceKey)
|
||||
impl.NewImpl()
|
||||
mock.Run("selector", 20260209)
|
||||
mock.Report()
|
||||
}
|
||||
|
||||
@@ -72,9 +72,9 @@ func Report() {
|
||||
log.Printf("Pnl for %s is %f,rate %f", p.Code, pnl, pnlRate)
|
||||
|
||||
// 3.写入报表
|
||||
t, _ := time.Parse(utils.Int2String(item.TradeDate), "20260102")
|
||||
t, _ := time.Parse("20060102", utils.Int2String(item.TradeDate))
|
||||
var cnt int64
|
||||
impl.DBService.Model(&models.MockReport{}).Where("today_date = ?", t).Count(&cnt)
|
||||
impl.DBService.Model(&models.MockReport{}).Where("code=? and today_date = ?", p.Code, t).Count(&cnt)
|
||||
if cnt == 0 {
|
||||
impl.DBService.Model(&models.MockReport{}).Create(&models.MockReport{
|
||||
PositionId: p.ID,
|
||||
|
||||
Reference in New Issue
Block a user