Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop

This commit is contained in:
laodaming
2023-11-07 14:20:49 +08:00
5 changed files with 55 additions and 0 deletions

View File

@@ -68,6 +68,29 @@ func (l *UserLogoDataSetLogic) UserLogoDataSet(req *types.UserLogoDataSetReq, us
return resp.SetStatus(basic.CodeApiErr)
}
var materialInfoOld gmodel.FsUserMaterial
result1 := l.svcCtx.MysqlConn.Model(&gmodel.FsUserMaterial{}).Where("logo_id = ?", req.LogoDataId).Take(&materialInfoOld)
err = result1.Error
if err != nil {
if !errors.Is(err, gorm.ErrRecordNotFound) {
logc.Errorf(l.ctx, "FsUserMaterial logoData find err%+v", err)
return resp.SetStatus(basic.CodeApiErr)
}
} else {
// 返回成功的响应和上传URL
return resp.SetStatus(basic.CodeOK, map[string]interface{}{
"id": materialInfoOld.Id,
"module": materialInfoOld.Module,
"user_id": materialInfoOld.UserId,
"guest_id": materialInfoOld.GuestId,
"resource_id": materialInfoOld.ResourceId,
"resource_url": materialInfoOld.ResourceUrl,
"metadata": materialInfoOld.Metadata,
"ctime": materialInfoOld.Ctime,
"resource_info": nil,
})
}
var userMaterialMetadata []byte
if logoData.Metadata == nil {
var resultStr string
@@ -101,6 +124,7 @@ func (l *UserLogoDataSetLogic) UserLogoDataSet(req *types.UserLogoDataSetReq, us
ResourceUrl: logoData.ResourceUrl,
Metadata: &userMaterialMetadata,
Ctime: &nowTime,
LogoId: &req.LogoDataId,
}
resCreate := l.svcCtx.MysqlConn.Create(&materialInfo)
err = resCreate.Error