|
@@ -326,32 +326,41 @@ func DealReportInfo(report *reportService.ReportDTO, isLogin bool, userId int) (
|
|
var packageList []productService.MerchantProductDTO
|
|
var packageList []productService.MerchantProductDTO
|
|
//查询产品信息
|
|
//查询产品信息
|
|
product, pdErr := productService.GetProductBySourceId(report.ReportID, productDao.Report)
|
|
product, pdErr := productService.GetProductBySourceId(report.ReportID, productDao.Report)
|
|
- if pdErr != nil {
|
|
|
|
- var permissionIds []int
|
|
|
|
- if len(permissions) > 0 {
|
|
|
|
- for _, permission := range permissions {
|
|
|
|
- permissionIds = append(permissionIds, permission.PermissionId)
|
|
|
|
- }
|
|
|
|
- //单品不存在的话查套餐
|
|
|
|
- packageList, err = productService.GetProductListBySourceIds(permissionIds, "package")
|
|
|
|
- if err != nil || len(packageList) == 0 {
|
|
|
|
- logger.Error("获取套餐列表失败:%v", err)
|
|
|
|
- report.Price = defaultProductPrice
|
|
|
|
- report.IsFree = true
|
|
|
|
- report.IsSubscribe = false
|
|
|
|
- report.IsPackage = false
|
|
|
|
- } else {
|
|
|
|
- report.Price = packageList[0].Price
|
|
|
|
- report.IsFree = false
|
|
|
|
- report.IsSubscribe = false
|
|
|
|
- report.IsPackage = true
|
|
|
|
- report.ProductId = packageList[0].Id
|
|
|
|
- }
|
|
|
|
|
|
+ var permissionIds []int
|
|
|
|
+ if len(permissions) > 0 {
|
|
|
|
+ for _, permission := range permissions {
|
|
|
|
+ permissionIds = append(permissionIds, permission.PermissionId)
|
|
|
|
+ }
|
|
|
|
+ //单品不存在的话查套餐
|
|
|
|
+ packageList, err = productService.GetProductListBySourceIds(permissionIds, "package")
|
|
|
|
+ if err != nil || len(packageList) == 0 {
|
|
|
|
+ logger.Error("获取套餐列表失败:%v", err)
|
|
|
|
+ report.Price = defaultProductPrice
|
|
|
|
+ report.IsFree = true
|
|
|
|
+ report.IsSubscribe = false
|
|
|
|
+ report.IsPackage = false
|
|
} else {
|
|
} else {
|
|
|
|
+ report.Price = packageList[0].Price
|
|
|
|
+ report.IsFree = false
|
|
|
|
+ report.IsSubscribe = false
|
|
|
|
+ report.IsPackage = true
|
|
|
|
+ report.ProductId = packageList[0].Id
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if pdErr != nil {
|
|
|
|
+ //单品不存在的话查套餐
|
|
|
|
+ if len(packageList) == 0 {
|
|
|
|
+ logger.Error("获取套餐列表失败:%v", err)
|
|
report.Price = defaultProductPrice
|
|
report.Price = defaultProductPrice
|
|
report.IsFree = true
|
|
report.IsFree = true
|
|
report.IsSubscribe = false
|
|
report.IsSubscribe = false
|
|
report.IsPackage = false
|
|
report.IsPackage = false
|
|
|
|
+ } else {
|
|
|
|
+ report.Price = packageList[0].Price
|
|
|
|
+ report.IsFree = false
|
|
|
|
+ report.IsSubscribe = false
|
|
|
|
+ report.IsPackage = true
|
|
|
|
+ report.ProductId = packageList[0].Id
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
report.Price = product.Price
|
|
report.Price = product.Price
|