Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
adf934faa1
|
@ -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 {
|
||||||
|
|
|
@ -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