Jelajahi Sumber

产品列表

kobe6258 4 bulan lalu
induk
melakukan
8365d6283d

+ 3 - 3
models/merchant/merchant_product.go

@@ -105,8 +105,8 @@ func GetProductListBySourceIds(ids []int, detail bool, productType ...MerchantPr
 
 func GetTotalPageCountByProductType(productType MerchantProductType) (total int64, latestId int64) {
 	db := models.Main()
-	_ = db.Select("count(*)").Where("type=? and deleted =?", productType, false).Scan(&total).Error
-	_ = db.Select("max(id)").Where("type=? and deleted =?", productType, false).Scan(&latestId).Error
+	_ = db.Model(&MerchantProduct{}).Select("count(*)").Where("type=? and deleted =?", productType, false).Scan(&total).Error
+	_ = db.Model(&MerchantProduct{}).Select("max(id)").Where("type=? and deleted =?", productType, false).Scan(&latestId).Error
 	return
 }
 
@@ -116,6 +116,6 @@ func GetProductListByProductType(productType MerchantProductType, id int64, offs
 		err = errors.New("productType参数不能为空")
 		return
 	}
-	err = db.Select(detailColumns).Where("id <= ? and type = ? and deleted =? limit ?,? order by created_time desc", id, productType, false, offset, limit).Find(&list).Error
+	err = db.Select(detailColumns).Where("id <= ? and type = ? and deleted =? order by created_time desc limit ?,? ", id, productType, false, offset, limit).Find(&list).Error
 	return
 }

+ 1 - 0
service/product/product_service.go

@@ -234,6 +234,7 @@ func ProductList(productType string, info page.PageInfo) (dtoList []ProductDTO,
 	merchantProductList, err = merchantService.GetProductListByProductType(productType, info)
 	for _, product := range merchantProductList {
 		productDTO := convertToProductDTO(product)
+		productDTO.RiskLevel, productDTO.SourceTile, productDTO.Abstract, productDTO.CoverUrl, productDTO.Src, productDTO.PermissionNames, err = GetProductRiskLevel(product)
 		dtoList = append(dtoList, productDTO)
 	}
 	return