Selaa lähdekoodia

更新文件 advertiseAction.java

陈士柏 2 vuotta sitten
vanhempi
commit
730884a487
1 muutettua tiedostoa jossa 13 lisäystä ja 0 poistoa
  1. 13 0
      mhotel/src/com/happy/action/advertiseAction.java

+ 13 - 0
mhotel/src/com/happy/action/advertiseAction.java

@@ -244,7 +244,14 @@ public class advertiseAction extends ActionSupport implements ServletRequestAwar
                     ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
                     return null;
                 }
+                if (open.size()==1 && ids.contains(advertise.getId()) && advertise.getState()==0){
+                    resultjson.put("message", "必须保留一个广告");
+                    resultjson.put("code", 500);
+                    ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+                    return null;
+                }
             }
+
             if (advertise.getJumpWay().equals("小程序") && advertise.getJumpDirection().equals("民宿") && !advertise.getJumpPoint().equals("首页")){
                 AdminManager adminManager = adminManagerService.getById(Integer.parseInt(advertise.getJumpPoint()));
                 HotelDict hotelDict = hotelDictService.getById(Integer.parseInt(adminManager.getHotelTownship()));
@@ -389,6 +396,12 @@ public class advertiseAction extends ActionSupport implements ServletRequestAwar
                 ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
                 return null;
             }
+            if (open.size()==1 && ids.contains(advertise.getId()) && state==0){
+                resultJson.put("message", "必须保留一个广告");
+                resultJson.put("code", 500);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
         }
         int m = advertiseService.updateState(id,state,TimeExchange.getTime());
         if (m>0){