zoujiajian 1 yıl önce
ebeveyn
işleme
3b2241e379

+ 18 - 0
netflix-web/src/main/java/com/cyksj/web/controller/payment/OrderController.java

@@ -134,6 +134,9 @@ public class OrderController {
     @Autowired
     private LumaService lumaService;
 
+    @Autowired
+    private UserBindRelationService userBindRelationService;
+
     /**
      * 支付
      * @author chan
@@ -902,4 +905,19 @@ public class OrderController {
         return GatewayResponse.SUCCESS.newBuilder().toResult(userPayEquipmentAvailableBenefits);
     }
 
+    /**
+     * 是否购买过实物设备
+     */
+    @GetMapping("/has/paid/equipment")
+    public Result<Boolean> hasPaidEquipment() {
+        long userId = StpUserUtil.getLoginIdAsLong();
+        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
+        //是否买过设备
+        Integer selectCount = orderDonService.count(Wrappers.lambdaQuery(OrderDon.class)
+                .eq(OrderDon::getGoodsId, 15)
+                .in(OrderDon::getUserId, userIdList)
+                .notIn(OrderDon::getStatus, Constant.noOrderAllStatus));
+        return GatewayResponse.SUCCESS.newBuilder().toResult(selectCount > 0);
+    }
+
 }