修改用户服务
This commit is contained in:
@@ -3,6 +3,7 @@ package services
|
|||||||
import (
|
import (
|
||||||
"go-desk-service/libs"
|
"go-desk-service/libs"
|
||||||
"go-desk-service/models"
|
"go-desk-service/models"
|
||||||
|
"time"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"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)
|
p.db.Model(&models.Profile{}).Where("user_id = ?", userId).Updates(params)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *ProfileService) Create(params *models.Profile) bool {
|
||||||
|
params.CreatedAt = time.Now()
|
||||||
|
params.UpdatedAt = time.Now()
|
||||||
|
p.db.Create(params)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user