From 02a2176f7c5733a4e4c4429c2028bbb86a967ce7 Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期二, 06 二月 2024 10:13:38 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/SRM

---
 global/model.go |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/global/model.go b/global/model.go
index 0880609..7bc5230 100644
--- a/global/model.go
+++ b/global/model.go
@@ -7,6 +7,30 @@
 )
 
 type GVA_MODEL struct {
+	ID        uint           `json:"id" gorm:"primarykey"` // 涓婚敭ID
+	CreatedAt *time.Time     `json:"-"`                    // 鍒涘缓鏃堕棿
+	UpdatedAt *time.Time     `json:"-"`                    // 鏇存柊鏃堕棿
+	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`       // 鍒犻櫎鏃堕棿
+
+	FormattedCreatedAt string `gorm:"-" json:"created_at"`
+	FormattedUpdatedAt string `gorm:"-" json:"updated_at"`
+}
+
+func (m *GVA_MODEL) AfterFind(tx *gorm.DB) (err error) {
+	if m.CreatedAt != nil {
+		m.FormattedCreatedAt = m.CreatedAt.Format("2006-01-02 15:04:05")
+	} else {
+		m.FormattedCreatedAt = "--"
+	}
+	if m.UpdatedAt != nil {
+		m.FormattedUpdatedAt = m.UpdatedAt.Format("2006-01-02 15:04:05")
+		m.FormattedUpdatedAt = "--"
+	}
+
+	return
+}
+
+type GVA_MODEL_INT struct {
 	ID        uint           `json:"id,string" gorm:"primarykey"` // 涓婚敭ID
 	CreatedAt *time.Time     `json:"-"`                           // 鍒涘缓鏃堕棿
 	UpdatedAt *time.Time     `json:"-"`                           // 鏇存柊鏃堕棿
@@ -14,10 +38,4 @@
 
 	FormattedCreatedAt string `gorm:"-" json:"created_at"`
 	FormattedUpdatedAt string `gorm:"-" json:"updated_at"`
-}
-
-func (m *GVA_MODEL) AfterFind(tx *gorm.DB) (err error) {
-	m.FormattedCreatedAt = m.CreatedAt.Format("2006-01-02 15:04:05")
-	m.FormattedUpdatedAt = m.UpdatedAt.Format("2006-01-02 15:04:05")
-	return
 }

--
Gitblit v1.8.0