From b6f3c2160c7633b3492575c1de39735a04c9e63e Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期四, 24 八月 2023 10:40:47 +0800 Subject: [PATCH] 回访单列表返回增加修改时间创建时间 --- model/serviceFollowup.go | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/model/serviceFollowup.go b/model/serviceFollowup.go index a5fb79d..d66f9e7 100644 --- a/model/serviceFollowup.go +++ b/model/serviceFollowup.go @@ -33,8 +33,9 @@ OldMember User `json:"oldMember" gorm:"foreignKey:OldMemberId"` Remark string `json:"remark" gorm:"column:remark;type:text;comment:澶囨敞"` File string `json:"file" gorm:"column:file;type:varchar(255);comment:闄勪欢"` - - gorm.Model `json:"-"` + CreateTime string `json:"createTime"` //鍒涘缓鏃堕棿 + UpdateTime string `json:"updateTime"` //淇敼鏃堕棿 + gorm.Model `json:"-"` } ServiceFollowupSearch struct { @@ -49,10 +50,16 @@ } ) -func (ServiceFollowup) TableName() string { +func (*ServiceFollowup) TableName() string { return "service_followup" } +func (slf *ServiceFollowup) AfterFind(db *gorm.DB) error { + slf.CreateTime = slf.CreatedAt.Format("2006-01-02 15:04") + slf.UpdateTime = slf.UpdatedAt.Format("2006-01-02 15:04") + return nil +} + func NewServiceFollowupSearch() *ServiceFollowupSearch { return &ServiceFollowupSearch{ Orm: mysqlx.GetDB(), -- Gitblit v1.8.0