| 12345678910111213141516171819202122232425262728 |
- sequenceDiagram
- participant U as 买家小程序
- participant OD as order-detail.vue
- participant RC as ProductReviewController
- participant RS as ProductReviewServiceImpl
- participant UM as ProductReviewMapper
- participant OM as ProductOrderMapper
- U->>OD: onLoad(orderNo)
- OD->>RC: POST /api/product/review/detail {orderNo}
- RC->>RS: detail(orderNo, userId)
- RS->>OM: select order
- RS->>UM: findByOrderId
- RS-->>OD: {review, canReview}
- OD-->>U: completed 且可评 → 显示「去评价」
- U->>OD: 点「去评价」→ order-review 页
- U->>RC: POST /api/product/review/create {orderId,rating,reviewText,images}
- RC->>RS: createReview(req, userId)
- RS->>OM: 校验 status=completed / productType!='activity' / 90天内 / buyer本人
- RS->>UM: findByOrderId → null 才允许(一单一评)
- RS->>UM: insert product_reviews
- RS-->>U: Result.success
- Note over U,RC: 商品详情页匿名读评价
- U->>RC: POST /api/product/review/list {productId,page,size}
- RC->>RS: listByProduct(productId) → {total,avgRating,records}
- RS-->>U: 评价列表 + 商家回复
|