fix
This commit is contained in:
parent
f2226ff0e4
commit
73a67aa21a
@ -113,6 +113,7 @@ type OrderProduct struct {
|
|||||||
FittingInfo *OrderProductFittingInfo `json:"fitting_info"`
|
FittingInfo *OrderProductFittingInfo `json:"fitting_info"`
|
||||||
IsHighlyCustomized int64 `json:"is_highly_customized"`
|
IsHighlyCustomized int64 `json:"is_highly_customized"`
|
||||||
RenderImage string `json:"render_image"`
|
RenderImage string `json:"render_image"`
|
||||||
|
SelectColorIndex int64 `json:"select_color_index"`
|
||||||
}
|
}
|
||||||
type PurchaseQuantity struct {
|
type PurchaseQuantity struct {
|
||||||
Current interface{} `json:"current"`
|
Current interface{} `json:"current"`
|
||||||
|
@ -209,28 +209,35 @@ func (d *defaultOrder) CloseList(ctx context.Context, in *CloseListReq) (res *Cl
|
|||||||
}
|
}
|
||||||
for _, orderInfo := range orderList {
|
for _, orderInfo := range orderList {
|
||||||
var ntime = time.Now().UTC()
|
var ntime = time.Now().UTC()
|
||||||
var cptime = orderInfo.Ctime.UTC().Add(time.Minute * 30)
|
var cptime = orderInfo.Ctime.Add(time.Minute * 30)
|
||||||
var dtime time.Duration
|
|
||||||
var dd = ntime.Unix() - cptime.Unix()
|
var dd = ntime.Unix() - cptime.Unix()
|
||||||
if dd > 0 {
|
|
||||||
dtime = time.Second * 0
|
|
||||||
} else {
|
|
||||||
dtime = time.Second * time.Duration(math.Abs(float64(dd)))
|
|
||||||
}
|
|
||||||
if in.Type == 1 {
|
if in.Type == 1 {
|
||||||
// 延时任务
|
fmt.Println("未支付超时时间: dd--", dd)
|
||||||
time.AfterFunc(dtime, func() {
|
if dd >= 0 {
|
||||||
orderSn := orderInfo.OrderSn
|
orderSn := *orderInfo.OrderSn
|
||||||
fmt.Println("延时任务: OrderSn--", orderSn)
|
fmt.Println("即时任务: OrderSn--", orderSn)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
logc.Infof(ctx, "order CloseList, orderSn: %s", orderSn)
|
logc.Infof(ctx, "order CloseList, orderSn: %s", orderSn)
|
||||||
d.Close(ctx, &CloseReq{
|
d.Close(ctx, &CloseReq{
|
||||||
OrderSn: *orderSn,
|
OrderSn: orderSn,
|
||||||
Type: 1,
|
Type: 1,
|
||||||
})
|
})
|
||||||
})
|
} else {
|
||||||
|
ddd := math.Abs(float64(dd))
|
||||||
|
// 延时任务
|
||||||
|
time.AfterFunc(time.Second*time.Duration(ddd), func() {
|
||||||
|
orderSn := *orderInfo.OrderSn
|
||||||
|
fmt.Println("延时任务: OrderSn--", orderSn)
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
logc.Infof(ctx, "order CloseList, orderSn: %s", orderSn)
|
||||||
|
d.Close(ctx, &CloseReq{
|
||||||
|
OrderSn: orderSn,
|
||||||
|
Type: 1,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
@ -1385,6 +1392,7 @@ func (d *defaultOrder) OrderDetailHandler(ctx context.Context, orderInfo *gmodel
|
|||||||
|
|
||||||
var orderProductList []gmodel.OrderProduct
|
var orderProductList []gmodel.OrderProduct
|
||||||
for _, productValue := range orderProduct {
|
for _, productValue := range orderProduct {
|
||||||
|
var selectColorIndex int64
|
||||||
var shoppingCartSnapshotData gmodel.FsShoppingCartData
|
var shoppingCartSnapshotData gmodel.FsShoppingCartData
|
||||||
for _, shoppingCartSnapshotValue := range shoppingCartSnapshot {
|
for _, shoppingCartSnapshotValue := range shoppingCartSnapshot {
|
||||||
if productValue.CartId == shoppingCartSnapshotValue.Id {
|
if productValue.CartId == shoppingCartSnapshotValue.Id {
|
||||||
@ -1409,6 +1417,12 @@ func (d *defaultOrder) OrderDetailHandler(ctx context.Context, orderInfo *gmodel
|
|||||||
shoppingCartSnapshotData.Ctime = shoppingCartSnapshotValue.Ctime
|
shoppingCartSnapshotData.Ctime = shoppingCartSnapshotValue.Ctime
|
||||||
shoppingCartSnapshotData.Utime = shoppingCartSnapshotValue.Utime
|
shoppingCartSnapshotData.Utime = shoppingCartSnapshotValue.Utime
|
||||||
shoppingCartSnapshotData.Snapshot = &snapshot
|
shoppingCartSnapshotData.Snapshot = &snapshot
|
||||||
|
|
||||||
|
selectColorIndexV, selectColorIndexE := snapshot["select_color_index"]
|
||||||
|
if selectColorIndexE {
|
||||||
|
selectColorIndex = selectColorIndexV.(int64)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1429,6 +1443,7 @@ func (d *defaultOrder) OrderDetailHandler(ctx context.Context, orderInfo *gmodel
|
|||||||
FittingInfo: productValue.FittingInfo,
|
FittingInfo: productValue.FittingInfo,
|
||||||
IsHighlyCustomized: productValue.IsHighlyCustomized,
|
IsHighlyCustomized: productValue.IsHighlyCustomized,
|
||||||
RenderImage: productValue.RenderImage,
|
RenderImage: productValue.RenderImage,
|
||||||
|
SelectColorIndex: selectColorIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
orderProductList = append(orderProductList, orderProductItem)
|
orderProductList = append(orderProductList, orderProductItem)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user