Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop

This commit is contained in:
eson
2023-09-28 13:25:12 +08:00
20 changed files with 480 additions and 291 deletions

View File

@@ -73,6 +73,7 @@ type PayStatus struct {
// 订单信息
type OrderInfo struct {
UserId int64 `json:"user_id"` // 物流类型
Ctime *time.Time `json:"ctime"` // 创建日期
DeliveryMethod int64 `json:"delivery_method"` // 物流类型
Metadata map[string]interface{} `json:"metadata"` // 额外参数
@@ -95,21 +96,22 @@ type OrderStatus struct {
// 订单商品
type OrderProduct struct {
TotalPrice AmountInfo `json:"total_price"` // 商品总价
ExpectedDeliveryTime *time.Time `json:"expected_delivery_time"` // 预计到货时间
PurchaseQuantity PurchaseQuantity `json:"purchase_quantity"` // 购买数量
ProductID int64 `json:"product_id"` // 商品ID
ProductName string `json:"product_name"` // 商品名称
ItemPrice AmountInfo `json:"item_price"` // 商品单价
ProductSnapshot interface{} `json:"product_snapshot"` // 商品快照
ShoppingCartSnapshot *FsShoppingCartData `json:"shopping_cart_snapshot"` // 购物车快照
ProductCover string `json:"product_cover"` // 商品封面
ProductCoverMetadata map[string]interface{} `json:"product_cover_metadata"` // 商品封面
ProductSn string `json:"product_sn"` // 商品编码
DiyInformation *UserDiyInformation `json:"diy_information"`
SizeInfo *OrderProductSizeInfo `json:"size_info"`
FittingInfo *OrderProductFittingInfo `json:"fitting_info"`
IsHighlyCustomized int64 `json:"is_highly_customized"`
TotalPrice AmountInfo `json:"total_price"` // 商品总价
ItemPrice AmountInfo `json:"item_price"` // 商品单价
ExpectedDeliveryTime *time.Time `json:"expected_delivery_time"` // 预计到货时间
PurchaseQuantity PurchaseQuantity `json:"purchase_quantity"` // 购买数量
ProductId int64 `json:"product_id"` // 商品ID
ProductSn string `json:"product_sn"` // 商品编码
ProductName string `json:"product_name"` // 商品名称
ProductCover string `json:"product_cover"` // 商品封面
ProductCoverMetadata map[string]interface{} `json:"product_cover_metadata"` // 商品封面
ProductSnapshot interface{} `json:"product_snapshot"` // 商品快照
ShoppingCartSnapshot *FsShoppingCartData `json:"shopping_cart_snapshot"` // 购物车快照
DiyInformation *UserDiyInformation `json:"diy_information"`
SizeInfo *OrderProductSizeInfo `json:"size_info"`
FittingInfo *OrderProductFittingInfo `json:"fitting_info"`
IsHighlyCustomized int64 `json:"is_highly_customized"`
}
type PurchaseQuantity struct {
Current interface{} `json:"current"`
@@ -131,3 +133,24 @@ type OrderProductFittingInfo struct {
FittingID int64 `json:"fitting_id"` //配件ID
FittingName string `json:"fitting_name"` //配件名称
}
type ExpectedDelivery struct {
Current time.Time `json:"current"`
Initiate time.Time `json:"initiate"`
}
type OrderProductInter struct {
TotalPrice AmountInfo `json:"total_price"` // 商品总价
ItemPrice AmountInfo `json:"item_price"` // 商品单价
ExpectedDelivery *ExpectedDelivery `json:"expected_delivery"` // 预计到货
PurchaseQuantity *PurchaseQuantity `json:"purchase_quantity"` // 购买数量
ProductId int64 `json:"product_id"` // 商品ID
ProductName string `json:"product_name"` // 商品名称
ProductCover string `json:"product_cover"` // 商品封面
ProductCoverMetadata map[string]interface{} `json:"product_cover_metadata"` // 商品封面
ProductSn string `json:"product_sn"` // 商品编码
DiyInformation *UserDiyInformation `json:"diy_information"`
SizeInfo *OrderProductSizeInfo `json:"size_info"`
FittingInfo *OrderProductFittingInfo `json:"fitting_info"`
IsHighlyCustomized int64 `json:"is_highly_customized"`
}

View File

@@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"fusenapi/constants"
"github.com/zeromicro/go-zero/core/logx"
"sort"
)
@@ -186,16 +185,17 @@ func (d *FsProductModel3dModel) GetProductMinPrice(ctx context.Context, productI
switch *modelInfo.Tag {
case constants.TAG_MODEL: //模型
if modelInfo.StepPrice == nil || len(*modelInfo.StepPrice) == 0 {
return errors.New(fmt.Sprintf("model step price is not set:%d", modelInfo.Id))
mapModelMinPrice[modelInfo.Id] = 0
continue
}
var stepPrice StepPriceJsonStruct
if err = json.Unmarshal(*modelInfo.StepPrice, &stepPrice); err != nil {
logx.Error(err)
return errors.New(fmt.Sprintf("failed to parse model step price:%d", modelInfo.Id))
}
lenRange := len(stepPrice.PriceRange)
if lenRange == 0 {
return errors.New(fmt.Sprintf("the count of step price is 0:%d", modelInfo.Id))
mapModelMinPrice[modelInfo.Id] = 0
continue
}
sort.SliceStable(stepPrice.PriceRange, func(i, j int) bool {
return stepPrice.PriceRange[i].Price > stepPrice.PriceRange[j].Price

View File

@@ -27,7 +27,6 @@ type FsShoppingCartData struct {
FittingId *int64 `gorm:"default:0;" json:"fitting_id"` // 配件id
PurchaseQuantity *int64 `gorm:"default:0;" json:"purchase_quantity"` // 购买数量
Snapshot *map[string]interface{} `gorm:"default:'';" json:"snapshot"` //
SnapshotData *string `gorm:"default:'';" json:"snapshot_data"` //
IsSelected *int64 `gorm:"default:0;" json:"is_selected"` // 是否被选中 0非 1是
IsHighlyCustomized *int64 `gorm:"default:0;" json:"is_highly_customized"` // 是否高度定制 0非 1是针对客人高度定制只能后台增加如购物车
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //