|
@@ -21,34 +21,6 @@ type EdbDataBase struct {
|
|
|
DataTimestamp int64 `bson:"data_timestamp"`
|
|
|
}
|
|
|
|
|
|
-func GetEdbDataBaseByEdbInfoId(edbInfoId int) (items []*EdbDataBase, err error) {
|
|
|
- findOptions := options.Find()
|
|
|
- db := NewMgo(utils.MgoDataDbName, "edb_data_base", utils.MgoDataCli)
|
|
|
- filter := bson.D{{"edb_info_id", edbInfoId}}
|
|
|
- ctx := context.TODO()
|
|
|
- cur, err := db.Find(filter, findOptions)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- // Close the cursor once finished
|
|
|
- defer cur.Close(ctx)
|
|
|
- for cur.Next(ctx) {
|
|
|
- // create a value into which the single document can be decoded
|
|
|
- var elem EdbDataBase
|
|
|
- err = cur.Decode(&elem)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- items = append(items, &elem)
|
|
|
- }
|
|
|
-
|
|
|
- if err = cur.Err(); err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
// GetEdbDataList 获取指标的数据(日期正序返回)
|
|
|
func GetEdbDataList(endInfoId int, startDate, endDate time.Time) (list []*EdbDataBase, err error) {
|
|
|
findOptions := options.Find()
|
|
@@ -75,7 +47,9 @@ func GetEdbDataList(endInfoId int, startDate, endDate time.Time) (list []*EdbDat
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ elem.DataTime = elem.DataTime.In(time.Local)
|
|
|
+ elem.CreateTime = elem.CreateTime.In(time.Local)
|
|
|
+ elem.ModifyTime = elem.ModifyTime.In(time.Local)
|
|
|
list = append(list, &elem)
|
|
|
}
|
|
|
|