Browse Source

过滤下架产品

kobe6258 3 months ago
parent
commit
9215dd3652
1 changed files with 11 additions and 14 deletions
  1. 11 14
      domian/order/product_order.go

+ 11 - 14
domian/order/product_order.go

@@ -174,7 +174,17 @@ func convertProductOrderDetailDTO(order orderDao.ProductOrder) (orderDetailDTO P
 			orderDetailDTO.StatusCN = transProductOrderStatusMap[orderDao.OrderStatusClosed]
 		} else {
 			orderDetailDTO.PaymentTimeRemain = int64(duration.Seconds())
-
+			product, err := productDao.GetMerchantProductById(order.ProductID)
+			if err != nil {
+				logger.Error("获取产品信息失败:%v,productId:%d", err, order.ProductID)
+			}
+			if product.Type != productDao.Package {
+				orderDetailDTO.ValidDuration = "永久有效"
+			} else {
+				beginDate := time.Now()
+				endDate := time.Now().Add(time.Duration(product.ValidDays * 24))
+				orderDetailDTO.ValidDuration = fmt.Sprintf("%s~%s", beginDate.Format(time.DateOnly), endDate.Format(time.DateOnly))
+			}
 		}
 	}
 	if order.Status == orderDao.OrderStatusPaid {
@@ -188,19 +198,6 @@ func convertProductOrderDetailDTO(order orderDao.ProductOrder) (orderDetailDTO P
 				orderDetailDTO.ValidDuration = fmt.Sprintf("%s~%s", access.BeginDate, access.EndDate)
 			}
 		}
-	} else {
-		product, err := productDao.GetMerchantProductById(order.ProductID)
-		if err != nil {
-			logger.Error("获取产品信息失败:%v,productId:%d", err, order.ProductID)
-		}
-		if product.Type != productDao.Package {
-			orderDetailDTO.ValidDuration = "永久有效"
-		} else {
-			beginDate := time.Now()
-			endDate := time.Now().Add(time.Duration(product.ValidDays * 24))
-			orderDetailDTO.ValidDuration = fmt.Sprintf("%s~%s", beginDate.Format(time.DateOnly), endDate.Format(time.DateOnly))
-		}
-
 	}
 	if order.TradeNO != "" {
 		orderDetailDTO.PaymentTime = order.PaymentTime.Format(time.DateTime)