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