Procházet zdrojové kódy

解决stoi out_of_range 得异常

lixioayao před 6 roky
rodič
revize
c1849343e3
1 změnil soubory, kde provedl 7 přidání a 2 odebrání
  1. 7 2
      module_service/module_meta_date_changed.cpp

+ 7 - 2
module_service/module_meta_date_changed.cpp

@@ -26,14 +26,13 @@ void module_meta_date_changed::accept(sio::message::ptr const& data)
         return;
     }
 
-
     std::string szParam = "0";
     tool_map::try_get_value(szParam,JSON_KEY_ID,data);
-    int id = std::stoi(szParam);
 
     std::string op_type="";
     tool_map::try_get_value(op_type, JSON_KEY_OP_TYPE, data);
 
+    log_info("web发来数据:JSON_CMD_VALUE_META_DATA_CHANGED,%s---%s",szParam.c_str(),op_type.c_str());
     if(!szParam.empty() && !op_type.empty())
     {
         EDIT_TYPE_ID edit_type_id;
@@ -63,26 +62,32 @@ void module_meta_date_changed::accept(sio::message::ptr const& data)
         }
         else if(JSON_KEY_NAME_READER == name)
         {
+            int id = std::stoi(szParam);
             deal_call_edit_reader(id, edit_type_id);
         }
         else if ("antenna" == name)
         {
+            int id = std::stoi(szParam);
             deal_call_edit_antenna(id,edit_type_id);
         }
         else if(JSON_KEY_NAME_PATH == name)
         {
+            int id = std::stoi(szParam);
             deal_call_edit_path(id, edit_type_id);
         }
         else if(JSON_KEY_NAME_MAP == name)
         {
+            int id = std::stoi(szParam);
             deal_call_edit_map(id, edit_type_id);
         }
         else if (JSON_KEY_NAME_LIGHT == name)
         {
+            int id = std::stoi(szParam);
             deal_call_edit_light(id,edit_type_id);///待实现
         }
         else if ("lights_group" == name)
         {
+            int id = std::stoi(szParam);
             deal_call_edit_lights_group(id,edit_type_id);///待实现
         }
         else if (JSON_KEY_NAME_FORBID_PERSON_DOWN_MINE == name)