|
@@ -5,6 +5,7 @@ import (
|
|
|
"eta/eta_api/global"
|
|
|
"eta/eta_api/utils"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
+ "gorm.io/gorm"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -99,6 +100,18 @@ type EdbInfoListItem struct {
|
|
|
ClassifyUniqueCode string `description:"分类唯一编码(前端定位用)"`
|
|
|
}
|
|
|
|
|
|
+// AfterFind 在该模型上设置钩子函数,把日期转成正确的string,所以查询函数只能用Find函数,First或者Scan是不会触发该函数的来获取数据
|
|
|
+func (m *EdbInfoListItem) AfterFind(db *gorm.DB) (err error) {
|
|
|
+ m.StartDate = utils.GormDateStrToDateStr(m.StartDate)
|
|
|
+ m.EndDate = utils.GormDateStrToDateStr(m.EndDate)
|
|
|
+ m.ModifyDate = utils.GormDateStrToDateStr(m.ModifyDate)
|
|
|
+ m.NextDateTime = utils.GormDateStrToDateStr(m.NextDateTime)
|
|
|
+ m.ModifyTime = utils.GormDateStrToDateTimeStr(m.ModifyTime)
|
|
|
+ m.CreateDate = utils.GormDateStrToDateTimeStr(m.CreateDate)
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// EdbListResp 指标数据结构体
|
|
|
type EdbListResp struct {
|
|
|
List []*EdbInfoListItem
|