hsun 1 year ago
parent
commit
60243127f1
2 changed files with 17 additions and 17 deletions
  1. 6 6
      models/jiayue/dict.go
  2. 11 11
      services/index_data/jiayue_platform.go

+ 6 - 6
models/jiayue/dict.go

@@ -92,8 +92,8 @@ type DictIndex struct {
 	SjbId             int       `description:"SJB_ID"`
 	UserId            int       `description:"所属用户"`
 	RowsCount         int       `description:"指标数据数量"`
-	DateFirst         string    `description:"指标开始时间"`
-	DateLast          string    `description:"指标最新时间"`
+	DateFirst         time.Time `description:"指标开始时间"`
+	DateLast          time.Time `description:"指标最新时间"`
 	TimeLastUpdate    time.Time `description:"最新更新时间"`
 	TimeLastRequest   time.Time `description:"下次更新时间"`
 	Priority          int       `description:"更新优先级"`
@@ -127,8 +127,8 @@ type DictIndexSql struct {
 	SjbId             sql.NullInt32  `json:"SJB_ID"`
 	UserId            sql.NullInt32  `description:"所属用户" json:"USER_ID"`
 	RowsCount         sql.NullInt32  `description:"指标数据数量" json:"ROWS_COUNT"`
-	DateFirst         sql.NullString `description:"指标开始时间" json:"DATE_FIRST"`
-	DateLast          sql.NullString `description:"指标最新时间" json:"DATE_LAST"`
+	DateFirst         sql.NullTime   `description:"指标开始时间" json:"DATE_FIRST"`
+	DateLast          sql.NullTime   `description:"指标最新时间" json:"DATE_LAST"`
 	TimeLastUpdate    sql.NullTime   `description:"最新更新时间" json:"TIME_LAST_UPDATE"`
 	TimeLastRequest   sql.NullTime   `description:"下次更新时间" json:"TIME_LAST_REQUEST"`
 	Priority          sql.NullInt32  `description:"更新优先级" json:"PRIORITY"`
@@ -213,8 +213,8 @@ func getDictIndex(sqlStatement string, pars []interface{}) (dictIndexs []DictInd
 			SjbId:             int(tmp.SjbId.Int32),
 			UserId:            int(tmp.UserId.Int32),
 			RowsCount:         int(tmp.RowsCount.Int32),
-			DateFirst:         tmp.DateFirst.String,
-			DateLast:          tmp.DateLast.String,
+			DateFirst:         tmp.DateFirst.Time,
+			DateLast:          tmp.DateLast.Time,
 			TimeLastUpdate:    tmp.TimeLastUpdate.Time,
 			TimeLastRequest:   tmp.TimeLastRequest.Time,
 			Priority:          int(tmp.Priority.Int32),

+ 11 - 11
services/index_data/jiayue_platform.go

@@ -116,16 +116,16 @@ func GetIndexFromJiaYue(indexCode, source, startDate, endDate string) (data *res
 		}
 		list = append(list, tmp)
 	}
-	var dateLastStr string
-	if index.DateLast != "" {
-		dateLast, e := time.ParseInLocation(utils.FormatDateDefault, index.DateLast, time.Local)
-		if e != nil {
-			err = e
-			fmt.Println("解析时间失败:", err)
-			return
-		}
-		dateLastStr = dateLast.Format(utils.FormatDate)
-	}
+	//var dateLastStr string
+	//if index.DateLast != "" {
+	//	dateLast, e := time.ParseInLocation(utils.FormatDateDefault, index.DateLast, time.Local)
+	//	if e != nil {
+	//		err = e
+	//		fmt.Println("解析时间失败:", err)
+	//		return
+	//	}
+	//	dateLastStr = dateLast.Format(utils.FormatDate)
+	//}
 	//if !index.TimeLastUpdate.IsZero() {
 	//	timeLastUpdate, e := time.ParseInLocation(utils.FormatDateDefault, index.TimeLastUpdate, time.Local)
 	//	if e != nil {
@@ -139,7 +139,7 @@ func GetIndexFromJiaYue(indexCode, source, startDate, endDate string) (data *res
 	data = new(response.IndexResp)
 	data.IndexData = list
 	data.IndexCode = indexCode
-	data.LastDate = dateLastStr
+	data.LastDate = utils.TimeTransferString(utils.FormatDate, index.DateLast)
 	data.LastUpdateTime = utils.TimeTransferString(utils.FormatDateTime, index.TimeLastUpdate)
 	data.Status = index.Status
 	return