fix调整
This commit is contained in:
@@ -807,7 +807,7 @@ func (d *defaultOrder) CreatePrePaymentByDeposit(ctx context.Context, in *Create
|
||||
func (d *defaultOrder) List(ctx context.Context, in *ListReq) (res *ListRes, err error) {
|
||||
var orderList []gmodel.FsOrder
|
||||
model := d.MysqlConn.Model(&gmodel.FsOrder{}).Where("is_del = ?", 0)
|
||||
model.Where("pay_status > ?", 0)
|
||||
// model.Where("pay_status > ?", 0)
|
||||
if in.UserId != 0 {
|
||||
model.Where("user_id = ?", in.UserId)
|
||||
}
|
||||
@@ -1054,10 +1054,6 @@ func (d *defaultOrder) Create(ctx context.Context, in *CreateReq) (res *CreateRe
|
||||
CurrentCurrency: in.CurrentCurrency,
|
||||
OriginalCurrency: in.OriginalCurrency,
|
||||
}),
|
||||
ExpectedDelivery: &gmodel.ExpectedDelivery{
|
||||
Current: in.ExpectedDeliveryTime,
|
||||
Initiate: in.ExpectedDeliveryTime,
|
||||
},
|
||||
PurchaseQuantity: &gmodel.PurchaseQuantity{
|
||||
Current: *shoppingCart.PurchaseQuantity,
|
||||
Initiate: *shoppingCart.PurchaseQuantity,
|
||||
@@ -1082,6 +1078,8 @@ func (d *defaultOrder) Create(ctx context.Context, in *CreateReq) (res *CreateRe
|
||||
},
|
||||
},
|
||||
IsHighlyCustomized: *shoppingCart.IsHighlyCustomized,
|
||||
RenderImage: shoppingCartSnapshot.RenderImage,
|
||||
CartId: shoppingCart.Id,
|
||||
}
|
||||
orderProductList = append(orderProductList, &productInter)
|
||||
shoppingProductSnapshotList = append(shoppingProductSnapshotList, shoppingCart.ShoppingCartProduct)
|
||||
@@ -1160,6 +1158,12 @@ func (d *defaultOrder) Create(ctx context.Context, in *CreateReq) (res *CreateRe
|
||||
byteShoppingCartSnapshot, _ := json.Marshal(shoppingCartSnapshotList)
|
||||
byteShoppingProductSnapshot, _ := json.Marshal(shoppingProductSnapshotList)
|
||||
byteStatusLink, _ := json.Marshal(statusLink)
|
||||
byteOrderMetadata, _ := json.Marshal(gmodel.OrderMetadata{
|
||||
ExpectedDeliveryTime: gmodel.ExpectedDelivery{
|
||||
Current: in.ExpectedDeliveryTime,
|
||||
Initiate: in.ExpectedDeliveryTime,
|
||||
},
|
||||
})
|
||||
|
||||
// 创建订单
|
||||
resultCreate := tx.Create(&gmodel.FsOrder{
|
||||
@@ -1175,6 +1179,7 @@ func (d *defaultOrder) Create(ctx context.Context, in *CreateReq) (res *CreateRe
|
||||
Status: (*int64)(&status),
|
||||
PayStatus: (*int64)(&payStatus),
|
||||
Ctime: &nowTime,
|
||||
Metadata: &byteOrderMetadata,
|
||||
})
|
||||
|
||||
if resultCreate.Error != nil {
|
||||
@@ -1341,12 +1346,19 @@ func (d *defaultOrder) OrderDetailHandler(ctx context.Context, orderInfo *gmodel
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
var status = order.GetOrderStatusCurrent(statusLink, constants.OrderStatusCode(*orderInfo.Status))
|
||||
var orderDetail gmodel.OrderDetail
|
||||
var orderMetadata map[string]interface{}
|
||||
|
||||
var orderMetadata gmodel.OrderMetadata
|
||||
if orderInfo.Metadata != nil {
|
||||
json.Unmarshal(*orderInfo.Metadata, &orderMetadata)
|
||||
}
|
||||
// 预计到货时间
|
||||
var expectedTime = orderMetadata.ExpectedDeliveryTime.Current
|
||||
|
||||
var status = order.GetOrderStatusCurrent(statusLink, constants.OrderStatusCode(*orderInfo.Status))
|
||||
status.ExpectedTime = &expectedTime
|
||||
|
||||
var orderDetail gmodel.OrderDetail
|
||||
|
||||
if original == 1 {
|
||||
orderDetail.DeliveryAddress = orderAddress
|
||||
orderDetail.OrderAmount = orderAmount
|
||||
@@ -1371,32 +1383,35 @@ func (d *defaultOrder) OrderDetailHandler(ctx context.Context, orderInfo *gmodel
|
||||
for _, productValue := range orderProduct {
|
||||
var shoppingCartSnapshotData gmodel.FsShoppingCartData
|
||||
for _, shoppingCartSnapshotValue := range shoppingCartSnapshot {
|
||||
snapshot, err := d.OrderShoppingCartSnapshotHandler(ctx, shoppingCartSnapshotValue.Snapshot)
|
||||
if err != nil {
|
||||
logc.Errorf(ctx, "OrderDetailHandler OrderShoppingCartSnapshotHandler failed, err: %v", err)
|
||||
return nil, err
|
||||
if productValue.CartId == shoppingCartSnapshotValue.Id {
|
||||
|
||||
snapshot, err := d.OrderShoppingCartSnapshotHandler(ctx, shoppingCartSnapshotValue.Snapshot)
|
||||
if err != nil {
|
||||
logc.Errorf(ctx, "OrderDetailHandler OrderShoppingCartSnapshotHandler failed, err: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
shoppingCartSnapshotData.Id = shoppingCartSnapshotValue.Id
|
||||
shoppingCartSnapshotData.UserId = shoppingCartSnapshotValue.UserId
|
||||
shoppingCartSnapshotData.ProductId = shoppingCartSnapshotValue.ProductId
|
||||
shoppingCartSnapshotData.TemplateId = shoppingCartSnapshotValue.TemplateId
|
||||
shoppingCartSnapshotData.ModelId = shoppingCartSnapshotValue.ModelId
|
||||
shoppingCartSnapshotData.SizeId = shoppingCartSnapshotValue.SizeId
|
||||
shoppingCartSnapshotData.LightId = shoppingCartSnapshotValue.LightId
|
||||
shoppingCartSnapshotData.FittingId = shoppingCartSnapshotValue.FittingId
|
||||
shoppingCartSnapshotData.PurchaseQuantity = shoppingCartSnapshotValue.PurchaseQuantity
|
||||
shoppingCartSnapshotData.IsSelected = shoppingCartSnapshotValue.IsSelected
|
||||
shoppingCartSnapshotData.IsSelected = shoppingCartSnapshotValue.IsSelected
|
||||
shoppingCartSnapshotData.IsHighlyCustomized = shoppingCartSnapshotValue.IsHighlyCustomized
|
||||
shoppingCartSnapshotData.Ctime = shoppingCartSnapshotValue.Ctime
|
||||
shoppingCartSnapshotData.Utime = shoppingCartSnapshotValue.Utime
|
||||
shoppingCartSnapshotData.Snapshot = &snapshot
|
||||
}
|
||||
shoppingCartSnapshotData.Id = shoppingCartSnapshotValue.Id
|
||||
shoppingCartSnapshotData.UserId = shoppingCartSnapshotValue.UserId
|
||||
shoppingCartSnapshotData.ProductId = shoppingCartSnapshotValue.ProductId
|
||||
shoppingCartSnapshotData.TemplateId = shoppingCartSnapshotValue.TemplateId
|
||||
shoppingCartSnapshotData.ModelId = shoppingCartSnapshotValue.ModelId
|
||||
shoppingCartSnapshotData.SizeId = shoppingCartSnapshotValue.SizeId
|
||||
shoppingCartSnapshotData.LightId = shoppingCartSnapshotValue.LightId
|
||||
shoppingCartSnapshotData.FittingId = shoppingCartSnapshotValue.FittingId
|
||||
shoppingCartSnapshotData.PurchaseQuantity = shoppingCartSnapshotValue.PurchaseQuantity
|
||||
shoppingCartSnapshotData.IsSelected = shoppingCartSnapshotValue.IsSelected
|
||||
shoppingCartSnapshotData.IsSelected = shoppingCartSnapshotValue.IsSelected
|
||||
shoppingCartSnapshotData.IsHighlyCustomized = shoppingCartSnapshotValue.IsHighlyCustomized
|
||||
shoppingCartSnapshotData.Ctime = shoppingCartSnapshotValue.Ctime
|
||||
shoppingCartSnapshotData.Utime = shoppingCartSnapshotValue.Utime
|
||||
shoppingCartSnapshotData.Snapshot = &snapshot
|
||||
}
|
||||
|
||||
orderProductItem := gmodel.OrderProduct{
|
||||
TotalPrice: order.GetAmountInfoFormat(&productValue.TotalPrice),
|
||||
ItemPrice: order.GetAmountInfoFormat(&productValue.ItemPrice),
|
||||
ExpectedDeliveryTime: &productValue.ExpectedDelivery.Current,
|
||||
ExpectedDeliveryTime: &expectedTime,
|
||||
PurchaseQuantity: *productValue.PurchaseQuantity,
|
||||
ProductId: productValue.ProductId,
|
||||
ProductSn: productValue.ProductSn,
|
||||
@@ -1409,6 +1424,7 @@ func (d *defaultOrder) OrderDetailHandler(ctx context.Context, orderInfo *gmodel
|
||||
SizeInfo: productValue.SizeInfo,
|
||||
FittingInfo: productValue.FittingInfo,
|
||||
IsHighlyCustomized: productValue.IsHighlyCustomized,
|
||||
RenderImage: productValue.RenderImage,
|
||||
}
|
||||
|
||||
orderProductList = append(orderProductList, orderProductItem)
|
||||
|
||||
Reference in New Issue
Block a user