From 3737e889ea0bd9e812346603ba74b0c1b1033dcb Mon Sep 17 00:00:00 2001 From: wenxu12345 <44203734@qq.com> Date: Wed, 29 Dec 2021 09:36:48 +0800 Subject: [PATCH] Refactor code --- pkg/common/db/mysql_model/im_mysql_model/user_model.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/common/db/mysql_model/im_mysql_model/user_model.go b/pkg/common/db/mysql_model/im_mysql_model/user_model.go index d23c6f228..298487c38 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/user_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/user_model.go @@ -40,7 +40,9 @@ func UserRegister(user User) error { if user.AppMangerLevel == 0 { user.AppMangerLevel = constant.AppOrdinaryUsers } - utils.UnixSecondToTime(0) + if user.Birth.Unix() < 0 { + user.Birth = utils.UnixSecondToTime(0) + } err = dbConn.Table("user").Create(&user).Error if err != nil { return err