diff --git a/model/gmodel/fs_product_template_v2_gen.go b/model/gmodel/fs_product_template_v2_gen.go index 31c7b93f..88618f87 100644 --- a/model/gmodel/fs_product_template_v2_gen.go +++ b/model/gmodel/fs_product_template_v2_gen.go @@ -20,7 +20,7 @@ type FsProductTemplateV2 struct { IsPublic *int64 `gorm:"default:0;" json:"is_public"` // 是否可公用(1:可以,0:不可以) Status *int64 `gorm:"default:0;" json:"status"` // 状态1正常 2异常 Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 - TemplateTag *string `gorm:"default:'';" json:"template_tag"` // 标签(用户自填) + TemplateTag *string `gorm:"default:'';" json:"template_tag"` // IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除 1删除 SwitchInfo *string `gorm:"default:'';" json:"switch_info"` // 开关信息 Version *int64 `gorm:"default:0;" json:"version"` // 默认1 diff --git a/model/gmodel/fs_user_design_gen.go b/model/gmodel/fs_user_design_gen.go index 8b6abf07..42e679e2 100644 --- a/model/gmodel/fs_user_design_gen.go +++ b/model/gmodel/fs_user_design_gen.go @@ -12,7 +12,7 @@ type FsUserDesign struct { TemplateId *int64 `gorm:"index;default:0;" json:"template_id"` // 模型ID MaterialId *int64 `gorm:"index;default:0;" json:"material_id"` // 材质ID SizeId *int64 `gorm:"index;default:0;" json:"size_id"` // 尺寸ID - Info *string `gorm:"default:'';" json:"info"` // 其他设计信息 + Info *[]byte `gorm:"default:'';" json:"info"` // Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 } type FsUserDesignModel struct { diff --git a/model/gmodel/fs_user_material_gen.go b/model/gmodel/fs_user_material_gen.go index 78ebfa65..50d293c8 100644 --- a/model/gmodel/fs_user_material_gen.go +++ b/model/gmodel/fs_user_material_gen.go @@ -2,18 +2,19 @@ package gmodel import ( "gorm.io/gorm" + "time" ) // fs_user_material 用户素材表 type FsUserMaterial struct { - Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 用户 ID - Module *string `gorm:"default:'';" json:"module"` // - UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户 ID - GuestId *int64 `gorm:"index;default:0;" json:"guest_id"` // 游客 ID - ResourceId *string `gorm:"default:'';" json:"resource_id"` // - ResourceUrl *string `gorm:"default:'';" json:"resource_url"` // - Metadata *string `gorm:"default:'';" json:"metadata"` // 元数据,json格式,存储图像分率 - CreateAt *int64 `gorm:"default:0;" json:"create_at"` // 上传时间 + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 用户 ID + Module *string `gorm:"default:'';" json:"module"` // + UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户 ID + GuestId *int64 `gorm:"index;default:0;" json:"guest_id"` // 游客 ID + ResourceId *string `gorm:"default:'';" json:"resource_id"` // + ResourceUrl *string `gorm:"default:'';" json:"resource_url"` // + Metadata *[]byte `gorm:"default:'';" json:"metadata"` // + CreateAt *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"create_at"` // 上传时间 } type FsUserMaterialModel struct { db *gorm.DB diff --git a/server/product-template-tag/internal/logic/getproducttemplatetagslogic.go b/server/product-template-tag/internal/logic/getproducttemplatetagslogic.go index a23581bb..522f49b8 100644 --- a/server/product-template-tag/internal/logic/getproducttemplatetagslogic.go +++ b/server/product-template-tag/internal/logic/getproducttemplatetagslogic.go @@ -7,6 +7,7 @@ import ( "fusenapi/model/gmodel" "fusenapi/utils/auth" "fusenapi/utils/basic" + "gorm.io/gorm" "fusenapi/server/product-template-tag/internal/svc" @@ -56,7 +57,7 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu productTemplateTags, err = l.svcCtx.AllModels.FsProductTemplateTags.GetList(l.ctx, 1, req.Limit, 0, 1, "`id` DESC") } else { //元数据是空的 - if userMaterial.Metadata == nil || *userMaterial.Metadata == "" { + if userMaterial.Metadata == nil { // 返回固定模板标签列表 productTemplateTags, err = l.svcCtx.AllModels.FsProductTemplateTags.GetList(l.ctx, 1, req.Limit, 0, 1, "`id` DESC") } else { diff --git a/server/render/internal/logic/getfaceslicelogic.go b/server/render/internal/logic/getfaceslicelogic.go index 0afb49fb..3246c158 100644 --- a/server/render/internal/logic/getfaceslicelogic.go +++ b/server/render/internal/logic/getfaceslicelogic.go @@ -6,9 +6,10 @@ import ( "fusenapi/constants" "fusenapi/utils/auth" "fusenapi/utils/basic" - "gorm.io/gorm" "strings" + "gorm.io/gorm" + "context" "fusenapi/server/render/internal/svc" @@ -52,7 +53,7 @@ func (l *GetFaceSliceLogic) GetFaceSlice(req *types.Request, userinfo *auth.User } return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get user material info") } - if materialInfo.Metadata == nil || *materialInfo.Metadata == "" { + if materialInfo.Metadata == nil { return resp.SetStatusWithMessage(basic.CodeServiceErr, "user material info`Metadata is empty") } var info map[string]interface{} diff --git a/server/upload/internal/logic/uploadlogologic.go b/server/upload/internal/logic/uploadlogologic.go index 0ecb6a6d..2c30ead3 100644 --- a/server/upload/internal/logic/uploadlogologic.go +++ b/server/upload/internal/logic/uploadlogologic.go @@ -182,9 +182,10 @@ func (l *UploadLogoLogic) UploadLogo(req *types.UploadLogoReq, userinfo *auth.Us return resp.SetStatus(basic.CodeServiceErr, fmt.Sprintf("算法请求--LOGO信息--错误:%+v", err)) } resultStr = resLogoStandard.Res + resultStrB := []byte(resultStr) var module = "logo" - var nowTime = time.Now().UTC().Unix() + var nowTime = time.Now().UTC() // 新增记录 userMaterialModel := gmodel.NewFsUserMaterialModel(l.svcCtx.MysqlConn) _, err = userMaterialModel.CreateOrUpdate(l.ctx, &gmodel.FsUserMaterial{ @@ -193,7 +194,7 @@ func (l *UploadLogoLogic) UploadLogo(req *types.UploadLogoReq, userinfo *auth.Us GuestId: &guestId, ResourceId: &uploadRes.ResourceId, ResourceUrl: &uploadRes.ResourceUrl, - Metadata: &resultStr, + Metadata: &resultStrB, CreateAt: &nowTime, }) diff --git a/service/repositories/image_handle.go b/service/repositories/image_handle.go index 5af0c7dc..903ca4a7 100644 --- a/service/repositories/image_handle.go +++ b/service/repositories/image_handle.go @@ -73,14 +73,16 @@ func (l *defaultImageHandle) LogoInfo(ctx context.Context, in *LogoInfoReq) (*Lo logx.Error(err) return nil, err } - metadata = userMaterialInfoDefault.Metadata + metadataB := string(*userMaterialInfoDefault.Metadata) + metadata = &metadataB logoUrl = userMaterialInfoDefault.ResourceUrl } else { logx.Error(err) return nil, err } } else { - metadata = userMaterialInfo.Metadata + metadataB := string(*userMaterialInfo.Metadata) + metadata = &metadataB logoUrl = userMaterialInfo.ResourceUrl } return &LogoInfoRes{