Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop
This commit is contained in:
commit
37c2144725
|
@ -36,7 +36,8 @@ type GetAllTagByParamsReq struct {
|
||||||
OrderBy string
|
OrderBy string
|
||||||
LevelPrefixLeftLike string //右模糊
|
LevelPrefixLeftLike string //右模糊
|
||||||
WithChild bool //是否包含子层级
|
WithChild bool //是否包含子层级
|
||||||
Category int64
|
Category int64 //分类
|
||||||
|
Level int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *FsTagsModel) GetAllTagByParams(ctx context.Context, req GetAllTagByParamsReq) (resp []FsTags, err error) {
|
func (t *FsTagsModel) GetAllTagByParams(ctx context.Context, req GetAllTagByParamsReq) (resp []FsTags, err error) {
|
||||||
|
@ -50,6 +51,9 @@ func (t *FsTagsModel) GetAllTagByParams(ctx context.Context, req GetAllTagByPara
|
||||||
if req.Category != 0 {
|
if req.Category != 0 {
|
||||||
db = db.Where("`category` = ?", req.Category)
|
db = db.Where("`category` = ?", req.Category)
|
||||||
}
|
}
|
||||||
|
if req.Level > 0 {
|
||||||
|
db = db.Where("`level` = ?", req.Level)
|
||||||
|
}
|
||||||
if req.LevelPrefixLeftLike != "" {
|
if req.LevelPrefixLeftLike != "" {
|
||||||
//查询子集
|
//查询子集
|
||||||
if req.WithChild {
|
if req.WithChild {
|
||||||
|
|
|
@ -70,6 +70,9 @@ func (l *GetFittingByPidLogic) GetFittingByPid(req *types.GetFittingByPidReq, us
|
||||||
}
|
}
|
||||||
partIds := make([]int64, 0, len(modelList))
|
partIds := make([]int64, 0, len(modelList))
|
||||||
for _, v := range modelList {
|
for _, v := range modelList {
|
||||||
|
if v.PartId == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
partIds = append(partIds, *v.PartId)
|
partIds = append(partIds, *v.PartId)
|
||||||
}
|
}
|
||||||
//获取配件数据
|
//获取配件数据
|
||||||
|
|
|
@ -160,8 +160,8 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec
|
||||||
Sn: *v.Sn,
|
Sn: *v.Sn,
|
||||||
Title: *v.Title,
|
Title: *v.Title,
|
||||||
TitleCn: *v.TitleCn,
|
TitleCn: *v.TitleCn,
|
||||||
Cover: *productInfo.Cover,
|
Cover: *v.Cover,
|
||||||
CoverImg: *productInfo.CoverImg,
|
CoverImg: *v.CoverImg,
|
||||||
CoverDefault: []types.CoverDefaultItem{},
|
CoverDefault: []types.CoverDefaultItem{},
|
||||||
Intro: *v.Intro,
|
Intro: *v.Intro,
|
||||||
IsRecommend: isRecommend,
|
IsRecommend: isRecommend,
|
||||||
|
|
|
@ -51,6 +51,7 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
|
||||||
OrderBy: "`sort` DESC",
|
OrderBy: "`sort` DESC",
|
||||||
WithChild: true, //需要子集
|
WithChild: true, //需要子集
|
||||||
Category: 1, //前台网站用的
|
Category: 1, //前台网站用的
|
||||||
|
Level: 2, //等级是2的
|
||||||
}
|
}
|
||||||
//传入分类id
|
//传入分类id
|
||||||
if req.Cid > 0 {
|
if req.Cid > 0 {
|
||||||
|
@ -63,8 +64,8 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
|
||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get tag info")
|
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get tag info")
|
||||||
}
|
}
|
||||||
//前台用的分类是1
|
//前台用的分类是1,且等级是2
|
||||||
if *tagData.Category != 1 {
|
if *tagData.Category != 1 && *tagData.Level != 2 {
|
||||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "invalid tag")
|
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "invalid tag")
|
||||||
}
|
}
|
||||||
tReq.LevelPrefixLeftLike = *tagData.LevelPrefix
|
tReq.LevelPrefixLeftLike = *tagData.LevelPrefix
|
||||||
|
|
|
@ -10,9 +10,6 @@ import (
|
||||||
"fusenapi/utils/basic"
|
"fusenapi/utils/basic"
|
||||||
"fusenapi/utils/encryption_decryption"
|
"fusenapi/utils/encryption_decryption"
|
||||||
"fusenapi/utils/id_generator"
|
"fusenapi/utils/id_generator"
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/nfnt/resize"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
"image"
|
"image"
|
||||||
"image/gif"
|
"image/gif"
|
||||||
"image/jpeg"
|
"image/jpeg"
|
||||||
|
@ -22,6 +19,10 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/nfnt/resize"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"fusenapi/server/product/internal/svc"
|
"fusenapi/server/product/internal/svc"
|
||||||
|
@ -77,7 +78,7 @@ func (l *SaveDesignLogic) SaveDesign(req *types.SaveDesignReq, userinfo *auth.Us
|
||||||
}
|
}
|
||||||
infoBytes, _ := json.Marshal(postInfo.Data)
|
infoBytes, _ := json.Marshal(postInfo.Data)
|
||||||
info := string(infoBytes)
|
info := string(infoBytes)
|
||||||
now := time.Now()
|
now := time.Now().UTC()
|
||||||
logoColorBytes, _ := json.Marshal(postInfo.Data.Logo.Colors)
|
logoColorBytes, _ := json.Marshal(postInfo.Data.Logo.Colors)
|
||||||
logoColor := string(logoColorBytes)
|
logoColor := string(logoColorBytes)
|
||||||
saveData := gmodel.FsProductDesign{
|
saveData := gmodel.FsProductDesign{
|
||||||
|
|
|
@ -5,10 +5,11 @@ import (
|
||||||
"fusenapi/model/gmodel"
|
"fusenapi/model/gmodel"
|
||||||
"fusenapi/utils/auth"
|
"fusenapi/utils/auth"
|
||||||
"fusenapi/utils/basic"
|
"fusenapi/utils/basic"
|
||||||
"gorm.io/gorm"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"fusenapi/server/shopping-cart-confirmation/internal/svc"
|
"fusenapi/server/shopping-cart-confirmation/internal/svc"
|
||||||
|
@ -101,7 +102,7 @@ func (l *CartAddLogic) CartAdd(req *types.CartAddReq, userinfo *auth.UserInfo) (
|
||||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get cart info")
|
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get cart info")
|
||||||
}
|
}
|
||||||
now := time.Now().Unix()
|
now := time.Now().Unix()
|
||||||
nowTime := time.Now()
|
nowTime := time.Now().UTC()
|
||||||
data := gmodel.FsCart{
|
data := gmodel.FsCart{
|
||||||
UserId: &userinfo.UserId,
|
UserId: &userinfo.UserId,
|
||||||
ProductId: productPriceInfo.ProductId,
|
ProductId: productPriceInfo.ProductId,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"fusenapi/model/gmodel"
|
"fusenapi/model/gmodel"
|
||||||
"fusenapi/utils/auth"
|
"fusenapi/utils/auth"
|
||||||
|
@ -9,11 +8,12 @@ import (
|
||||||
"fusenapi/utils/format"
|
"fusenapi/utils/format"
|
||||||
"fusenapi/utils/id_generator"
|
"fusenapi/utils/id_generator"
|
||||||
"fusenapi/utils/step_price"
|
"fusenapi/utils/step_price"
|
||||||
"gorm.io/gorm"
|
|
||||||
"math"
|
"math"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"fusenapi/server/shopping-cart-confirmation/internal/svc"
|
"fusenapi/server/shopping-cart-confirmation/internal/svc"
|
||||||
|
@ -109,7 +109,7 @@ func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderReq, userinfo *auth
|
||||||
for _, cart := range cartList {
|
for _, cart := range cartList {
|
||||||
priceIndex, ok := mapPrice[*cart.PriceId]
|
priceIndex, ok := mapPrice[*cart.PriceId]
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New(fmt.Sprintf("price info is not exists,id = %d", *cart.PriceId))
|
return fmt.Errorf("price info is not exists,id = %d", *cart.PriceId)
|
||||||
}
|
}
|
||||||
//订单详情模板数据
|
//订单详情模板数据
|
||||||
orderDetailTemplateSn, err := id_generator.GenSnowFlakeId()
|
orderDetailTemplateSn, err := id_generator.GenSnowFlakeId()
|
||||||
|
|
|
@ -60,7 +60,7 @@ func (l *UploadFileFrontendLogic) UploadFileFrontend(req *types.RequestUploadFil
|
||||||
return resp.SetStatus(basic.CodeS3CategoryErr)
|
return resp.SetStatus(basic.CodeS3CategoryErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now().UTC()
|
||||||
category := format.TypeCategory(req.Category)
|
category := format.TypeCategory(req.Category)
|
||||||
ObjectKey := aws.String(format.FormatS3KeyName(
|
ObjectKey := aws.String(format.FormatS3KeyName(
|
||||||
keytype,
|
keytype,
|
||||||
|
|
|
@ -22,6 +22,7 @@ type UploadFileBaseReq struct {
|
||||||
GuestId int64 `form:"guest_id,optional"` // 上传文件额外信息
|
GuestId int64 `form:"guest_id,optional"` // 上传文件额外信息
|
||||||
UploadBucket int64 `form:"upload_bucket,options=[1,2],default=1"` // 上传桶名:1=缓存,2=持久
|
UploadBucket int64 `form:"upload_bucket,options=[1,2],default=1"` // 上传桶名:1=缓存,2=持久
|
||||||
Source string `form:"source"` // 上传来源
|
Source string `form:"source"` // 上传来源
|
||||||
|
Refresh bool `form:"refresh,optional"` // 强制更新
|
||||||
}
|
}
|
||||||
|
|
||||||
type UploadLogoReq struct {
|
type UploadLogoReq struct {
|
||||||
|
|
|
@ -80,6 +80,7 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a
|
||||||
//记录收到unity渲染结果时间
|
//记录收到unity渲染结果时间
|
||||||
ws.modifyRenderTaskTimeConsuming(renderImageControlChanItem{
|
ws.modifyRenderTaskTimeConsuming(renderImageControlChanItem{
|
||||||
Option: 2,
|
Option: 2,
|
||||||
|
TaskId: req.TaskId,
|
||||||
TaskProperty: renderTask{
|
TaskProperty: renderTask{
|
||||||
UnityRenderEndTime: time.Now().UTC().Unix(),
|
UnityRenderEndTime: time.Now().UTC().Unix(),
|
||||||
},
|
},
|
||||||
|
|
|
@ -182,6 +182,7 @@ func (w *wsConnectItem) assembleRenderData(taskId string, info websocket_data.Re
|
||||||
//记录刀版图合成开始时间
|
//记录刀版图合成开始时间
|
||||||
w.modifyRenderTaskTimeConsuming(renderImageControlChanItem{
|
w.modifyRenderTaskTimeConsuming(renderImageControlChanItem{
|
||||||
Option: 2,
|
Option: 2,
|
||||||
|
TaskId: taskId,
|
||||||
TaskProperty: renderTask{
|
TaskProperty: renderTask{
|
||||||
CombineBeginTime: time.Now().UTC().Unix(),
|
CombineBeginTime: time.Now().UTC().Unix(),
|
||||||
},
|
},
|
||||||
|
@ -212,6 +213,7 @@ func (w *wsConnectItem) assembleRenderData(taskId string, info websocket_data.Re
|
||||||
//记录刀版图合成结束时间
|
//记录刀版图合成结束时间
|
||||||
w.modifyRenderTaskTimeConsuming(renderImageControlChanItem{
|
w.modifyRenderTaskTimeConsuming(renderImageControlChanItem{
|
||||||
Option: 2,
|
Option: 2,
|
||||||
|
TaskId: taskId,
|
||||||
TaskProperty: renderTask{
|
TaskProperty: renderTask{
|
||||||
CombineEndTime: time.Now().UTC().Unix(),
|
CombineEndTime: time.Now().UTC().Unix(),
|
||||||
},
|
},
|
||||||
|
@ -318,6 +320,7 @@ func (w *wsConnectItem) assembleRenderData(taskId string, info websocket_data.Re
|
||||||
//记录发送到unity时间
|
//记录发送到unity时间
|
||||||
w.modifyRenderTaskTimeConsuming(renderImageControlChanItem{
|
w.modifyRenderTaskTimeConsuming(renderImageControlChanItem{
|
||||||
Option: 2,
|
Option: 2,
|
||||||
|
TaskId: taskId,
|
||||||
TaskProperty: renderTask{
|
TaskProperty: renderTask{
|
||||||
UnityRenderBeginTime: time.Now().UTC().Unix(),
|
UnityRenderBeginTime: time.Now().UTC().Unix(),
|
||||||
},
|
},
|
||||||
|
@ -414,7 +417,7 @@ func (w *wsConnectItem) operationRenderTask() {
|
||||||
if data.TaskProperty.UnityRenderEndTime != 0 {
|
if data.TaskProperty.UnityRenderEndTime != 0 {
|
||||||
taskData.UnityRenderEndTime = data.TaskProperty.UnityRenderEndTime
|
taskData.UnityRenderEndTime = data.TaskProperty.UnityRenderEndTime
|
||||||
}
|
}
|
||||||
logx.Info("**********:", taskData)
|
//logx.Info("**********:", taskData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ type (
|
||||||
GuestId int64 `form:"guest_id,optional"` // 上传文件额外信息
|
GuestId int64 `form:"guest_id,optional"` // 上传文件额外信息
|
||||||
UploadBucket int64 `form:"upload_bucket,options=[1,2],default=1"` // 上传桶名:1=缓存,2=持久
|
UploadBucket int64 `form:"upload_bucket,options=[1,2],default=1"` // 上传桶名:1=缓存,2=持久
|
||||||
Source string `form:"source"` // 上传来源
|
Source string `form:"source"` // 上传来源
|
||||||
|
Refresh bool `form:"refresh,optional"` // 强制更新
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ type Upload struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type UploadBaseReq struct {
|
type UploadBaseReq struct {
|
||||||
|
Refresh bool
|
||||||
Source string
|
Source string
|
||||||
FileHash string
|
FileHash string
|
||||||
FileData string
|
FileData string
|
||||||
|
@ -67,10 +68,14 @@ func (upload *Upload) UploadFileByBase64(req *UploadBaseReq) (*UploadBaseRes, er
|
||||||
var resourceId string = req.FileHash
|
var resourceId string = req.FileHash
|
||||||
|
|
||||||
var uploadBaseRes = UploadBaseRes{}
|
var uploadBaseRes = UploadBaseRes{}
|
||||||
err := upload.MysqlConn.Transaction(func(tx *gorm.DB) error {
|
err := upload.MysqlConn.Transaction(func(tx *gorm.DB) (err error) {
|
||||||
var resourceInfo *gmodel.FsResource
|
var resourceInfo *gmodel.FsResource
|
||||||
err := tx.Where("resource_id =?", resourceId).Take(&resourceInfo).Error
|
|
||||||
if err == nil && resourceInfo.ResourceId != "" {
|
if !req.Refresh {
|
||||||
|
err = tx.Where("resource_id =?", resourceId).Take(&resourceInfo).Error
|
||||||
|
}
|
||||||
|
|
||||||
|
if !req.Refresh && err == nil && resourceInfo.ResourceId != "" {
|
||||||
uploadBaseRes.Status = 1
|
uploadBaseRes.Status = 1
|
||||||
uploadBaseRes.ResourceId = resourceId
|
uploadBaseRes.ResourceId = resourceId
|
||||||
uploadBaseRes.ResourceUrl = *resourceInfo.ResourceUrl
|
uploadBaseRes.ResourceUrl = *resourceInfo.ResourceUrl
|
||||||
|
@ -108,7 +113,7 @@ func (upload *Upload) UploadFileByBase64(req *UploadBaseReq) (*UploadBaseRes, er
|
||||||
uploadBaseRes.ResourceId = resourceId
|
uploadBaseRes.ResourceId = resourceId
|
||||||
uploadBaseRes.ResourceUrl = url
|
uploadBaseRes.ResourceUrl = url
|
||||||
var version string = "0.0.1"
|
var version string = "0.0.1"
|
||||||
var nowTime = time.Now()
|
var nowTime = time.Now().UTC()
|
||||||
err = tx.Create(&gmodel.FsResource{
|
err = tx.Create(&gmodel.FsResource{
|
||||||
ResourceId: resourceId,
|
ResourceId: resourceId,
|
||||||
UserId: &req.UserId,
|
UserId: &req.UserId,
|
||||||
|
@ -202,7 +207,7 @@ func (upload *Upload) UploadFileByByte(req *UploadBaseReq) (*UploadBaseRes, erro
|
||||||
uploadBaseRes.ResourceId = resourceId
|
uploadBaseRes.ResourceId = resourceId
|
||||||
uploadBaseRes.ResourceUrl = url
|
uploadBaseRes.ResourceUrl = url
|
||||||
var version string = "0.0.1"
|
var version string = "0.0.1"
|
||||||
var nowTime = time.Now()
|
var nowTime = time.Now().UTC()
|
||||||
err = tx.Create(&gmodel.FsResource{
|
err = tx.Create(&gmodel.FsResource{
|
||||||
ResourceId: resourceId,
|
ResourceId: resourceId,
|
||||||
UserId: &req.UserId,
|
UserId: &req.UserId,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user