|
@@ -19,15 +19,19 @@ import (
|
|
|
)
|
|
|
|
|
|
type ProductDTO struct {
|
|
|
- Title string
|
|
|
- Description string
|
|
|
- Price decimal.Decimal
|
|
|
- CoverSrc string
|
|
|
- RiskLevel string
|
|
|
- Type string
|
|
|
- BeginDate string
|
|
|
- EndDate string
|
|
|
- SourceId int
|
|
|
+ Title string
|
|
|
+ SourceTile string
|
|
|
+ SourceAbstract string
|
|
|
+ SourceSrc string
|
|
|
+ PermissionNames string
|
|
|
+ Description string
|
|
|
+ Price decimal.Decimal
|
|
|
+ CoverSrc string
|
|
|
+ RiskLevel string
|
|
|
+ Type string
|
|
|
+ BeginDate string
|
|
|
+ EndDate string
|
|
|
+ SourceId int
|
|
|
}
|
|
|
|
|
|
func GetProductRiskLevel(product merchantService.MerchantProductDTO) (riskLevel, sourceTitle, sourceAbsract, sourceSrc, permissionNames string, err error) {
|
|
@@ -98,7 +102,7 @@ func GetProductInfoById(productId int) (product ProductDTO, err error) {
|
|
|
return
|
|
|
}
|
|
|
product = convertToProductDTO(merchantProduct)
|
|
|
- product.RiskLevel, _, _, _, _, err = GetProductRiskLevel(merchantProduct)
|
|
|
+ product.RiskLevel, product.SourceTile, product.SourceAbstract, product.SourceSrc, product.PermissionNames, err = GetProductRiskLevel(merchantProduct)
|
|
|
if err != nil {
|
|
|
logger.Error("获取风险等级失败[productId:%d]", productId)
|
|
|
}
|
|
@@ -154,7 +158,7 @@ func CloseProduct(templateUserId int, productOrderNo string) (err error) {
|
|
|
//过期产品(套餐)
|
|
|
|
|
|
// 退款关闭套餐
|
|
|
-func GetRelatePackage(info ProductDTO) (prodList []merchantService.MerchantProductDTO, err error) {
|
|
|
+func GetRelatePackage(info ProductDTO) (prodList []ProductDTO, err error) {
|
|
|
switch info.Type {
|
|
|
case "audio", "video":
|
|
|
permissionIds, permissionErr := media.GetMediaPermissionMappingByMedia(info.Type, info.SourceId)
|
|
@@ -162,7 +166,14 @@ func GetRelatePackage(info ProductDTO) (prodList []merchantService.MerchantProdu
|
|
|
logger.Error("获取媒体品种信息失败:%v", err)
|
|
|
return
|
|
|
}
|
|
|
- return merchantService.GetProductListBySourceIds(permissionIds, "package")
|
|
|
+ merchantProduct, pdErr := merchantService.GetProductListBySourceIds(permissionIds, "package")
|
|
|
+ if pdErr != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, product := range merchantProduct {
|
|
|
+ prodList = append(prodList, convertToProductDTO(product))
|
|
|
+ }
|
|
|
+ return
|
|
|
case "report":
|
|
|
reportInfo, reportErr := reportDomain.GetReportById(info.SourceId)
|
|
|
if reportErr != nil {
|
|
@@ -177,7 +188,14 @@ func GetRelatePackage(info ProductDTO) (prodList []merchantService.MerchantProdu
|
|
|
}
|
|
|
permissionIds = append(permissionIds, permissions[0].PermissionId)
|
|
|
}
|
|
|
- return merchantService.GetProductListBySourceIds(permissionIds, "package")
|
|
|
+ merchantProduct, pdErr := merchantService.GetProductListBySourceIds(permissionIds, "package")
|
|
|
+ if pdErr != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, product := range merchantProduct {
|
|
|
+ prodList = append(prodList, convertToProductDTO(product))
|
|
|
+ }
|
|
|
+ return
|
|
|
default:
|
|
|
err = exception.New(exception.ProductTypeError)
|
|
|
return
|