优化数据库结构与数据插入逻辑

This commit is contained in:
2025-04-12 18:03:44 +08:00
parent 438a55cc3e
commit 8c268fd7a9
28 changed files with 218 additions and 213 deletions

View File

@@ -67,6 +67,7 @@ type PageResp struct {
type LocalDateTime time.Time
//goland:noinspection GoMixedReceiverTypes
func (ldt *LocalDateTime) Scan(value interface{}) (err error) {
nullTime := &sql.NullTime{}
@@ -85,27 +86,35 @@ func (ldt *LocalDateTime) Scan(value interface{}) (err error) {
return
}
//goland:noinspection GoMixedReceiverTypes
func (ldt LocalDateTime) Value() (driver.Value, error) {
return time.Time(ldt).In(time.Local), nil
return time.Time(ldt).Local(), nil
}
// GormDataType gorm common data type
//
//goland:noinspection GoMixedReceiverTy
//goland:noinspection GoMixedReceiverTypes
func (ldt LocalDateTime) GormDataType() string {
return "ldt"
}
//goland:noinspection GoMixedReceiverTypes
func (ldt LocalDateTime) GobEncode() ([]byte, error) {
return time.Time(ldt).GobEncode()
}
//goland:noinspection GoMixedReceiverTypes
func (ldt *LocalDateTime) GobDecode(b []byte) error {
return (*time.Time)(ldt).GobDecode(b)
}
//goland:noinspection GoMixedReceiverTypes
func (ldt LocalDateTime) MarshalJSON() ([]byte, error) {
return time.Time(ldt).MarshalJSON()
}
//goland:noinspection GoMixedReceiverTypes
func (ldt *LocalDateTime) UnmarshalJSON(b []byte) error {
return (*time.Time)(ldt).UnmarshalJSON(b)
}