|
@@ -10,6 +10,7 @@ import (
|
|
|
"time"
|
|
|
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
|
+ "gorm.io/gorm"
|
|
|
|
|
|
"github.com/nosixtools/solarlunar"
|
|
|
)
|
|
@@ -276,6 +277,15 @@ type EdbDataList struct {
|
|
|
Value float64 `gorm:"column:value" description:"数据值"`
|
|
|
}
|
|
|
|
|
|
+func (e *EdbDataList) AfterFind(db *gorm.DB) (err error) {
|
|
|
+ tmp, err := time.Parse(utils.FormatDateWallWithLoc, e.DataTime)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ e.DataTime = tmp.Format(utils.FormatDate)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// GetEdbDataList 获取指标的数据(日期正序返回)
|
|
|
func GetEdbDataList(source, subSource, edbInfoId int, startDate, endDate string) (list []*EdbDataList, err error) {
|
|
|
// 自有数据需要额外处理(从mongo获取)
|
|
@@ -325,7 +335,7 @@ func getEdbDataListByMysql(source, subSource, edbInfoId int, startDate, endDate
|
|
|
sql = fmt.Sprintf(sql, tableName)
|
|
|
o := global.DmSQL["data"]
|
|
|
pars = append([]interface{}{edbInfoId}, pars...)
|
|
|
- err = o.Raw(sql, pars...).Scan(&list).Error
|
|
|
+ err = o.Raw(sql, pars...).Find(&list).Error
|
|
|
return
|
|
|
}
|
|
|
|