fix:设置logo数据库为用户自己素材

This commit is contained in:
momo 2023-11-07 18:40:59 +08:00
parent d42437d63b
commit b11b78deab

View File

@ -69,7 +69,18 @@ func (l *UserLogoDataSetLogic) UserLogoDataSet(req *types.UserLogoDataSetReq, us
}
var materialInfoOld gmodel.FsUserMaterial
result1 := l.svcCtx.MysqlConn.Model(&gmodel.FsUserMaterial{}).Where("logo_id = ?", req.LogoDataId).Take(&materialInfoOld)
var FsUserMaterialModel = l.svcCtx.MysqlConn.Model(&gmodel.FsUserMaterial{})
if userinfo.IsGuest() {
// 如果是使用游客ID和游客键名格式
guestId = userinfo.GuestId
FsUserMaterialModel = FsUserMaterialModel.Where("guest_id = ?", guestId)
} else {
// 否则使用用户ID和用户键名格式
userId = userinfo.UserId
FsUserMaterialModel = FsUserMaterialModel.Where("user_id = ?", userId)
}
result1 := FsUserMaterialModel.Where("logo_id = ?", req.LogoDataId).Take(&materialInfoOld)
err = result1.Error
if err != nil {
if !errors.Is(err, gorm.ErrRecordNotFound) {