Explorar o código

粮油日期格式

xyxie hai 1 mes
pai
achega
0f8b88eb04
Modificáronse 1 ficheiros con 14 adicións e 0 borrados
  1. 14 0
      models/data_manage/base_from_ly_index.go

+ 14 - 0
models/data_manage/base_from_ly_index.go

@@ -8,6 +8,7 @@ import (
 
 	"github.com/beego/beego/v2/client/orm"
 	"github.com/rdlucklib/rdluck_tools/paging"
+	"gorm.io/gorm"
 )
 
 type BaseFromLyIndex struct {
@@ -22,6 +23,12 @@ type BaseFromLyIndex struct {
 	EdbExist             int    `orm:"column(edb_exist)" description:"指标库是否已添加:0-否;1-是"`
 }
 
+func (b *BaseFromLyIndex) AfterFind(db *gorm.DB) (err error) {
+	b.CreateTime = utils.GormDateStrToDateTimeStr(b.CreateTime)
+	b.ModifyTime = utils.GormDateStrToDateTimeStr(b.ModifyTime)
+	return
+}
+
 // 在 init 函数中注册模型
 func init() {
 	orm.RegisterModel(new(BaseFromLyIndex))
@@ -61,6 +68,13 @@ type BaseFromLyIndexAndData struct {
 	Value                float64 `orm:"column(value)" description:"数据值"`
 }
 
+func (b *BaseFromLyIndexAndData) AfterFind(db *gorm.DB) (err error) {
+	b.ModifyTime = utils.GormDateStrToDateTimeStr(b.ModifyTime)
+	b.CreateTime = utils.GormDateStrToDateTimeStr(b.CreateTime)
+	b.ModifyTimeMax = utils.GormDateStrToDateStr(b.ModifyTimeMax)
+	return
+}
+
 type IndexCheckData struct {
 	IndexCode  string `orm:"column(index_code)" description:"指标编码"`
 	IndexName  string `orm:"column(index_name)" description:"指标名称"`