fix: 公开订单接口增加customerId校验,防止盗查
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -14,7 +14,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* 公开订单查看控制器
|
||||
* 无需认证,用于客户通过分享链接查看订单
|
||||
* 无需权限认证,用于客户通过分享链接查看订单
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/public")
|
||||
@@ -27,19 +27,23 @@ public class PublicOrderController {
|
||||
private OrderItemMapper orderItemMapper;
|
||||
|
||||
/**
|
||||
* 通过订单号查询订单详情
|
||||
* 公开接口,无需认证
|
||||
* 通过订单号和客户ID查询订单详情
|
||||
* 公开接口,需同时提供订单号和客户ID才能查看
|
||||
*/
|
||||
@GetMapping("/orders/{orderNo}")
|
||||
public Result<Map<String, Object>> getOrderByNo(@PathVariable String orderNo) {
|
||||
public Result<Map<String, Object>> getOrderByNo(
|
||||
@PathVariable String orderNo,
|
||||
@RequestParam String customerId) {
|
||||
|
||||
// 查询订单
|
||||
Order order = orderMapper.selectOne(
|
||||
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<Order>()
|
||||
.eq(Order::getOrderNo, orderNo)
|
||||
.eq(Order::getCustomerId, customerId)
|
||||
);
|
||||
|
||||
if (order == null) {
|
||||
return Result.error("订单不存在");
|
||||
return Result.error("订单不存在或客户信息不匹配");
|
||||
}
|
||||
|
||||
// 查询订单明细
|
||||
|
||||
Reference in New Issue
Block a user