Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
b4ffd1527a
|
@ -11,6 +11,8 @@ type FsPreprocessLogo struct {
|
|||
LocationCode *string `gorm:"index;default:'';" json:"location_code"` //
|
||||
RestaurantName *string `gorm:"index;default:'';" json:"restaurant_name"` //
|
||||
ResourceUrl *string `gorm:"default:'';" json:"resource_url"` //
|
||||
ResourceVectorUrl *string `gorm:"default:'';" json:"resource_vector_url"` //
|
||||
OriginFileName *string `gorm:"default:'';" json:"origin_file_name"` //
|
||||
RestaurantType *string `gorm:"default:'';" json:"restaurant_type"` //
|
||||
Address *string `gorm:"default:'';" json:"address"` //
|
||||
ZipCode *string `gorm:"default:'';" json:"zip_code"` //
|
||||
|
@ -21,7 +23,6 @@ type FsPreprocessLogo struct {
|
|||
Source *string `gorm:"index;default:'';" json:"source"` //
|
||||
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
|
||||
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
|
||||
ResourceVectorUrl *string `gorm:"default:'';" json:"resource_vector_url"` //
|
||||
}
|
||||
type FsPreprocessLogoModel struct {
|
||||
db *gorm.DB
|
||||
|
|
22
model/gmodel/fs_user_debug_gen.go
Normal file
22
model/gmodel/fs_user_debug_gen.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// fs_user_debug 用户debug
|
||||
type FsUserDebug struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 用户 ID
|
||||
Metadata *[]byte `gorm:"default:'';" json:"metadata"` //
|
||||
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` // 时间
|
||||
GuestId *int64 `gorm:"default:0;" json:"guest_id"` //
|
||||
}
|
||||
type FsUserDebugModel struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewFsUserDebugModel(db *gorm.DB) *FsUserDebugModel {
|
||||
return &FsUserDebugModel{db: db, name: "fs_user_debug"}
|
||||
}
|
2
model/gmodel/fs_user_debug_logic.go
Normal file
2
model/gmodel/fs_user_debug_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
|||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
|
@ -108,6 +108,7 @@ type AllModelsGen struct {
|
|||
FsToolUser *FsToolUserModel // fs_tool_user 3d设计工具用户表
|
||||
FsTrade *FsTradeModel // fs_trade
|
||||
FsUser *FsUserModel // fs_user 用户表
|
||||
FsUserDebug *FsUserDebugModel // fs_user_debug 用户debug
|
||||
FsUserDesign *FsUserDesignModel // fs_user_design 废弃表
|
||||
FsUserInfo *FsUserInfoModel // fs_user_info 用户信息表
|
||||
FsUserMaterial *FsUserMaterialModel // fs_user_material 用户素材表
|
||||
|
@ -222,6 +223,7 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
|
|||
FsToolUser: NewFsToolUserModel(gdb),
|
||||
FsTrade: NewFsTradeModel(gdb),
|
||||
FsUser: NewFsUserModel(gdb),
|
||||
FsUserDebug: NewFsUserDebugModel(gdb),
|
||||
FsUserDesign: NewFsUserDesignModel(gdb),
|
||||
FsUserInfo: NewFsUserInfoModel(gdb),
|
||||
FsUserMaterial: NewFsUserMaterialModel(gdb),
|
||||
|
|
|
@ -13,12 +13,14 @@ import (
|
|||
"fusenapi/utils/s3url_to_s3id"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"context"
|
||||
|
||||
"fusenapi/server/upload/internal/svc"
|
||||
"fusenapi/server/upload/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logc"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
@ -149,6 +151,50 @@ func (l *UploadLogoDebugLogic) UploadLogoDebug(req *types.UploadLogoDebugReq, 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()
|
||||
// 新增素材记录
|
||||
materialInfo := gmodel.FsUserMaterial{
|
||||
Module: &module,
|
||||
UserId: &userId,
|
||||
GuestId: &guestId,
|
||||
ResourceId: &uploadRes.ResourceId,
|
||||
ResourceUrl: &uploadRes.ResourceUrl,
|
||||
Metadata: &resultStrB,
|
||||
Ctime: &nowTime,
|
||||
}
|
||||
err = l.svcCtx.MysqlConn.WithContext(l.ctx).Transaction(func(tx *gorm.DB) error {
|
||||
var userDebug gmodel.FsUserDebug
|
||||
res01 := tx.Model(&gmodel.FsUserDebug{}).Where("guest_id = ?", guestId).Take(&userDebug)
|
||||
if res01.Error != nil {
|
||||
if !errors.Is(res01.Error, gorm.ErrRecordNotFound) {
|
||||
logc.Errorf(l.ctx, "FsUserDebug Take err:%+v", res01.Error)
|
||||
return res01.Error
|
||||
} else {
|
||||
res02 := tx.Model(&gmodel.FsUserDebug{}).Create(&gmodel.FsUserDebug{
|
||||
GuestId: &guestId,
|
||||
Ctime: &nowTime,
|
||||
})
|
||||
if res02.Error != nil {
|
||||
logc.Errorf(l.ctx, "FsUserDebug Create err:%+v", res02.Error)
|
||||
return res02.Error
|
||||
}
|
||||
}
|
||||
}
|
||||
resCreate := tx.Create(&materialInfo)
|
||||
err = resCreate.Error
|
||||
if err != nil {
|
||||
logc.Errorf(l.ctx, "FsUserMaterial Create err:%+v", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return resp.SetStatusWithMessage(basic.CodeApiErr, "")
|
||||
}
|
||||
|
||||
//解析用户素材元数据
|
||||
var metaData map[string]interface{}
|
||||
|
|
Loading…
Reference in New Issue
Block a user