Browse Source

排除没有机器时购买优惠码

李天标 5 years ago
parent
commit
c23811d379

+ 5 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/PromoCodeController.java

@@ -159,6 +159,11 @@ public class PromoCodeController extends BaseController {
     public String img(int number, String frpCode ,Pageable pageable, ModelMap model) {
         Admin admin = adminService.getCurrent();
         List<Equipment> equipmentList = equipmentService.findByAdminId(admin.getId());
+        if(equipmentList.size()==0){
+//            return  "要有机器才能购买优惠码";
+            model.addAttribute("image", "404");
+            return "/admin/promoCode/img";
+        }
         Equipment equipment = equipmentList.get(0);
         Long equipmentId = equipment.getId();
         Proportion proportion = proportionService.getUniqueness(equipment.getAdminId());

+ 8 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/promoCode/img.ftl

@@ -34,6 +34,14 @@
 
     </div>
     <table class="input">
+        [#if image==404]
+        <th style="color: #af0000">
+           提示:
+        </th>
+            <td style="color: #af0000">
+                要有机器才能购买优惠码
+            </td>
+        [/#if]
         <tr>
             <th>
                 &nbsp;您需要支付:${price}元