|
@@ -24,6 +24,7 @@ type ProductDTO struct {
|
|
|
Type string
|
|
|
BeginDate string
|
|
|
EndDate string
|
|
|
+ SourceId int
|
|
|
}
|
|
|
|
|
|
func GetProductRiskLevel(product merchantService.MerchantProductDTO) (riskLevel string, err error) {
|
|
@@ -100,6 +101,7 @@ func convertToProductDTO(product merchantService.MerchantProductDTO) (productDTO
|
|
|
Type: product.Type,
|
|
|
BeginDate: beginDate.Format(time.DateOnly),
|
|
|
EndDate: endDate.Format(time.DateOnly),
|
|
|
+ SourceId: product.SourceId,
|
|
|
}
|
|
|
return
|
|
|
}
|
|
@@ -136,4 +138,33 @@ func CloseProduct(templateUserId int, productOrderNo string) (err error) {
|
|
|
|
|
|
//过期产品(套餐)
|
|
|
|
|
|
-//退款关闭套餐
|
|
|
+// 退款关闭套餐
|
|
|
+func GetRelatePackage(info ProductDTO) (prodList []merchantService.MerchantProductDTO, err error) {
|
|
|
+ switch info.Type {
|
|
|
+ case "audio", "video":
|
|
|
+ permissionIds, permissionErr := media.GetMediaPermissionMappingByMedia(info.Type, info.SourceId)
|
|
|
+ if permissionErr != nil {
|
|
|
+ logger.Error("获取媒体品种信息失败:%v", err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return merchantService.GetProductListBySourceIds(permissionIds, "package")
|
|
|
+ case "report":
|
|
|
+ reportInfo, reportErr := reportService.GetReportById(info.SourceId)
|
|
|
+ if reportErr != nil {
|
|
|
+ logger.Error("获取报告信息失败:%v", err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ permissions := reportService.GetReportSecondPermissionsById(reportInfo.OrgId, reportInfo.Source)
|
|
|
+ var permissionIds []int
|
|
|
+ if len(permissions) > 0 {
|
|
|
+ for _, permission := range permissions {
|
|
|
+ permissionIds = append(permissionIds, permission.PermissionId)
|
|
|
+ }
|
|
|
+ permissionIds = append(permissionIds, permissions[0].PermissionId)
|
|
|
+ }
|
|
|
+ return merchantService.GetProductListBySourceIds(permissionIds, "package")
|
|
|
+ default:
|
|
|
+ err = exception.New(exception.ProductTypeError)
|
|
|
+ return
|
|
|
+ }
|
|
|
+}
|