feat(coupon): 添加景区ID过滤功能以查询用户可用优惠券

- 在getUserCoupons接口中添加scenicId参数支持
- 修改couponService实现以按景区ID过滤优惠券
- 添加空值检查跳过无效配置的优惠券
- 更新接口文档添加scenicId参数说明
This commit is contained in:
2026-02-14 17:42:44 +08:00
parent 09d142aa98
commit b01056d829
3 changed files with 11 additions and 6 deletions

View File

@@ -58,13 +58,13 @@ public class PriceCalculationController {
* 查询用户可用优惠券(包含领取记录信息)
*/
@GetMapping("/coupons/my-coupons")
public ApiResponse<List<UserCouponResp>> getUserCoupons() {
public ApiResponse<List<UserCouponResp>> getUserCoupons(@RequestParam(required = false) String scenicId) {
Long userId = getUserId();
if (userId == null) {
return ApiResponse.fail("用户未登录");
}
List<UserCouponResp> coupons = couponService.getUserAvailableCoupons(userId);
List<UserCouponResp> coupons = couponService.getUserAvailableCoupons(userId, scenicId);
return ApiResponse.success(coupons);
}