Browse Source

时间格式

xyxie 1 month ago
parent
commit
9572281539
1 changed files with 6 additions and 0 deletions
  1. 6 0
      models/base_from_bloomberg.go

+ 6 - 0
models/base_from_bloomberg.go

@@ -7,6 +7,8 @@ import (
 	"strconv"
 	"strings"
 	"time"
+
+	"gorm.io/gorm"
 )
 
 // BaseFromBloombergIndex Bloomberg原始指标
@@ -168,6 +170,10 @@ type BloombergData struct {
 	InputValue float64 `orm:"column(value)" description:"值"`
 	DataTime   string  `orm:"column(data_time)" description:"日期"`
 }
+func (m *BloombergData) AfterFind(c *gorm.DB) (err error) {
+	m.DataTime = utils.GormDateStrToDateStr(m.DataTime)
+	return
+}
 
 func GetBloombergDataByCondition(condition string, pars []interface{}) (item []*BloombergData, err error) {
 	sql1 := ` SELECT * FROM base_from_bloomberg_data WHERE 1=1  `