diff --git a/services/profile_service.go b/services/profile_service.go index c52ac3c..08940dc 100644 --- a/services/profile_service.go +++ b/services/profile_service.go @@ -3,6 +3,7 @@ package services import ( "go-desk-service/libs" "go-desk-service/models" + "time" "gorm.io/gorm" ) @@ -26,7 +27,15 @@ func (p *ProfileService) GetInfo(params *models.Profile) models.Profile { } // 更新账号信息 -func (p *ProfileService) UpdateAccount(userId int8, params *models.Profile) bool { +func (p *ProfileService) UpdateAccount(userId int64, params *models.Profile) bool { + params.UpdatedAt = time.Now() p.db.Model(&models.Profile{}).Where("user_id = ?", userId).Updates(params) return true } + +func (p *ProfileService) Create(params *models.Profile) bool { + params.CreatedAt = time.Now() + params.UpdatedAt = time.Now() + p.db.Create(params) + return true +}