Skip to content

Commit 2c64b71

Browse files
author
greensheng
committed
-
1 parent 509f62d commit 2c64b71

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

models/mysql/bill_store.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ func (s *Store) AddBills(bills []*models.Bill) error {
4444
}
4545
var valueStrings []string
4646
for _, bill := range bills {
47-
valueString := fmt.Sprintf("('%v',%v, '%v', %v, %v, '%v', %v, '%v')",
48-
time.Now(), bill.UserId, bill.Currency, bill.Available, bill.Hold, bill.Type, bill.Settled, bill.Notes)
47+
valueString := fmt.Sprintf("(NOW(),%v, '%v', %v, %v, '%v', %v, '%v')",
48+
bill.UserId, bill.Currency, bill.Available, bill.Hold, bill.Type, bill.Settled, bill.Notes)
4949
valueStrings = append(valueStrings, valueString)
5050
}
5151
sql := fmt.Sprintf("INSERT INTO g_bill (created_at, user_id,currency,available,hold, type,settled,notes) VALUES %s", strings.Join(valueStrings, ","))

models/mysql/fill_store.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"github.com/gitbitex/gitbitex-spot/models"
2020
"github.com/jinzhu/gorm"
2121
"strings"
22-
"time"
2322
)
2423

2524
func (s *Store) GetLastFillByProductId(productId string) (*models.Fill, error) {
@@ -58,8 +57,8 @@ func (s *Store) AddFills(fills []*models.Fill) error {
5857
}
5958
var valueStrings []string
6059
for _, fill := range fills {
61-
valueString := fmt.Sprintf("('%v', '%v', %v, %v, %v, %v,%v, %v,'%v',%v,%v,'%v',%v,'%v',%v,%v)",
62-
time.Now(), fill.ProductId, fill.TradeId, fill.OrderId, fill.MessageSeq, fill.Size, fill.Price, fill.Funds,
60+
valueString := fmt.Sprintf("(NOW(), '%v', %v, %v, %v, %v,%v, %v,'%v',%v,%v,'%v',%v,'%v',%v,%v)",
61+
fill.ProductId, fill.TradeId, fill.OrderId, fill.MessageSeq, fill.Size, fill.Price, fill.Funds,
6362
fill.Liquidity, fill.Fee, fill.Settled, fill.Side, fill.Done, fill.DoneReason, fill.LogOffset, fill.LogSeq)
6463
valueStrings = append(valueStrings, valueString)
6564
}

models/mysql/tick_store.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"github.com/gitbitex/gitbitex-spot/models"
2020
"github.com/jinzhu/gorm"
2121
"strings"
22-
"time"
2322
)
2423

2524
func (s *Store) GetTicksByProductId(productId string, granularity int64, limit int) ([]*models.Tick, error) {
@@ -46,8 +45,8 @@ func (s *Store) AddTicks(ticks []*models.Tick) error {
4645
}
4746
var valueStrings []string
4847
for _, tick := range ticks {
49-
valueString := fmt.Sprintf("('%v','%v', %v, %v, %v, %v, %v, %v, %v,%v,%v)",
50-
time.Now(), tick.ProductId, tick.Granularity, tick.Time, tick.Open, tick.Low, tick.High, tick.Close,
48+
valueString := fmt.Sprintf("(NOW(),'%v', %v, %v, %v, %v, %v, %v, %v,%v,%v)",
49+
tick.ProductId, tick.Granularity, tick.Time, tick.Open, tick.Low, tick.High, tick.Close,
5150
tick.Volume, tick.LogOffset, tick.LogSeq)
5251
valueStrings = append(valueStrings, valueString)
5352
}

0 commit comments

Comments
 (0)