fix: 修复空提交问题

This commit is contained in:
1
2025-11-17 21:45:45 +00:00
parent c6d3b4788d
commit 4ab6b726a7
5 changed files with 16 additions and 5 deletions

View File

@@ -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)

View File

@@ -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"`
}

View File

@@ -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())
}

View File

@@ -28,6 +28,7 @@ database:
timezone: "Asia/Shanghai"
createdAt: "createTime"
updatedAt: "updateTime"
timeMaintainDisabled: false # (可选)是否完全关闭时间更新特性为true时CreatedAt/UpdatedAt/DeletedAt都将失效
# deletedAt: "deleteTime"
# default:
# type: "mysql"

View File

@@ -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 {