Explorar o código

微信小程序适配

zengminguo %!s(int64=2) %!d(string=hai) anos
pai
achega
922650891d
Modificáronse 1 ficheiros con 23 adicións e 2 borrados
  1. 23 2
      card_base.cpp

+ 23 - 2
card_base.cpp

@@ -311,6 +311,12 @@ void card_location_base::on_message(zloop<task*>* loop, message_ins_locinfo& loc
 	std::string site_info = "";
 	std::string now = tool_time::to_str_ex(tool_time::now_to_ms());
 
+	int nIndex = 0;
+	int siteId1 = 0;
+	int siteId2 = 0;
+	double distance1 = 0;
+	double distance2 = 0;
+
 	// 存入数据库
 	for(auto itl : itm->second){
 		site_info += std::to_string(itl.m_site_id);
@@ -339,19 +345,34 @@ void card_location_base::on_message(zloop<task*>* loop, message_ins_locinfo& loc
 		}
 		site_info += "," + std::to_string(v);
 		site_info += ";";
+		if (nIndex == 0)
+		{
+			siteId1 = itl.m_site_id;
+			distance1 = d;
+			nIndex++;
+		}
+		else if (nIndex == 1)
+		{
+			siteId2 = itl.m_site_id;
+			distance2 = d;
+		}
 	}
 	
 	// 数据入库
 	char sql[1024] = { 0 };
 	snprintf(sql, 
 			1024, 
-			"insert into his_raw_data_sb(card_id, x, y, z, speed, site_info, acc, acc_x, acc_y, acc_z, ang, ang_x, ang_y, ang_z, cur_time) values('%s', %.2f, %.2f, %.2f, %.2f, '%s', %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, '%s')",
+			"insert into his_raw_data_sb(card_id, x, y, z, speed, site_id1, distance1, site_id2, distance2, site_info, acc, acc_x, acc_y, acc_z, ang, ang_x, ang_y, ang_z, cur_time) values('%s', %.2f, %.2f, %.2f, %.2f, %d, %.2f, %d, %.2f, '%s', %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, '%s')",
 			sid.c_str(),
 			0.0,
 			0.0,
 			0.0,
 			0.0,
-			site_info.c_str(),
+		siteId1,
+		distance1,
+		siteId2,
+		distance2,
+			"",//site_info.c_str(),
 			loc.m_ins_data.get_acc(),
 			loc.m_ins_data.get_acc(0),
 			loc.m_ins_data.get_acc(1),