Browse Source

修改钢联数据刷新

longyu 3 years ago
parent
commit
899e389849
2 changed files with 6 additions and 4 deletions
  1. 4 4
      models/base_from_mysteel.go
  2. 2 0
      models/db.go

+ 4 - 4
models/base_from_mysteel.go

@@ -13,8 +13,8 @@ import (
 //钢联
 
 type GlData struct {
-	InputValue string `orm:"column(DATA_VALUE)" description:"日期"`
-	DataTime   string `orm:"column(DATA_DATE)" description:"值"`
+	InputValue float64 `orm:"column(DATA_VALUE)" description:"日期"`
+	DataTime   string  `orm:"column(DATA_DATE)" description:"值"`
 }
 
 func GetGlDataByCondition(condition string, pars []interface{}) (item []*GlData, err error) {
@@ -55,7 +55,7 @@ func AddEdbDataFromMysteel(edbCode string) (err error) {
 		for i := 0; i < dataLen; i++ {
 			item := glDataList[i]
 			eDate := item.DataTime
-			sValue := item.InputValue
+			sValue := utils.SubFloatToString(item.InputValue, 30)
 			if sValue != "" {
 				if _, ok := existMap[eDate]; !ok {
 					dataTime, err := time.Parse(utils.FormatDate, eDate)
@@ -131,7 +131,7 @@ func RefreshEdbDataFromMysteel(edbInfoId int, edbCode, startDate string) (err er
 	for _, v := range glDataList {
 		item := v
 		eDate := item.DataTime
-		sValue := item.InputValue
+		sValue :=utils.SubFloatToString(item.InputValue, 30)
 
 		if findItem, ok := existMap[v.DataTime]; !ok {
 			if sValue != "" {

+ 2 - 0
models/db.go

@@ -29,6 +29,8 @@ func init() {
 	gl, _ := orm.GetDB("gl")
 	gl.SetConnMaxLifetime(10 * time.Minute)
 
+	orm.Debug=true
+
 	//注册对象
 	orm.RegisterModel(