|
@@ -46,6 +46,12 @@ type ProductOrderDetailDTO struct {
|
|
|
}
|
|
|
|
|
|
var (
|
|
|
+ typeTransfer = map[productDao.MerchantProductType]string{
|
|
|
+ productDao.Report: "单篇报告",
|
|
|
+ productDao.Video: "单个视频",
|
|
|
+ productDao.Audio: "单个音频",
|
|
|
+ productDao.Package: "套餐",
|
|
|
+ }
|
|
|
transProductOrderStatusMap = map[orderDao.OrderStatus]string{
|
|
|
orderDao.OrderStatusClosed: "已关闭",
|
|
|
orderDao.OrderStatusPaid: "已支付",
|
|
@@ -138,6 +144,7 @@ func convertProductOrderDetailDTO(order orderDao.ProductOrder) (orderDetailDTO P
|
|
|
UserID: order.UserID,
|
|
|
TemplateUserID: order.TemplateUserID,
|
|
|
ProductID: order.ProductID,
|
|
|
+ ProductType: typeTransfer[order.ProductType],
|
|
|
TotalAmount: order.TotalAmount,
|
|
|
PaymentWay: string(order.PaymentWay),
|
|
|
Status: string(order.Status),
|
|
@@ -177,6 +184,19 @@ func convertProductOrderDetailDTO(order orderDao.ProductOrder) (orderDetailDTO P
|
|
|
} else {
|
|
|
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)
|