|
@@ -35,7 +35,6 @@ void module_meta_date_changed::accept(sio::message::ptr const& data)
|
|
|
std::string op_type="";
|
|
|
tool_map::try_get_value(op_type, JSON_KEY_OP_TYPE, data);
|
|
|
|
|
|
- //printf("Recv Web Data : name=%s,edit_type=%s id =%lld , %s ...\n",name.c_str(),op_type.c_str(),id,szParam.c_str());
|
|
|
if((-1 != id || szParam != "0") && !op_type.empty())
|
|
|
{
|
|
|
EDIT_TYPE_ID edit_type_id;
|
|
@@ -44,8 +43,8 @@ void module_meta_date_changed::accept(sio::message::ptr const& data)
|
|
|
log_error("web发来的数据: 基础数据op_type字段错误:op_type=%s", op_type.c_str());
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- log_info("基础数据 receive meta_data_changed: %s, id=%d, op_type=%d", name.c_str(), id, edit_type_id);
|
|
|
+ log_info("基础数据 receive meta_data_changed: %s, id=%d-%s, op_type=%d"
|
|
|
+ , name.c_str(), id,szParam.c_str() , edit_type_id);
|
|
|
|
|
|
if(JSON_KEY_NAME_VEHICLE == name || JSON_KEY_NAME_VEHICLE_EXTEND == name)
|
|
|
{
|
|
@@ -145,12 +144,10 @@ void module_meta_date_changed::clear_card(std::shared_ptr<card_location_base> ca
|
|
|
}
|
|
|
/*
|
|
|
* 修改车及卡的数据
|
|
|
- * id64 = ;员工ID或者车ID;卡ID=101;10000001198 分号间隔
|
|
|
+ * id64 = ;员工ID或者车ID;卡ID=101;0010000001198 分号间隔
|
|
|
*/
|
|
|
void module_meta_date_changed::deal_call_edit_vehicle_or_staff(const std::string & id64, EDIT_TYPE_ID edit_type_id)
|
|
|
{
|
|
|
- // id64 = ;员工ID或者车ID;卡ID=101;10000001198 分号间隔
|
|
|
-
|
|
|
std::vector<std::string> vecSegTag;
|
|
|
boost::split(vecSegTag, id64, boost::is_any_of(";"));
|
|
|
if (vecSegTag.size() == 1) //数据发生错误
|
|
@@ -159,7 +156,6 @@ void module_meta_date_changed::deal_call_edit_vehicle_or_staff(const std::string
|
|
|
return;
|
|
|
}
|
|
|
std::string lsz_card_id = vecSegTag[1];
|
|
|
- int64_t card_id = std::stoll(lsz_card_id);
|
|
|
int cid = std::stoi(vecSegTag[0].c_str());
|
|
|
if(ET_INSERT == edit_type_id || ET_UPDATE == edit_type_id)
|
|
|
{
|
|
@@ -172,7 +168,15 @@ void module_meta_date_changed::deal_call_edit_vehicle_or_staff(const std::string
|
|
|
remove_card(c);
|
|
|
}
|
|
|
}
|
|
|
- card_list::instance()->init_vehicle(card_id);
|
|
|
+ int c_type = tool_other::id64_to_type(lsz_card_id);
|
|
|
+ if (tool_other::is_vehicle(c_type))
|
|
|
+ {
|
|
|
+ card_list::instance()->init_vehicle(lsz_card_id);
|
|
|
+ }
|
|
|
+ else if (tool_other::is_person(c_type))
|
|
|
+ {
|
|
|
+ card_list::instance()->init_staffer(lsz_card_id);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -182,21 +186,16 @@ void module_meta_date_changed::deal_call_edit_vehicle_or_staff(const std::string
|
|
|
|
|
|
void module_meta_date_changed::deal_call_edit_card(std::string & id64, EDIT_TYPE_ID edit_type_id)
|
|
|
{
|
|
|
- std::string lsz = id64;
|
|
|
- std::string card_id64_str = tool_other::to13str(lsz);
|
|
|
+ std::string card_id64_str = tool_other::to13str(id64);
|
|
|
int type = tool_other::id64_to_type(card_id64_str);
|
|
|
if(tool_other::is_person(type) || tool_other::is_vehicle(type))
|
|
|
{
|
|
|
- if (edit_type_id == ET_UPDATE)
|
|
|
- {
|
|
|
- auto c = card_list::instance()->get(tool_other::card_id_to_u64(card_id64_str));
|
|
|
- if (nullptr != c)
|
|
|
- {
|
|
|
- char id[100] = {0};
|
|
|
- sprintf(id,"%d;%s",c->m_cid,card_id64_str.c_str());
|
|
|
- lsz = id;
|
|
|
- }
|
|
|
+ auto c = card_list::instance()->get(tool_other::card_id_to_u64(card_id64_str));
|
|
|
+ if (nullptr == c) {
|
|
|
+ log_info("web edit card:%s Not bind staff or vehicle. editType:%d", card_id64_str.c_str(), edit_type_id);
|
|
|
+ return ;
|
|
|
}
|
|
|
+ std::string lsz = std::to_string(c->m_cid) + ";" + card_id64_str;
|
|
|
deal_call_edit_vehicle_or_staff(lsz,edit_type_id);
|
|
|
}
|
|
|
else
|