GET
/api/products/top-weekly
200 OK
Body:
{
"status": "OK",
"code": 200,
"message": "주간 인기 상품 정보 조회가 완료되었습니다.",
"result": {
"topWeeklyProducts": [
{
"id": 20,
"category_id": 10,
"product_name": "ProductT 20",
"main_image_id": 35,
"main_image_url": "<https://picsum.photos/200/300?random=34>",
"regular_price": 20000,
"discount_rate": 23,
"sale_price": 15400,
"min_quantity": 20
},
{
"id": 19,
"category_id": 9,
"product_name": "ProductS 19",
"main_image_id": 34,
"main_image_url": "<https://picsum.photos/200/300?random=33>",
"regular_price": 19000,
"discount_rate": 22,
"sale_price": 14820,
"min_quantity": 19
},
{
"id": 18,
"category_id": 8,
"product_name": "ProductR 18",
"main_image_id": 33,
"main_image_url": "<https://picsum.photos/200/300?random=32>",
"regular_price": 18000,
"discount_rate": 23,
"sale_price": 13860,
"min_quantity": 18
}
]
}
}
05/12 추가
main_image_id
**는 해당 상품의 대표 이미지를 가리키는 **ProductImage
**의 **id
**입니다. **main_image_url
**는 해당 상품의 대표 이미지 URL입니다. **sale_price
**는 할인율을 적용한 판매 가격입니다.ProductService
**의 getMainImage
메서드를 호출하여 대표 이미지를 찾은 뒤, 그 결과와 함께 정가와 할인율을 이용하여 판매 가격을 계산한 후 클라이언트에게 반환하면 됩니다. 이렇게 하면 클라이언트는 각 상품에 대한 정보와 함께 대표 이미지와 판매 가격을 쉽게 확인할 수 있을 것입니다.sale_price
**는 할인율을 적용한 후 소수점을 버린 판매 가격입니다. 이는 정수형으로 표현됩니다.postman 요청 및 응답화면
{ "status": "OK", "code": 200, "message": "주간 인기 상품 정보 조회가 완료되었습니다.", "result": { "topWeeklyProducts": [ { "id": 50, "category_id": 9, "product_name": "망고즙", "main_image_id": 89, "main_image_url": "https://picsum.photos/200", "regular_price": 15000, "discount_rate": 55, "sale_price": 6750, "min_quantity": 100 }, { "id": 40, "category_id": 5, "product_name": "노트북", "main_image_id": 70, "main_image_url": "https://www.apple.com/newsroom/images/product/mac/standard/Apple_MacBook-Pro_14-16-inch_10182021_big.jpg.large.jpg", "regular_price": 1500000, "discount_rate": 60, "sale_price": 600000, "min_quantity": 20 }, { "id": 39, "category_id": 1, "product_name": "식탁 세트", "main_image_id": 69, "main_image_url": "https://picsum.photos/200/300?random=59", "regular_price": 700000, "discount_rate": 55, "sale_price": 315000, "min_quantity": 30 } ] } }