fix:修改用户素材表时间结构
This commit is contained in:
parent
6381d258c0
commit
2d62681600
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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{}
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
|
||||
|
|
|
@ -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{
|
||||
|
|
Loading…
Reference in New Issue
Block a user