From 4ab6b726a78b85fe3c025db67c51bce3a6702aef Mon Sep 17 00:00:00 2001 From: 1 <1@72wo.cn> Date: Mon, 17 Nov 2025 21:45:45 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=A9=BA=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/cool/cool.go | 2 +- common/cool/model.go | 2 +- login/main.go | 11 +++++++++-- manifest/config/config.yaml | 1 + modules/blazing/service/pet.go | 5 ++++- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/common/cool/cool.go b/common/cool/cool.go index 34af27975..8421acb17 100644 --- a/common/cool/cool.go +++ b/common/cool/cool.go @@ -33,7 +33,7 @@ func init() { ctx = gctx.GetInitCtx() redisConfig = &gredis.Config{} ) - Loger.Debug(ctx, "module cool init start ...") + Loger.Debug(ctx, "module cool init start ...", gtime.Now()) buildData := gbuild.Data() if _, ok := buildData["mode"]; ok { RunMode = buildData["mode"].(string) diff --git a/common/cool/model.go b/common/cool/model.go index cdab70790..042c399e6 100644 --- a/common/cool/model.go +++ b/common/cool/model.go @@ -18,7 +18,7 @@ type UserModel interface { type Model struct { ID uint `gorm:"primaryKey" json:"id"` CreateTime *gtime.Time ` gorm:"column:createTime;not null;index,priority:1;autoCreateTime:nano;comment:创建时间" json:"createTime"` // 创建时间 - UpdateTime *gtime.Time ` gorm:"column:updateTime;not null;index,priority:1;autoUpdateTime:nano;comment:更新时间" json:"updateTime"` // 更新时间 + UpdateTime *gtime.Time ` orm:"autoUpdateTime=true"  gorm:"column:updateTime;not null;index,priority:1;autoUpdateTime:nano;comment:更新时间" json:"updateTime"` // 更新时间 DeletedAt *gtime.Time `gorm:"index" json:"deletedAt"` } diff --git a/login/main.go b/login/main.go index a4cdde93d..14b932f6d 100644 --- a/login/main.go +++ b/login/main.go @@ -4,6 +4,7 @@ import ( _ "github.com/gogf/gf/contrib/nosql/redis/v2" _ "blazing/contrib/files/local" + "blazing/login/internal/cmd" // Minio,按需启用 // _ "blazing/contrib/files/minio" @@ -17,14 +18,20 @@ import ( _ "blazing/modules" - "blazing/login/internal/cmd" - "github.com/gogf/gf/v2/os/gctx" ) func main() { // element.TestAllScenarios() //service.TestSendVerificationCode() + + // t := model.GenPetInfo(1, 31, 1, 1, 1, 1) + // service.NewUserService(10001).Pet.PetAdd(*t) + // service.NewUserService(10001).Pet.PetInfo_One_exec(t.CatchTime, func(pe *model.PetEX) { + // fmt.Println(pe.CreateTime) + + // pe.Data.ID = 100 + // }) cmd.Main.Run(gctx.New()) } diff --git a/manifest/config/config.yaml b/manifest/config/config.yaml index 3937a3921..212156d8f 100644 --- a/manifest/config/config.yaml +++ b/manifest/config/config.yaml @@ -28,6 +28,7 @@ database: timezone: "Asia/Shanghai" createdAt: "createTime" updatedAt: "updateTime" + timeMaintainDisabled: false # (可选)是否完全关闭时间更新特性,为true时CreatedAt/UpdatedAt/DeletedAt都将失效 # deletedAt: "deleteTime" # default: # type: "mysql" diff --git a/modules/blazing/service/pet.go b/modules/blazing/service/pet.go index 55b4be7ac..d95531a50 100644 --- a/modules/blazing/service/pet.go +++ b/modules/blazing/service/pet.go @@ -36,7 +36,10 @@ func (s *PetService) PetInfo_One_exec(cachetime uint32, t func(*model.PetEX)) { } tt.Data.CatchTime = tt.CatchTime t(&tt) - m.Save(tt) + _,err := m.OnConflict("catch_time").Update(tt) + if err != nil { + panic(err) + } } func (s *PetService) PetInfo_One(cachetime uint32) model.PetEX {