zxs hace 1 mes
padre
commit
a2d0e5e0aa

+ 1 - 1
src/CMakeLists.txt

@@ -22,7 +22,7 @@ execute_process(COMMAND "${GENERATOR_PATH}code_generator_command" "${CMAKE_CURRE
 #add_executable(sync_service "main.cpp")
 
 # 将源代码添加到此项目的可执行文件。
-add_executable("${PROJECT_NAME}" "main.cpp" "models/web_sync_item_request_info.h"      "models/web_sync_config_info.h" "models/web_regex_config_info.h" "models/web_general_config_info.h" "models/web_drop_config_info.h")
+add_executable("${PROJECT_NAME}" "main.cpp" "models/web_sync_item_request_info.h"      "models/web_sync_config_info.h" "models/web_regex_config_info.h" "models/web_general_config_info.h" "models/web_drop_config_info.h" "models/web_stepping_request_v1_info.h" "models/web_supply_request_v1_info.h" "models/web_drop_request_v1_info.h")
 
 if (CMAKE_VERSION VERSION_GREATER 3.12)
   set_property(TARGET "${PROJECT_NAME}" PROPERTY CXX_STANDARD 20)

+ 31 - 31
src/config/config.xml

@@ -1,34 +1,34 @@
 <?xml version="1.0" encoding="utf-8"?>
 <root>
-    <users>
-        <item id="1" modify_time="2025-06-02 19:53:32" name="管理员" code="admin" password="123456" enable="true" remarks="管理员"/>
-    </users>
-    <drop>
-        <item id="1" modify_time="2025-06-23 16:12:19" type="0" name="正常" enable="true" remarks="正常落格"/>
-        <item id="2" modify_time="2025-06-23 16:12:19" type="1" name="无方案" enable="true" remarks="无方案"/>
-        <item id="3" modify_time="2025-06-23 16:12:19" type="2" name="超圈" enable="true" remarks="超圈"/>
-        <item id="4" modify_time="2025-06-23 16:12:19" type="3" name="无格口" enable="true" remarks="无格口"/>
-        <item id="5" modify_time="2025-06-23 16:12:20" type="4" name="小车错误" enable="true" remarks="小车错误"/>
-        <item id="6" modify_time="2025-06-23 16:12:20" type="5" name="重量错误" enable="true" remarks="重量错误"/>
-        <item id="7" modify_time="2025-06-23 16:12:20" type="6" name="wcs无响应" enable="true" remarks="wcs无响应"/>
-        <item id="8" modify_time="2025-06-23 16:12:20" type="7" name="漏分拣检测" enable="true" remarks="漏分拣检测"/>
-        <item id="9" modify_time="2025-06-23 16:12:20" type="8" name="未知异常" enable="true" remarks="未知异常"/>
-    </drop>
-    <regex>
-        <item id="1" modify_time="2025-06-23 16:12:16" type="1" name="圆通" regex="^YT[0-9]{10,20}$" enable="true" remarks="圆通"/>
-        <item id="2" modify_time="2025-06-23 16:12:16" type="0" name="未知" regex="" enable="true" remarks="未知"/>
-        <item id="3" modify_time="2025-06-23 16:12:16" type="2" name="中通" regex="^ZT[0-9]{10,20}$" enable="true" remarks="中通"/>
-        <item id="4" modify_time="2025-06-23 16:12:16" type="3" name="申通" regex="^ST[0-9]{10,20}$" enable="true" remarks="申通"/>
-        <item id="5" modify_time="2025-06-23 16:12:16" type="4" name="韵达" regex="^YD[0-9]{10,20}$" enable="true" remarks="韵达"/>
-        <item id="6" modify_time="2025-06-23 16:12:16" type="5" name="极兔" regex="^JT[0-9]{10,20}$" enable="true" remarks="极兔"/>
-    </regex>
-    <general>
-        <item id="1" modify_time="2025-06-23 16:12:40" key="1" value="http://127.0.0.1:9004/api/base/drop_type" enable="true" remarks="落格类型地址配置"/>
-        <item id="2" modify_time="2025-06-23 16:12:40" key="2" value="http://127.0.0.1:9004/api/base/config" enable="true" remarks="通用地址配置"/>
-        <item id="3" modify_time="2025-06-23 16:12:40" key="3" value="http://127.0.0.1:9004/api/base/regex_type" enable="true" remarks="单号规则地址配置"/>
-        <item id="4" modify_time="2025-06-23 16:12:40" key="4" value="http://127.0.0.1:9004/api/upload/sync" enable="true" remarks="操作量地址配置"/>
-        <item id="5" modify_time="2025-06-23 16:12:40" key="5" value="600" enable="true" remarks="小车节距"/>
-        <item id="6" modify_time="2025-06-23 16:12:40" key="6" value="1" enable="true" remarks="是否开启上传"/>
-    </general>
-    <sync/>
+    <drop_config>
+        <item id="1" modify_time="2025-06-25 15:37:41" type="0" name="正常" enable="true" remarks="正常落格"/>
+        <item id="2" modify_time="2025-06-25 15:37:41" type="1" name="无方案" enable="true" remarks="无方案"/>
+        <item id="3" modify_time="2025-06-25 15:37:41" type="2" name="超圈" enable="true" remarks="超圈"/>
+        <item id="4" modify_time="2025-06-25 15:37:41" type="3" name="无格口" enable="true" remarks="无格口"/>
+        <item id="5" modify_time="2025-06-25 15:37:41" type="4" name="小车错误" enable="true" remarks="小车错误"/>
+        <item id="6" modify_time="2025-06-25 15:37:41" type="5" name="重量错误" enable="true" remarks="重量错误"/>
+        <item id="7" modify_time="2025-06-25 15:37:41" type="6" name="wcs无响应" enable="true" remarks="wcs无响应"/>
+        <item id="8" modify_time="2025-06-25 15:37:41" type="7" name="漏分拣检测" enable="true" remarks="漏分拣检测"/>
+        <item id="9" modify_time="2025-06-25 15:37:41" type="8" name="未知异常" enable="true" remarks="未知异常"/>
+    </drop_config>
+    <general_config>
+        <item id="1" modify_time="2025-06-25 15:37:44" key="1" value="http://127.0.0.1:9004/api/base/drop_type" enable="true" remarks="落格类型地址配置"/>
+        <item id="2" modify_time="2025-06-25 15:37:45" key="2" value="http://127.0.0.1:9004/api/base/config" enable="true" remarks="通用地址配置"/>
+        <item id="3" modify_time="2025-06-25 15:37:45" key="3" value="http://127.0.0.1:9004/api/base/regex_type" enable="true" remarks="单号规则地址配置"/>
+        <item id="4" modify_time="2025-06-25 15:37:45" key="4" value="http://127.0.0.1:9004/api/upload/sync" enable="true" remarks="操作量地址配置"/>
+        <item id="5" modify_time="2025-06-25 15:37:45" key="5" value="600" enable="true" remarks="小车节距"/>
+        <item id="6" modify_time="2025-06-25 15:37:45" key="6" value="1" enable="true" remarks="是否开启上传"/>
+    </general_config>
+    <regex_config>
+        <item id="1" modify_time="2025-06-25 15:37:48" type="0" name="未知" regex="" enable="true" remarks="未知"/>
+        <item id="2" modify_time="2025-06-25 15:37:48" type="1" name="圆通" regex="^YT[0-9]{10,20}$" enable="true" remarks="圆通"/>
+        <item id="3" modify_time="2025-06-25 15:37:48" type="2" name="中通" regex="^ZT[0-9]{10,20}$" enable="true" remarks="中通"/>
+        <item id="4" modify_time="2025-06-25 15:37:48" type="3" name="申通" regex="^ST[0-9]{10,20}$" enable="true" remarks="申通"/>
+        <item id="5" modify_time="2025-06-25 15:37:48" type="4" name="韵达" regex="^YD[0-9]{10,20}$" enable="true" remarks="韵达"/>
+        <item id="6" modify_time="2025-06-25 15:37:48" type="5" name="极兔" regex="^JT[0-9]{10,20}$" enable="true" remarks="极兔"/>
+    </regex_config>
+    <sync_config/>
+    <user_config>
+        <item id="1" modify_time="2025-06-25 15:28:46" name="管理员" code="admin" password="123456" enable="true" remarks="管理员"/>
+    </user_config>
 </root>

+ 1 - 1
src/config/nexus_net_config.xml

@@ -3,7 +3,7 @@
 	<!-- 身份 -->
 	<user>
 		<!-- 节点配置 name:节点名称 code:用户代码  password:密码 -->
-		<item name="授权服务" code="authorize_service" password="123456" enable="true" remarks="身份信息"/>
+		<item name="数据同步服务" code="sync_service" password="123456" enable="true" remarks="身份信息"/>
 	</user>
 	<!-- 日志 -->
 	<logger>

+ 6 - 2
src/config/nexus_net_xml_config.xml

@@ -1,14 +1,18 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- name:app名称,client:客户端数量,ip:ip地址,port:端口号 -->
-<nexusnet name="car_service" client="1" ip="127.0.0.1" port="10001" logger="" enable="true">
+<nexusnet name="sync_service" client="1" ip="127.0.0.1" port="10001" logger="" enable="true">
 	<!-- 订阅 -->
 	<subscribe>
+		<!-- key:查询KEY,group:事件分组,name:事件名称,remarks:备注 -->
+		<item key="local_stepping" group="local" name="stepping" enable="true" remarks="步进"/>
+		<item key="local_supply" group="local" name="supply" enable="true" remarks="供包"/>
+		<item key="local_drop" group="local" name="drop" enable="true" remarks="落格"/>
 	</subscribe>
 	<!-- 发布 -->
 	<publisher>
 		<!-- key:查询KEY,node:节点名称,app:app名称,group:事件分组,name:事件名称,type:发布类型1所有 2当前节点 3指定节点APP,remarks:备注 -->
 		<list key="local_sync_requset">
-			<item node="" app="" group="local" name="authorize" type="1" enable="true" remarks="授权发送"/>
+			<item node="" app="" group="local" name="authorize" type="1" enable="true" remarks="售后发送"/>
 		</list>
 	</publisher>
 </nexusnet>

+ 43 - 40
src/core/core.hpp

@@ -5,7 +5,7 @@
 #include <robotics/timer.hpp>
 #include <robotics/message_bus.hpp>
 //local
-#include "xml/xml_config.hpp"
+#include "../xml/xml_update.hpp"
 #include "../network/network.hpp"
 
 using namespace robotics;
@@ -29,7 +29,6 @@ public:
 		network_->local_stepping_event.bind(&core::on_local_stepping, this);
 		network_->local_supply_event.bind(&core::on_local_supply, this);
 		network_->local_drop_event.bind(&core::on_local_drop, this);
-		network_->local_speed_event.bind(&core::on_local_speed, this);
 	}
 	/**
 	 * @brief 析构函数,用于销毁 core 对象并在销毁前调用 stop() 方法。
@@ -41,6 +40,7 @@ public:
 	 * @brief 启动定时器,设置为10分钟后触发。
 	 */
 	void start() {
+		network_->start();
 		timer_.start(1000 * 60 * 10);
 	}
 	/**
@@ -48,6 +48,7 @@ public:
 	 */
 	void stop() {
 		timer_.stop();
+		network_->stop();
 	}
 private:
 	/**
@@ -55,7 +56,7 @@ private:
 	 */
 	void on_sync_drop_request() {
 		auto values = network_->sync_drop_request();
-		xml_config::update(values);
+		xml_update::update(values);
 	}
 	/**
 	 * @brief 根据给定的键发起同步请求,并用返回的数据更新XML配置。
@@ -63,14 +64,14 @@ private:
 	 */
 	void on_sync_general_request(int key) {
 		auto values = network_->sync_general_request(key);
-		xml_config::update(values);
+		xml_update::update(values);
 	}
 	/**
 	 * @brief 同步正则表达式请求并更新配置。
 	 */
 	void on_sync_regex_request() {
 		auto values = network_->sync_regex_request();
-		xml_config::update(values);
+		xml_update::update(values);
 	}
 private:
 	/**
@@ -78,21 +79,21 @@ private:
 	 * @param values 包含 web_drop_config_info 对象的常量引用向量,表示要更新的配置信息。
 	 */
 	void on_cloud_drop_response(std::vector<web_drop_config_info>const& values) {
-		xml_config::update(values);
+		xml_update::update(values);
 	}
 	/**
 	 * @brief 处理云端通用响应并更新本地配置。
 	 * @param values 包含 web_general_config_info 对象的常量引用向量,表示从云端接收到的配置信息。
 	 */
 	void on_cloud_general_response(std::vector<web_general_config_info>const& values) {
-		xml_config::update(values);
+		xml_update::update(values);
 	}
 	/**
 	 * @brief 处理云端正则表达式响应并更新本地配置。
 	 * @param values 包含正则表达式配置信息的常量引用向量。
 	 */
 	void on_cloud_regex_response(std::vector<web_regex_config_info>const& values) {
-		xml_config::update(values);
+		xml_update::update(values);
 	}
 private:
 	/**
@@ -120,24 +121,19 @@ private:
 		}
 	}
 	/**
-	 * @brief 本地步进时调用的回调函数。
+	 * @brief 在本地步进事件发生时,更新同步数据的运行距离。
+	 * @param speed 当前步进的速度。
+	 * @param lineNo 相关的行号。
 	 */
-	void on_local_stepping() {
+	void on_local_stepping(double speed, int lineNo) {
 		auto config = xml_context::from<web_general_config_info>().where([](auto it) {return it->enable && it->key == 5; }).first();
 		if (!config) {
 			config.reset(new web_general_config_info());
 			config->value = "600";
 		}
-		std::lock_guard<std::mutex> locker(mutex_);
-		sync_data_.running_distance += std::atoi(config->value.c_str());
-	}
-	/**
-	 * @brief 设置本地速度值,并使用互斥锁保护同步数据的访问。
-	 * @param speed 要设置的速度值。
-	 */
-	void on_local_speed(int speed) {
 		std::lock_guard<std::mutex> locker(mutex_);
 		sync_data_.speed = speed;
+		sync_data_.running_distance += std::atoi(config->value.c_str());
 	}
 private:
 	/**
@@ -271,30 +267,37 @@ private:
 		timer_.set_timer_interval(1000 * 60 * std::atoi(config->value.c_str()));
 		std::lock_guard<std::mutex> locker(mutex_);
 		try {
-			if (!network_->sync_request(sync_data_)) {
-				std::vector<web_sync_config_info> add_datas;
-				for (auto& it : sync_data_.data) {
-					int id = 0;
-					xml_context::from<web_sync_config_info>().max(id, [](auto it) {return it->id; }).inc(id);
-					add_datas.push_back(web_sync_config_info{
-							.id = id,
-							.create_time = v3::datetime::current_time_stamp(),
-							.device_id = sync_data_.device_id,
-							.summary_time = sync_data_.summary_time,
-							.running_distance = sync_data_.running_distance,
-							.speed = sync_data_.speed,
-							.express_type = it.express_type,
-							.lattice_count = it.lattice_count,
-							.supply_count = it.supply_count,
-							.reflux_count = it.reflux_count,
-							.supply_summay = it.supply_summay,
-							.lattice_summay = it.lattice_summay,
-							.reflux_summay = it.reflux_summay,
-							.enable = true,
-							.remarks = "未上传"});
+			if (sync_data_.running_distance != 0 || sync_data_.speed != 0 || sync_data_.data.size() != 0) {
+				sync_data_.summary_time = v3::datetime::current_time_stamp();
+				if (!network_->sync_request(sync_data_)) {
+					std::vector<web_sync_config_info> add_datas;
+					for (auto& it : sync_data_.data) {
+						int id = 0;
+						xml_context::from<web_sync_config_info>().max(id, [](auto it) {return it->id; }).inc(id);
+						add_datas.push_back(web_sync_config_info{
+								.id = id,
+								.create_time = v3::datetime::current_time_stamp(),
+								.device_id = sync_data_.device_id,
+								.summary_time = sync_data_.summary_time,
+								.running_distance = sync_data_.running_distance,
+								.speed = sync_data_.speed,
+								.express_type = it.express_type,
+								.lattice_count = it.lattice_count,
+								.supply_count = it.supply_count,
+								.reflux_count = it.reflux_count,
+								.supply_summay = it.supply_summay,
+								.lattice_summay = it.lattice_summay,
+								.reflux_summay = it.reflux_summay,
+								.enable = true,
+								.remarks = "未上传" });
+					}
+					xml_context::from<web_sync_config_info>().append(add_datas).submit();
 				}
-				xml_context::from<web_sync_config_info>().append(add_datas).submit();
 			}
+			sync_data_.running_distance = 0;
+			sync_data_.speed = 0;
+			sync_data_.summary_time = (time_t)0;
+			sync_data_.data.clear();
 		}
 		catch (std::exception const& ec) {
 			LOG_ERROR << ec;

+ 1 - 1
src/models/web_drop_config_info.h

@@ -24,7 +24,7 @@ using namespace robotics;
 /**
  * @brief Web投递点配置结构体,包含投递点的配置信息如类型、名称、启用状态等。
  */
-struct web_drop_config_info
+struct [[SqlTable("drop_config")]] web_drop_config_info
 {
 	/**
 	 * @brief 配置项唯一编号

+ 44 - 0
src/models/web_drop_request_v1_info.h

@@ -0,0 +1,44 @@
+#pragma once
+//stl
+#include <iostream>
+//robotics
+#include <robotics/datetime.hpp>
+
+using namespace robotics;
+
+/* ************************************************
+* 作者:Lenovo
+* 时间:2024/6/3 21:14:08
+* 机器名:DESKTOP-4I13MDL
+* 实体类名:web_drop_request_v1_info
+* 数据库表名 				[[SqlTable("xxx")]]
+* 不生成反射 				[[NoReflect]]
+* Json字段名 			[[Json("xxx")]]
+* 不生成Json字段 			[[NoJson(true)]]
+* Sql字段名  			[[Sql("xxx")]]
+* 不生成Sql字段 			[[NoSql(true)]]
+* Excel字段名			[[Excel("xxx")]]
+* 不生成Excel字段 		[[NoExcel(true)]]
+* *************************************************/
+
+/**
+ * @brief 表示一个用于 Web 投递请求的结构体,包含导出编号和投递结果类型。
+ */
+struct web_drop_request_v1_info
+{
+	/**
+	 * @brief 表示运单号字段,并通过Json注解指定序列化时的字段名为"waybillNo"。
+	 */
+	[[Json("waybillNo")]]
+	std::string waybill_no;
+	/**
+	 * @brief 定义并初始化一个名为 lattice_no 的整数变量,并应用 Json("exportNo") 属性进行序列化映射。
+	 */
+	[[Json("exportNo")]]
+	int lattice_no = 0;
+	/**
+	 * @brief 表示一个名为 type 的整数变量,并初始化为 0。
+	 */
+	[[Json("dropResultType")]]
+	int type = 0;
+};

+ 1 - 1
src/models/web_general_config_info.h

@@ -24,7 +24,7 @@ using namespace robotics;
 /**
  * @brief Web通用配置结构体,包含通用配置信息如类型、名称、正则表达式等。
  */
-struct web_general_config_info
+struct [[SqlTable("general_config")]] web_general_config_info
 {
 	/**
 	 * @brief 配置项唯一编号

+ 1 - 1
src/models/web_regex_config_info.h

@@ -24,7 +24,7 @@ using namespace robotics;
 /**
  * @brief Web正则配置结构体,包含快递类型、快递名称及正则表达式。
  */
-struct web_regex_config_info
+struct [[SqlTable("regex_config")]] web_regex_config_info
 {
 	/**
 	 * @brief 配置项唯一编号

+ 38 - 0
src/models/web_stepping_request_v1_info.h

@@ -0,0 +1,38 @@
+#pragma once
+//stl
+#include <iostream>
+//robotics
+#include <robotics/datetime.hpp>
+
+using namespace robotics;
+
+/* ************************************************
+* 作者:Lenovo
+* 时间:2024/6/3 21:14:08
+* 机器名:DESKTOP-4I13MDL
+* 实体类名:web_stepping_request_v1_info
+* 数据库表名 				[[SqlTable("xxx")]]
+* 不生成反射 				[[NoReflect]]
+* Json字段名 			[[Json("xxx")]]
+* 不生成Json字段 			[[NoJson(true)]]
+* Sql字段名  			[[Sql("xxx")]]
+* 不生成Sql字段 			[[NoSql(true)]]
+* Excel字段名			[[Excel("xxx")]]
+* 不生成Excel字段 		[[NoExcel(true)]]
+* *************************************************/
+
+/**
+ * @brief 表示网络步进请求的结构体,包含层号和速度信息。
+ */
+struct web_stepping_request_v1_info
+{
+	/**
+	 * @brief 表示层号的整数变量。
+	 */
+	[[Json("layerNo")]]
+	int layer_no = 0;
+	/**
+	 * @brief 表示速度的变量。
+	 */
+	double speed = 0;
+};

+ 39 - 0
src/models/web_supply_request_v1_info.h

@@ -0,0 +1,39 @@
+#pragma once
+//stl
+#include <iostream>
+//robotics
+#include <robotics/datetime.hpp>
+
+using namespace robotics;
+
+/* ************************************************
+* 作者:Lenovo
+* 时间:2024/6/3 21:14:08
+* 机器名:DESKTOP-4I13MDL
+* 实体类名:web_supply_request_v1_info
+* 数据库表名 				[[SqlTable("xxx")]]
+* 不生成反射 				[[NoReflect]]
+* Json字段名 			[[Json("xxx")]]
+* 不生成Json字段 			[[NoJson(true)]]
+* Sql字段名  			[[Sql("xxx")]]
+* 不生成Sql字段 			[[NoSql(true)]]
+* Excel字段名			[[Excel("xxx")]]
+* 不生成Excel字段 		[[NoExcel(true)]]
+* *************************************************/
+
+/**
+ * @brief 表示一个包含运单号和供应编号的结构体,并为其成员指定自定义的 JSON 序列化名称。
+ */
+struct web_supply_request_v1_info
+{
+	/**
+	 * @brief 运单号字段,使用自定义的 JSON 序列化名称。
+	 */
+	[[Json("waybillNo")]]
+	std::string waybill_no;
+	/**
+	 * @brief 表示供应编号的整数变量。
+	 */
+	[[Json("supplyNo")]]
+	int supply_no = 0;
+};

+ 1 - 1
src/models/web_sync_config_info.h

@@ -24,7 +24,7 @@ using namespace robotics;
 /**
  * @brief Web同步数据配置结构体,包含设备、统计、快递等相关配置信息。
  */
-struct web_sync_config_info
+struct [[SqlTable("sync_config")]] web_sync_config_info
 {
 	/**
 	 * @brief 配置项唯一编号

+ 1 - 1
src/models/web_sync_request_info.h

@@ -38,7 +38,7 @@ struct web_sync_request_info
 	/**
 	 * @brief 数据汇总时间
 	 */
-	[[Json("deviceId")]]
+	[[Json("summaryTime")]]
 	v3::datetime summary_time;
 
 	/**

+ 5 - 5
src/models/web_user_config_info.h

@@ -12,16 +12,16 @@ using namespace robotics;
 * 时间:2024/6/3 21:14:08
 * 机器名:DESKTOP-4I13MDL
 * 实体类名:web_message_info
-* 数据库表名 			[[SqlTable("xxx")]]
-* 不生成反射 			[[NoReflect]]
+* 数据库表名 				[[SqlTable("xxx")]]
+* 不生成反射 				[[NoReflect]]
 * Json字段名 			[[Json("xxx")]]
-* 不生成Json字段 		[[NoJson(true)]]
+* 不生成Json字段 			[[NoJson(true)]]
 * Sql字段名  			[[Sql("xxx")]]
-* 不生成Sql字段 		[[NoSql(true)]]
+* 不生成Sql字段 			[[NoSql(true)]]
 * Excel字段名			[[Excel("xxx")]]
 * 不生成Excel字段 		[[NoExcel(true)]]
 * *************************************************/
-struct [[SqlTable("web_user_config")]] web_user_config_info
+struct [[SqlTable("user_config")]] web_user_config_info
 {
 	/**
 	 * @brief id

+ 4 - 4
src/network/http_network.hpp

@@ -122,7 +122,7 @@ public:
 		auto config = xml_context::from<web_general_config_info>().where([](auto it) {return it->enable && it->key == 1; }).first();
 		if (!config) {
 			config.reset(new web_general_config_info());
-			config->value = "http://127.0.0.1:8002/api/base/drop_type";
+			config->value = "http://127.0.0.1:9004/api/base/drop_type";
 		}
 		LOG_INFO << "Url:" << config->value;
 		return request<utils::http_type_enum::get, web_response_info<web_drop_config_info>>(config->value);
@@ -136,7 +136,7 @@ public:
 		auto config = xml_context::from<web_general_config_info>().where([](auto it) {return it->enable && it->key == 2; }).first();
 		if (!config) {
 			config.reset(new web_general_config_info());
-			config->value = "http://127.0.0.1:8002/api/base/config";
+			config->value = "http://127.0.0.1:9004/api/base/config";
 		}
 		std::string url = config->value + "?key=" + std::to_string(key);
 		LOG_INFO << "Url:" << url;
@@ -151,7 +151,7 @@ public:
 		auto config = xml_context::from<web_general_config_info>().where([](auto it) {return it->enable && it->key == 3; }).first();
 		if (!config) {
 			config.reset(new web_general_config_info());
-			config->value = "http://127.0.0.1:8002/api/base/regex_type";
+			config->value = "http://127.0.0.1:9004/api/base/regex_type";
 		}
 		LOG_INFO << "Url:" << config->value;
 		return request<utils::http_type_enum::get, web_response_info<web_regex_config_info>>(config->value);
@@ -165,7 +165,7 @@ public:
 		auto config = xml_context::from<web_general_config_info>().where([](auto it) {return it->enable && it->key == 4; }).first();
 		if (!config) {
 			config.reset(new web_general_config_info());
-			config->value = "http://127.0.0.1:8002/api/upload/sync";
+			config->value = "http://127.0.0.1:9004/api/upload/sync";
 		}
 		LOG_INFO << "Url:" << config->value;
 		return request<utils::http_type_enum::post, web_message_info>(config->value, data);

+ 45 - 45
src/network/network.hpp

@@ -8,6 +8,9 @@
 #include "nexus_net_network_v2.hpp"
 #include "http_network.hpp"
 #include "../models/web_sync_request_info.h"
+#include "../models/web_drop_request_v1_info.h"
+#include "../models/web_stepping_request_v1_info.h"
+#include "../models/web_supply_request_v1_info.h"
 
 /**
  * @brief network 类用于管理和协调多种网络组件,支持网络服务的启动、停止、云端同步、授权处理及事件分发等功能。该类实现了单例模式,确保全局仅有一个 network 实例。
@@ -53,22 +56,12 @@ public:
 	 * @brief 执行同步授权操作的回调函数。
 	 */
 	std::vector<web_drop_config_info> sync_drop_request() {
-		std::vector<web_drop_config_info> result;
 		auto response = http_network_->request_drop();
 		LOG_INFO << "msg:" << response.msg << " code:" << response.code << " count:" << response.count;
 		if (response.data.empty()) {
 			throw std::runtime_error("没有返回数据.");
 		}
-		for (auto& it : response.data) {
-			result.push_back(web_drop_config_info{ 
-				.id = 0,
-				.modify_time = v3::datetime::current_time_stamp(),
-				.type = it.type,
-				.name = it.name,
-				.enable = it.enable,
-				.remarks = it.remarks });
-		}
-		return result;
+		return response.data;
 	}
 	/**
 	 * @brief 根据指定的键发起通用请求,并返回结果数据列表。
@@ -88,23 +81,12 @@ public:
 	 * @return 包含所有正则表达式配置信息的 std::vector<web_regex_config_info>。如果未返回数据,则抛出 std::runtime_error 异常。
 	 */
 	std::vector<web_regex_config_info> sync_regex_request() {
-		std::vector<web_regex_config_info> result;
 		auto response = http_network_->request_regex();
 		LOG_INFO << "msg:" << response.msg << " code:" << response.code << " count:" << response.count;
 		if (response.data.empty()) {
 			throw std::runtime_error("没有返回数据.");
 		}
-		for (auto& it : response.data) {
-			result.push_back(web_regex_config_info{ 
-				.id = 0,
-				.modify_time = v3::datetime::current_time_stamp(),
-				.type = it.type,
-				.name = it.name,
-				.regex = it.regex,
-				.enable = it.enable,
-				.remarks = it.remarks });
-		}
-		return result;
+		return response.data;
 	}
 	/**
 	 * @brief 同步处理一个网络请求。
@@ -131,7 +113,7 @@ public:
 	/**
 	 * @brief 表示一个不带参数的事件委托对象。
 	 */
-	v3::delegates<>												local_stepping_event;
+	v3::delegates<double, int>									local_stepping_event;
 	/**
 	 * @brief 本地供应事件的委托对象,用于处理带有整数和常量字符串引用参数的事件回调。
 	 */
@@ -140,10 +122,6 @@ public:
 	 * @brief 表示一个可用于本地拖放事件的委托对象,接受两个整数和一个常量字符串引用作为参数。
 	 */
 	v3::delegates<int, int, std::string const&>					local_drop_event;
-	/**
-	 * @brief 本地速度事件的委托对象,用于管理和分发与速度相关的回调函数。
-	 */
-	v3::delegates<int>											local_speed_event;
 private:
 	/**
 	 * @brief network 构造函数,初始化网络相关组件并绑定事件处理函数。
@@ -157,13 +135,17 @@ private:
 		nexus_net_v1_->authorized_event.bind(&network::on_authorized_v1, this);
 		nexus_net_v2_->authorized_event.bind(&network::on_authorized_v2, this);
 
+		nexus_net_v1_->bind("local_stepping", &network::on_local_stepping_v1_response, this);
+		nexus_net_v1_->bind("local_supply", &network::on_local_supply_v1_response, this);
+		nexus_net_v1_->bind("local_drop", &network::on_local_drop_v1_response, this);
+
+
 		nexus_net_v2_->bind("cloud_drop", &network::on_cloud_drop_response, this);
 		nexus_net_v2_->bind("cloud_general", &network::on_cloud_general_response, this);
 		nexus_net_v2_->bind("cloud_regex", &network::on_cloud_regex_response, this);
-		nexus_net_v2_->bind("local_stepping", &network::on_local_stepping_response, this);
-		nexus_net_v2_->bind("local_supply", &network::on_local_supply_response, this);
-		nexus_net_v2_->bind("local_drop", &network::on_local_drop_response, this);
-		nexus_net_v2_->bind("local_speed", &network::on_local_speed_response, this);
+		nexus_net_v2_->bind("local_stepping", &network::on_local_stepping_v2_response, this);
+		nexus_net_v2_->bind("local_supply", &network::on_local_supply_v2_response, this);
+		nexus_net_v2_->bind("local_drop", &network::on_local_drop_v2_response, this);
 	}
 private:
 	/**
@@ -212,19 +194,21 @@ private:
 		}
 	}
 	/**
-	 * @brief 处理排序器步进响应的回调函数。
+	 * @brief 处理本地步进响应事件。
+	 * @param speed 步进的速度值。
+	 * @param lineNo 相关的代码行号。
 	 */
-	void on_local_stepping_response() {
-		REGISTER_ASYNC_FUNC(on_local_stepping_response);
-		local_stepping_event();
+	void on_local_stepping_v2_response(double speed,int lineNo) {
+		REGISTER_ASYNC_FUNC(on_local_stepping_v2_response, speed, lineNo);
+		local_stepping_event(speed, lineNo);
 	}
 	/**
 	 * @brief 处理本地供应响应的回调函数。
 	 * @param supply_no 供应编号,用于标识本地供应请求。
 	 * @param waybill_no 运单号,表示相关的物流单号。
 	 */
-	void on_local_supply_response(int supply_no, std::string const& waybill_no) {
-		REGISTER_ASYNC_FUNC(on_local_supply_response, supply_no, waybill_no);
+	void on_local_supply_v2_response(int supply_no, std::string const& waybill_no) {
+		REGISTER_ASYNC_FUNC(on_local_supply_v2_response, supply_no, waybill_no);
 		local_supply_event(supply_no, waybill_no);
 	}
 	/**
@@ -233,17 +217,33 @@ private:
 	 * @param drop_type 投递类型,指示投递的方式或类型。
 	 * @param waybill_no 运单号,表示相关包裹的唯一标识。
 	 */
-	void on_local_drop_response(int lattice_no, int drop_type, std::string const& waybill_no) {
-		REGISTER_ASYNC_FUNC(on_local_drop_response, lattice_no, drop_type, waybill_no);
+	void on_local_drop_v2_response(int lattice_no, int drop_type, std::string const& waybill_no) {
+		REGISTER_ASYNC_FUNC(on_local_drop_v2_response, lattice_no, drop_type, waybill_no);
 		local_drop_event(lattice_no, drop_type, waybill_no);
 	}
 	/**
-	 * @brief 处理本地速度响应的回调函数。
-	 * @param speed 本地速度值。
+	 * @brief 处理本地步进响应的回调函数。
+	 * @param value 包含步进请求信息的 web_stepping_request_v1_info 对象。
+	 */
+	void on_local_stepping_v1_response(web_stepping_request_v1_info value) {
+		REGISTER_ASYNC_FUNC(on_local_stepping_v1_response, value);
+		local_stepping_event(value.speed, value.layer_no);
+	}
+	/**
+	 * @brief 处理本地供应响应的回调函数。
+	 * @param value 包含供应请求信息的 web_supply_request_v1_info 对象。
+	 */
+	void on_local_supply_v1_response(web_supply_request_v1_info value) {
+		REGISTER_ASYNC_FUNC(on_local_supply_v1_response, value);
+		local_supply_event(value.supply_no, value.waybill_no);
+	}
+	/**
+	 * @brief 处理本地投递响应的回调函数。
+	 * @param value 包含投递请求信息的 web_drop_request_v1_info 对象。
 	 */
-	void on_local_speed_response(int speed) {
-		REGISTER_ASYNC_FUNC(on_local_speed_response, speed);
-		local_speed_event(speed);
+	void on_local_drop_v1_response(web_drop_request_v1_info value) {
+		REGISTER_ASYNC_FUNC(on_local_drop_v1_response, value);
+		local_drop_event(value.lattice_no, value.type, value.waybill_no);
 	}
 private:
 	/**

+ 42 - 39
src/reflect.h

@@ -1,12 +1,15 @@
-//生成时间:2025-06-23 13:48:12
+//生成时间:2025-06-25 16:33:16
 #pragma once
 #include <rttr/registration>
 #include <robotics/logger.hpp>
 #include "models/web_drop_config_info.h"
+#include "models/web_drop_request_v1_info.h"
 #include "models/web_general_config_info.h"
 #include "models/web_message_info.h"
 #include "models/web_regex_config_info.h"
 #include "models/web_response_info.h"
+#include "models/web_stepping_request_v1_info.h"
+#include "models/web_supply_request_v1_info.h"
 #include "models/web_sync_config_info.h"
 #include "models/web_sync_item_request_info.h"
 #include "models/web_sync_request_info.h"
@@ -19,8 +22,8 @@
 #include "controllers/sync.hpp"
 #include "controllers/user.hpp"
 
-static void func_d570f491d35dc9cbebec1426298cd8bc() {
-	rttr::registration::class_<struct web_drop_config_info>("web_drop_config_info").constructor<>()(rttr::detail::as_object{}).
+static void func_60e43868d746dfb87d107a85d1139593() {
+	rttr::registration::class_<struct web_drop_config_info>("drop_config").constructor<>()(rttr::detail::as_object{}).
 		property("id",&web_drop_config_info::id)(rttr::metadata("Json","id"),rttr::metadata("Sql","id"),rttr::metadata("Excel",R"(id)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_drop_config_info::id))).
 		property("modify_time",&web_drop_config_info::modify_time)(rttr::metadata("Json","modify_time"),rttr::metadata("Sql","modify_time"),rttr::metadata("Excel",R"(modify_time)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_drop_config_info::modify_time))).
 		property("type",&web_drop_config_info::type)(rttr::metadata("Json","type"),rttr::metadata("Sql","type"),rttr::metadata("Excel",R"(type)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_drop_config_info::type))).
@@ -28,8 +31,8 @@ static void func_d570f491d35dc9cbebec1426298cd8bc() {
 		property("enable",&web_drop_config_info::enable)(rttr::metadata("Json","enable"),rttr::metadata("Sql","enable"),rttr::metadata("Excel",R"(enable)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_drop_config_info::enable))).
 		property("remarks",&web_drop_config_info::remarks)(rttr::metadata("Json","remarks"),rttr::metadata("Sql","remarks"),rttr::metadata("Excel",R"(remarks)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_drop_config_info::remarks)));
 }
-static void func_b25b3ec2cb68a264fa80f208c4fc49aa() {
-	rttr::registration::class_<struct web_general_config_info>("web_general_config_info").constructor<>()(rttr::detail::as_object{}).
+static void func_1c9c3c04b58df9f07b42ab8ce1266014() {
+	rttr::registration::class_<struct web_general_config_info>("general_config").constructor<>()(rttr::detail::as_object{}).
 		property("id",&web_general_config_info::id)(rttr::metadata("Json","id"),rttr::metadata("Sql","id"),rttr::metadata("Excel",R"(id)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_general_config_info::id))).
 		property("modify_time",&web_general_config_info::modify_time)(rttr::metadata("Json","modify_time"),rttr::metadata("Sql","modify_time"),rttr::metadata("Excel",R"(modify_time)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_general_config_info::modify_time))).
 		property("key",&web_general_config_info::key)(rttr::metadata("Json","key"),rttr::metadata("Sql","key"),rttr::metadata("Excel",R"(key)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_general_config_info::key))).
@@ -37,13 +40,13 @@ static void func_b25b3ec2cb68a264fa80f208c4fc49aa() {
 		property("enable",&web_general_config_info::enable)(rttr::metadata("Json","enable"),rttr::metadata("Sql","enable"),rttr::metadata("Excel",R"(enable)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_general_config_info::enable))).
 		property("remarks",&web_general_config_info::remarks)(rttr::metadata("Json","remarks"),rttr::metadata("Sql","remarks"),rttr::metadata("Excel",R"(remarks)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_general_config_info::remarks)));
 }
-static void func_93a139474e9ed908ef7ca61879e90f0d() {
+static void func_ffdf7c65663c0db574213e658e55589e() {
 	rttr::registration::class_<struct web_message_info>("web_message_info").constructor<>()(rttr::detail::as_object{}).
 		property("success",&web_message_info::success)(rttr::metadata("Json","success"),rttr::metadata("Sql","success"),rttr::metadata("Excel",R"(success)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_message_info::success))).
 		property("message",&web_message_info::message)(rttr::metadata("Json","message"),rttr::metadata("Sql","message"),rttr::metadata("Excel",R"(message)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_message_info::message)));
 }
-static void func_b7ff0396ed1c36af5786e42c15c8241d() {
-	rttr::registration::class_<struct web_regex_config_info>("web_regex_config_info").constructor<>()(rttr::detail::as_object{}).
+static void func_dcbbdbbc5862dd318e03528101b7dcda() {
+	rttr::registration::class_<struct web_regex_config_info>("regex_config").constructor<>()(rttr::detail::as_object{}).
 		property("id",&web_regex_config_info::id)(rttr::metadata("Json","id"),rttr::metadata("Sql","id"),rttr::metadata("Excel",R"(id)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_regex_config_info::id))).
 		property("modify_time",&web_regex_config_info::modify_time)(rttr::metadata("Json","modify_time"),rttr::metadata("Sql","modify_time"),rttr::metadata("Excel",R"(modify_time)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_regex_config_info::modify_time))).
 		property("type",&web_regex_config_info::type)(rttr::metadata("Json","type"),rttr::metadata("Sql","type"),rttr::metadata("Excel",R"(type)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_regex_config_info::type))).
@@ -52,7 +55,7 @@ static void func_b7ff0396ed1c36af5786e42c15c8241d() {
 		property("enable",&web_regex_config_info::enable)(rttr::metadata("Json","enable"),rttr::metadata("Sql","enable"),rttr::metadata("Excel",R"(enable)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_regex_config_info::enable))).
 		property("remarks",&web_regex_config_info::remarks)(rttr::metadata("Json","remarks"),rttr::metadata("Sql","remarks"),rttr::metadata("Excel",R"(remarks)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_regex_config_info::remarks)));
 }
-static void func_8b6c840c4d2b8c9712c820ad6af7b43d() {
+static void func_a910478f09954b5d13472b82cc52c3d7() {
 	rttr::registration::class_<struct web_response_info<web_drop_config_info>>("web_response_info<web_drop_config_info>").constructor<>()(rttr::detail::as_object{}).
 		property("code",&web_response_info<web_drop_config_info>::code)(rttr::metadata("Json","code"),rttr::metadata("Sql","code"),rttr::metadata("Excel",R"(code)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_response_info<web_drop_config_info>::code))).
 		property("msg",&web_response_info<web_drop_config_info>::msg)(rttr::metadata("Json","msg"),rttr::metadata("Sql","msg"),rttr::metadata("Excel",R"(msg)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_response_info<web_drop_config_info>::msg))).
@@ -79,8 +82,8 @@ static void func_8b6c840c4d2b8c9712c820ad6af7b43d() {
 		property("count",&web_response_info<web_user_config_info>::count)(rttr::metadata("Json","count"),rttr::metadata("Sql","count"),rttr::metadata("Excel",R"(count)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_response_info<web_user_config_info>::count))).
 		property("data",&web_response_info<web_user_config_info>::data)(rttr::metadata("Json","data"),rttr::metadata("Sql","data"),rttr::metadata("Excel",R"(data)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_response_info<web_user_config_info>::data)));
 }
-static void func_6ab45bf43a33b47de841d49550cfea18() {
-	rttr::registration::class_<struct web_sync_config_info>("web_sync_config_info").constructor<>()(rttr::detail::as_object{}).
+static void func_6baefae625d9812559c6678ad70638d3() {
+	rttr::registration::class_<struct web_sync_config_info>("sync_config").constructor<>()(rttr::detail::as_object{}).
 		property("id",&web_sync_config_info::id)(rttr::metadata("Json","id"),rttr::metadata("Sql","id"),rttr::metadata("Excel",R"(id)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_config_info::id))).
 		property("create_time",&web_sync_config_info::create_time)(rttr::metadata("Json","create_time"),rttr::metadata("Sql","create_time"),rttr::metadata("Excel",R"(create_time)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_config_info::create_time))).
 		property("device_id",&web_sync_config_info::device_id)(rttr::metadata("Json","device_id"),rttr::metadata("Sql","device_id"),rttr::metadata("Excel",R"(device_id)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_config_info::device_id))).
@@ -97,7 +100,7 @@ static void func_6ab45bf43a33b47de841d49550cfea18() {
 		property("enable",&web_sync_config_info::enable)(rttr::metadata("Json","enable"),rttr::metadata("Sql","enable"),rttr::metadata("Excel",R"(enable)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_config_info::enable))).
 		property("remarks",&web_sync_config_info::remarks)(rttr::metadata("Json","remarks"),rttr::metadata("Sql","remarks"),rttr::metadata("Excel",R"(remarks)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_config_info::remarks)));
 }
-static void func_6539ece46bdddf5948752ffca059661e() {
+static void func_ee557dbb99355b7a1a7078ab543a3a63() {
 	rttr::registration::class_<struct web_sync_item_request_info>("web_sync_item_request_info").constructor<>()(rttr::detail::as_object{}).
 		property("express_type",&web_sync_item_request_info::express_type)(rttr::metadata("Json","expressType"),rttr::metadata("Sql","express_type"),rttr::metadata("Excel",R"(express_type)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_item_request_info::express_type))).
 		property("lattice_count",&web_sync_item_request_info::lattice_count)(rttr::metadata("Json","latticeCount"),rttr::metadata("Sql","lattice_count"),rttr::metadata("Excel",R"(lattice_count)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_item_request_info::lattice_count))).
@@ -107,16 +110,16 @@ static void func_6539ece46bdddf5948752ffca059661e() {
 		property("lattice_summay",&web_sync_item_request_info::lattice_summay)(rttr::metadata("Json","latticeSummay"),rttr::metadata("Sql","lattice_summay"),rttr::metadata("Excel",R"(lattice_summay)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_item_request_info::lattice_summay))).
 		property("reflux_summay",&web_sync_item_request_info::reflux_summay)(rttr::metadata("Json","refluxSummay"),rttr::metadata("Sql","reflux_summay"),rttr::metadata("Excel",R"(reflux_summay)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_item_request_info::reflux_summay)));
 }
-static void func_4beae5fdb4bc610f686a88fa9be6d05c() {
+static void func_6bb23a00ede22713ec0f031f7bdda9b2() {
 	rttr::registration::class_<struct web_sync_request_info>("web_sync_request_info").constructor<>()(rttr::detail::as_object{}).
 		property("device_id",&web_sync_request_info::device_id)(rttr::metadata("Json","deviceId"),rttr::metadata("Sql","device_id"),rttr::metadata("Excel",R"(device_id)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_request_info::device_id))).
-		property("summary_time",&web_sync_request_info::summary_time)(rttr::metadata("Json","deviceId"),rttr::metadata("Sql","summary_time"),rttr::metadata("Excel",R"(summary_time)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_request_info::summary_time))).
+		property("summary_time",&web_sync_request_info::summary_time)(rttr::metadata("Json","summaryTime"),rttr::metadata("Sql","summary_time"),rttr::metadata("Excel",R"(summary_time)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_request_info::summary_time))).
 		property("running_distance",&web_sync_request_info::running_distance)(rttr::metadata("Json","runningDistance"),rttr::metadata("Sql","running_distance"),rttr::metadata("Excel",R"(running_distance)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_request_info::running_distance))).
 		property("speed",&web_sync_request_info::speed)(rttr::metadata("Json","speed"),rttr::metadata("Sql","speed"),rttr::metadata("Excel",R"(speed)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_request_info::speed))).
 		property("data",&web_sync_request_info::data)(rttr::metadata("Json","data"),rttr::metadata("Sql","data"),rttr::metadata("Excel",R"(data)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_sync_request_info::data)));
 }
-static void func_70cbe6d1725f97bae81c06eedc534ee7() {
-	rttr::registration::class_<struct web_user_config_info>("web_user_config").constructor<>()(rttr::detail::as_object{}).
+static void func_312134773f33f31cd101ac4fa2d83e21() {
+	rttr::registration::class_<struct web_user_config_info>("user_config").constructor<>()(rttr::detail::as_object{}).
 		property("id",&web_user_config_info::id)(rttr::metadata("Json","id"),rttr::metadata("Sql","id"),rttr::metadata("Excel",R"(id)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_user_config_info::id))).
 		property("modify_time",&web_user_config_info::modify_time)(rttr::metadata("Json","modify_time"),rttr::metadata("Sql","modify_time"),rttr::metadata("Excel",R"(modify_time)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_user_config_info::modify_time))).
 		property("name",&web_user_config_info::name)(rttr::metadata("Json","name"),rttr::metadata("Sql","name"),rttr::metadata("Excel",R"(name)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_user_config_info::name))).
@@ -125,7 +128,7 @@ static void func_70cbe6d1725f97bae81c06eedc534ee7() {
 		property("enable",&web_user_config_info::enable)(rttr::metadata("Json","enable"),rttr::metadata("Sql","enable"),rttr::metadata("Excel",R"(enable)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_user_config_info::enable))).
 		property("remarks",&web_user_config_info::remarks)(rttr::metadata("Json","remarks"),rttr::metadata("Sql","remarks"),rttr::metadata("Excel",R"(remarks)"),rttr::metadata("NoJson",false),rttr::metadata("NoSql",false),rttr::metadata("NoExcel",false),rttr::metadata("SqlKey",false),rttr::metadata("NoArchive",false),rttr::metadata("Offset",robotics::v3::utils::pointer_cast<int>(&web_user_config_info::remarks)));
 }
-static void func_cb5b33150fd33c3d5bed945528ac940f() {
+static void func_a8232923f2ff6dba07315ee05bca35cb() {
 	rttr::registration::class_<class account>("account").constructor<>()().
 		method("index",&account::index).
 		method("captcha",&account::captcha)(rttr::default_arguments(std::string{}),rttr::parameter_names("v")).
@@ -211,7 +214,7 @@ static void func_cb5b33150fd33c3d5bed945528ac940f() {
 	controller->controller_name = "account";
 	robotics::v3::mvc::ico_controller::attach(controller);
 }
-static void func_142997f089503ddc36f7f8f56d0a571f() {
+static void func_378c7cdd311b1bf0d697aad18be833e4() {
 	rttr::registration::class_<class drop>("drop").constructor<>()().
 		method("index",&drop::index).
 		method("load",&drop::load)(rttr::default_arguments(int{},int{},std::string{},std::string{},std::string{}),rttr::parameter_names("page","limit","type","name","enable")).
@@ -391,7 +394,7 @@ static void func_142997f089503ddc36f7f8f56d0a571f() {
 	controller->controller_name = "drop";
 	robotics::v3::mvc::ico_controller::attach(controller);
 }
-static void func_aaf8928d27eeec749cf212959832172e() {
+static void func_fe92aa0454931c8dec5215f5735b5f94() {
 	rttr::registration::class_<class general>("general").constructor<>()().
 		method("index",&general::index).
 		method("load",&general::load)(rttr::default_arguments(int{},int{},std::string{},std::string{},std::string{}),rttr::parameter_names("page","limit","key","value","enable")).
@@ -571,7 +574,7 @@ static void func_aaf8928d27eeec749cf212959832172e() {
 	controller->controller_name = "general";
 	robotics::v3::mvc::ico_controller::attach(controller);
 }
-static void func_5450da3eab0983e05b93d9bca5a49283() {
+static void func_3151f8d37234e7a91121b41ba424c055() {
 	rttr::registration::class_<class home>("home").constructor<>()().
 		method("index",&home::index).
 		method("init",&home::init)(rttr::default_arguments(std::string{}),rttr::parameter_names("v"));
@@ -610,7 +613,7 @@ static void func_5450da3eab0983e05b93d9bca5a49283() {
 	controller->controller_name = "home";
 	robotics::v3::mvc::ico_controller::attach(controller);
 }
-static void func_280d081f11826840aba627daddc0dea5() {
+static void func_62e031175f0200139909253497f85fd5() {
 	rttr::registration::class_<class regex>("regex").constructor<>()().
 		method("index",&regex::index).
 		method("load",&regex::load)(rttr::default_arguments(int{},int{},std::string{},std::string{},std::string{}),rttr::parameter_names("page","limit","type","name","enable")).
@@ -790,7 +793,7 @@ static void func_280d081f11826840aba627daddc0dea5() {
 	controller->controller_name = "regex";
 	robotics::v3::mvc::ico_controller::attach(controller);
 }
-static void func_99eefa68c7342510588178473577675b() {
+static void func_91c0c85593104d38c1003f727680a195() {
 	rttr::registration::class_<class sync>("sync").constructor<>()().
 		method("index",&sync::index).
 		method("load",&sync::load)(rttr::default_arguments(int{},int{},std::string{},std::string{},std::string{},std::string{}),rttr::parameter_names("page","limit","type","enable","start_time","end_time"));
@@ -864,7 +867,7 @@ static void func_99eefa68c7342510588178473577675b() {
 	controller->controller_name = "sync";
 	robotics::v3::mvc::ico_controller::attach(controller);
 }
-static void func_9c39bed9ba128b7c309c8207be259c0d() {
+static void func_ab8bb08d7914a83657a95c73de072cf6() {
 	rttr::registration::class_<class user>("user").constructor<>()().
 		method("index",&user::index).
 		method("load",&user::load)(rttr::default_arguments(int{},int{},std::string{},std::string{},std::string{}),rttr::parameter_names("page","limit","name","code","enable")).
@@ -1025,20 +1028,20 @@ static void func_9c39bed9ba128b7c309c8207be259c0d() {
 	robotics::v3::mvc::ico_controller::attach(controller);
 }
 RTTR_REGISTRATION {
-	func_d570f491d35dc9cbebec1426298cd8bc();
-	func_b25b3ec2cb68a264fa80f208c4fc49aa();
-	func_93a139474e9ed908ef7ca61879e90f0d();
-	func_b7ff0396ed1c36af5786e42c15c8241d();
-	func_8b6c840c4d2b8c9712c820ad6af7b43d();
-	func_6ab45bf43a33b47de841d49550cfea18();
-	func_6539ece46bdddf5948752ffca059661e();
-	func_4beae5fdb4bc610f686a88fa9be6d05c();
-	func_70cbe6d1725f97bae81c06eedc534ee7();
-	func_cb5b33150fd33c3d5bed945528ac940f();
-	func_142997f089503ddc36f7f8f56d0a571f();
-	func_aaf8928d27eeec749cf212959832172e();
-	func_5450da3eab0983e05b93d9bca5a49283();
-	func_280d081f11826840aba627daddc0dea5();
-	func_99eefa68c7342510588178473577675b();
-	func_9c39bed9ba128b7c309c8207be259c0d();
+	func_60e43868d746dfb87d107a85d1139593();
+	func_1c9c3c04b58df9f07b42ab8ce1266014();
+	func_ffdf7c65663c0db574213e658e55589e();
+	func_dcbbdbbc5862dd318e03528101b7dcda();
+	func_a910478f09954b5d13472b82cc52c3d7();
+	func_6baefae625d9812559c6678ad70638d3();
+	func_ee557dbb99355b7a1a7078ab543a3a63();
+	func_6bb23a00ede22713ec0f031f7bdda9b2();
+	func_312134773f33f31cd101ac4fa2d83e21();
+	func_a8232923f2ff6dba07315ee05bca35cb();
+	func_378c7cdd311b1bf0d697aad18be833e4();
+	func_fe92aa0454931c8dec5215f5735b5f94();
+	func_3151f8d37234e7a91121b41ba424c055();
+	func_62e031175f0200139909253497f85fd5();
+	func_91c0c85593104d38c1003f727680a195();
+	func_ab8bb08d7914a83657a95c73de072cf6();
 }

+ 11 - 2
src/sync_service.ini

@@ -11,7 +11,16 @@ VALUE=dbcontext
 ODBC="SQL|CONNSTR|mysql:host=127.0.0.1;database=template_db;user=root;password=123456;"
 
 [BLLPROPERTYdbcontext]
-INDEXweb_user_config_info1=true
-INDEXweb_user_config_info2=true
+INDEXweb_user_config_info1=false
+INDEXweb_user_config_info2=false
 INDEXweb_user_list_info1=true
 INDEXweb_user_list_info2=false
+
+[XMLLIST]
+VALUE="web_drop_config_info,web_general_config_info,web_regex_config_info,web_sync_config_info,web_user_config_info"
+
+[XMLCODE]
+web_user_config_info="@ByteArray(MKH1cm9ib3RpY3M6OnYzOjpkYXRldGltZTo6Y3VycmVudF9kYXRldGltZSgpofW53MDt1LGh9WFkbWluofUxMjM0NTah9VRSVUWh9bncwO3UsQ==)"
+
+[XMLLISTUPDATE]
+VALUE="web_drop_config_info=type,web_general_config_info=key,web_regex_config_info=type,web_sync_config_info=id,web_user_config_info=id"

+ 6 - 6
src/views/drop/edit.html

@@ -23,28 +23,28 @@ ${mask name='edit'}
         <div class="layui-col-md12 top10">
             <form class="layui-form" action="">
                 <div class="layui-form-item">
-                    <input name="id" lay-verify="required" style="display: none;" lay-vertype="tips" class="layui-input" type="text" value="${model name='web_drop_config_info.id' value='[#value]'/}" />
+                    <input name="id" lay-verify="required" style="display: none;" lay-vertype="tips" class="layui-input" type="text" value="${model name='drop_config.id' value='[#value]'/}" />
                 </div>
 
                 <div class="layui-form-item">
                     <label class="layui-form-label">类型:</label>
                     <div class="layui-input-inline">
-                        <input type="number" name="type" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入类型" value="${model name='web_drop_config_info.type' value='[#value]'/}" />
+                        <input type="number" name="type" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入类型" value="${model name='drop_config.type' value='[#value]'/}" />
                     </div>
                     <label class="layui-form-label">类型名称:</label>
                     <div class="layui-input-inline">
-                        <input type="text" name="name" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入类型名称" value="${model name='web_drop_config_info.name' value='[#value]'/}" />
+                        <input type="text" name="name" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入类型名称" value="${model name='drop_config.name' value='[#value]'/}" />
                     </div>
                 </div>
 
                 <div class="layui-form-item">
                     <label class="layui-form-label">状态:</label>
                     <div class="layui-input-inline">
-                        <input name="enable" value="true" title="启用" ${model name='web_drop_config_info.enable' value='['true':'checked']' /} type="radio">
+                        <input name="enable" value="true" title="启用" ${model name='drop_config.enable' value='['true':'checked']' /} type="radio">
                         <div class="layui-unselect layui-form-radio layui-form-radioed">
                             <i class="layui-anim layui-icon"></i><div>启用</div>
                         </div>
-                        <input name="enable" value="false" title="停用" ${model name='web_drop_config_info.enable' value='['false':'checked']' /} type="radio">
+                        <input name="enable" value="false" title="停用" ${model name='drop_config.enable' value='['false':'checked']' /} type="radio">
                         <div class="layui-unselect layui-form-radio">
                             <i class="layui-anim layui-icon"></i><div>停用</div>
                         </div>
@@ -53,7 +53,7 @@ ${mask name='edit'}
                 <div class="layui-form-item">
                     <label class="layui-form-label">落格描述:</label>
                     <div class="layui-input-block">
-                        <textarea class="layui-textarea" cols="20" id="remarks" lay-verify="pass" lay-vertype="tips" name="remarks" rows="2" placeholder="请输入落格描述">${model name='web_drop_config_info.remarks' value='[#value]'/}</textarea>
+                        <textarea class="layui-textarea" cols="20" id="remarks" lay-verify="pass" lay-vertype="tips" name="remarks" rows="2" placeholder="请输入落格描述">${model name='drop_config.remarks' value='[#value]'/}</textarea>
                     </div>
                 </div>
                 <div class="layui-form-item">

+ 12 - 1
src/views/drop/index.html

@@ -193,7 +193,18 @@
                                     layer.close(index); //关闭弹框
                                     layer.msg(result.message, {
                                         icon: 1  //1:勾 6:笑脸
-                                    });
+									});
+                                    //执行搜索重载
+                                    table.reload('currentTableId', {
+                                        page: {
+                                            curr: 1
+                                        },
+                                        where: {
+                                            type: '',
+                                            name: '',
+                                            enable: ''
+                                        }
+                                    }, 'data');
                                 }
                                 else {
                                     layer.msg(result.message, {

+ 6 - 6
src/views/general/edit.html

@@ -23,28 +23,28 @@ ${mask name='edit'}
         <div class="layui-col-md12 top10">
             <form class="layui-form" action="">
                 <div class="layui-form-item">
-                    <input name="id" lay-verify="required" style="display: none;" lay-vertype="tips" class="layui-input" type="text" value="${model name='web_general_config_info.id' value='[#value]'/}" />
+                    <input name="id" lay-verify="required" style="display: none;" lay-vertype="tips" class="layui-input" type="text" value="${model name='general_config.id' value='[#value]'/}" />
                 </div>
 
                 <div class="layui-form-item">
                     <label class="layui-form-label">KEY:</label>
                     <div class="layui-input-inline">
-                        <input type="number" name="key" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入KEY" value="${model name='web_general_config_info.key' value='[#value]'/}" />
+                        <input type="number" name="key" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入KEY" value="${model name='general_config.key' value='[#value]'/}" />
                     </div>
                     <label class="layui-form-label">VALUE:</label>
                     <div class="layui-input-inline">
-                        <input type="text" name="value" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入VALUE" value="${model name='web_general_config_info.value' value='[#value]'/}" />
+                        <input type="text" name="value" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入VALUE" value="${model name='general_config.value' value='[#value]'/}" />
                     </div>
                 </div>
 
                 <div class="layui-form-item">
                     <label class="layui-form-label">状态:</label>
                     <div class="layui-input-inline">
-                        <input name="enable" value="true" title="启用" ${model name='web_general_config_info.enable' value='['true':'checked']' /} type="radio">
+                        <input name="enable" value="true" title="启用" ${model name='general_config.enable' value='['true':'checked']' /} type="radio">
                         <div class="layui-unselect layui-form-radio layui-form-radioed">
                             <i class="layui-anim layui-icon"></i><div>启用</div>
                         </div>
-                        <input name="enable" value="false" title="停用" ${model name='web_general_config_info.enable' value='['false':'checked']' /} type="radio">
+                        <input name="enable" value="false" title="停用" ${model name='general_config.enable' value='['false':'checked']' /} type="radio">
                         <div class="layui-unselect layui-form-radio">
                             <i class="layui-anim layui-icon"></i><div>停用</div>
                         </div>
@@ -53,7 +53,7 @@ ${mask name='edit'}
                 <div class="layui-form-item">
                     <label class="layui-form-label">配置描述:</label>
                     <div class="layui-input-block">
-                        <textarea class="layui-textarea" cols="20" id="remarks" lay-verify="pass" lay-vertype="tips" name="remarks" rows="2" placeholder="请输入配置描述">${model name='web_general_config_info.remarks' value='[#value]'/}</textarea>
+                        <textarea class="layui-textarea" cols="20" id="remarks" lay-verify="pass" lay-vertype="tips" name="remarks" rows="2" placeholder="请输入配置描述">${model name='general_config.remarks' value='[#value]'/}</textarea>
                     </div>
                 </div>
                 <div class="layui-form-item">

+ 13 - 2
src/views/general/index.html

@@ -181,7 +181,7 @@
                                     layer.close(index); //关闭弹框
                                     layer.msg(result.message, {
                                         icon: 1  //1:勾 6:笑脸
-                                    });
+									});
                                 }
                                 else {
                                     layer.msg(result.message, {
@@ -225,7 +225,18 @@
                                     layer.close(index); //关闭弹框
                                     layer.msg(result.message, {
                                         icon: 1  //1:勾 6:笑脸
-                                    });
+									});
+                                    //执行搜索重载
+                                    table.reload('currentTableId', {
+                                        page: {
+                                            curr: 1
+                                        },
+                                        where: {
+                                            key: '',
+                                            value: '',
+                                            enable: ''
+                                        }
+                                    }, 'data');
                                 }
                                 else {
                                     layer.msg(result.message, {

+ 7 - 7
src/views/regex/edit.html

@@ -23,35 +23,35 @@ ${mask name='edit'}
         <div class="layui-col-md12 top10">
             <form class="layui-form" action="">
                 <div class="layui-form-item">
-                    <input name="id" lay-verify="required" style="display: none;" lay-vertype="tips" class="layui-input" type="text" value="${model name='web_regex_config_info.id' value='[#value]'/}" />
+                    <input name="id" lay-verify="required" style="display: none;" lay-vertype="tips" class="layui-input" type="text" value="${model name='regex_config.id' value='[#value]'/}" />
                 </div>
 
                 <div class="layui-form-item">
                     <label class="layui-form-label">类型:</label>
                     <div class="layui-input-inline">
-                        <input type="number" name="type" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入类型" value="${model name='web_regex_config_info.type' value='[#value]'/}" />
+                        <input type="number" name="type" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入类型" value="${model name='regex_config.type' value='[#value]'/}" />
                     </div>
                     <label class="layui-form-label">名称:</label>
                     <div class="layui-input-inline">
-                        <input type="text" name="name" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入名称" value="${model name='web_regex_config_info.name' value='[#value]'/}" />
+                        <input type="text" name="name" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入名称" value="${model name='regex_config.name' value='[#value]'/}" />
                     </div>
                 </div>
 
                 <div class="layui-form-item">
                     <label class="layui-form-label">正则:</label>
                     <div class="layui-input-block">
-                        <input type="text" name="regex" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入正则" value="${model name='web_regex_config_info.regex' value='[#value]'/}" />
+                        <input type="text" name="regex" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入正则" value="${model name='regex_config.regex' value='[#value]'/}" />
                     </div>
                 </div>
 
                 <div class="layui-form-item">
                     <label class="layui-form-label">状态:</label>
                     <div class="layui-input-inline">
-                        <input name="enable" value="true" title="启用" ${model name='web_regex_config_info.enable' value='['true':'checked']' /} type="radio">
+                        <input name="enable" value="true" title="启用" ${model name='regex_config.enable' value='['true':'checked']' /} type="radio">
                         <div class="layui-unselect layui-form-radio layui-form-radioed">
                             <i class="layui-anim layui-icon"></i><div>启用</div>
                         </div>
-                        <input name="enable" value="false" title="停用" ${model name='web_regex_config_info.enable' value='['false':'checked']' /} type="radio">
+                        <input name="enable" value="false" title="停用" ${model name='regex_config.enable' value='['false':'checked']' /} type="radio">
                         <div class="layui-unselect layui-form-radio">
                             <i class="layui-anim layui-icon"></i><div>停用</div>
                         </div>
@@ -60,7 +60,7 @@ ${mask name='edit'}
                 <div class="layui-form-item">
                     <label class="layui-form-label">正则描述:</label>
                     <div class="layui-input-block">
-                        <textarea class="layui-textarea" cols="20" id="remarks" lay-verify="pass" lay-vertype="tips" name="remarks" rows="2" placeholder="请输入正则描述">${model name='web_regex_config_info.remarks' value='[#value]'/}</textarea>
+                        <textarea class="layui-textarea" cols="20" id="remarks" lay-verify="pass" lay-vertype="tips" name="remarks" rows="2" placeholder="请输入正则描述">${model name='regex_config.remarks' value='[#value]'/}</textarea>
                     </div>
                 </div>
                 <div class="layui-form-item">

+ 12 - 1
src/views/regex/index.html

@@ -204,7 +204,18 @@
                                     layer.close(index); //关闭弹框
                                     layer.msg(result.message, {
                                         icon: 1  //1:勾 6:笑脸
-                                    });
+									});
+                                    //执行搜索重载
+                                    table.reload('currentTableId', {
+                                        page: {
+                                            curr: 1
+                                        },
+                                        where: {
+                                            type: '',
+                                            name: '',
+                                            enable: ''
+                                        }
+                                    }, 'data');
                                 }
                                 else {
                                     layer.msg(result.message, {

+ 7 - 7
src/views/user/edit.html

@@ -23,35 +23,35 @@ ${mask name='edit'}
         <div class="layui-col-md12 top10">
             <form class="layui-form" action="">
                 <div class="layui-form-item">
-                    <input name="id" lay-verify="required" style="display: none;" lay-vertype="tips" class="layui-input" type="text" value="${model name='web_user_config.id' value='[#value]'/}" />
+                    <input name="id" lay-verify="required" style="display: none;" lay-vertype="tips" class="layui-input" type="text" value="${model name='user_config.id' value='[#value]'/}" />
                 </div>
 
                 <div class="layui-form-item">
                     <label class="layui-form-label">用户名称:</label>
                     <div class="layui-input-inline">
-                        <input type="text" name="name" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入用户名称" value="${model name='web_user_config.name' value='[#value]'/}" />
+                        <input type="text" name="name" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入用户名称" value="${model name='user_config.name' value='[#value]'/}" />
                     </div>
                     <label class="layui-form-label">用户代码:</label>
                     <div class="layui-input-inline">
-                        <input type="text" name="code" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入用户代码" value="${model name='web_user_config.code' value='[#value]'/}" />
+                        <input type="text" name="code" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入用户代码" value="${model name='user_config.code' value='[#value]'/}" />
                     </div>
                 </div>
 
                 <div class="layui-form-item">
                     <label class="layui-form-label">用户密码:</label>
                     <div class="layui-input-inline">
-                        <input type="password" name="password" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入用户密码" value="${model name='web_user_config.password' value='[#value]'/}" />
+                        <input type="password" name="password" lay-verify="required|account" lay-min="1" autocomplete="off" class="layui-input account" placeholder="请输入用户密码" value="${model name='user_config.password' value='[#value]'/}" />
                     </div>
                 </div>
 
                 <div class="layui-form-item">
                     <label class="layui-form-label">状态:</label>
                     <div class="layui-input-inline">
-                        <input name="enable" value="true" title="启用" ${model name='web_user_config.enable' value='['true':'checked']' /} type="radio">
+                        <input name="enable" value="true" title="启用" ${model name='user_config.enable' value='['true':'checked']' /} type="radio">
                         <div class="layui-unselect layui-form-radio layui-form-radioed">
                             <i class="layui-anim layui-icon"></i><div>启用</div>
                         </div>
-                        <input name="enable" value="false" title="停用" ${model name='web_user_config.enable' value='['false':'checked']' /} type="radio">
+                        <input name="enable" value="false" title="停用" ${model name='user_config.enable' value='['false':'checked']' /} type="radio">
                         <div class="layui-unselect layui-form-radio">
                             <i class="layui-anim layui-icon"></i><div>停用</div>
                         </div>
@@ -60,7 +60,7 @@ ${mask name='edit'}
                 <div class="layui-form-item">
                     <label class="layui-form-label">用户描述:</label>
                     <div class="layui-input-block">
-                        <textarea class="layui-textarea" cols="20" id="remarks" lay-verify="pass" lay-vertype="tips" name="remarks" rows="2" placeholder="请输入用户描述">${model name='web_user_config.remarks' value='[#value]'/}</textarea>
+                        <textarea class="layui-textarea" cols="20" id="remarks" lay-verify="pass" lay-vertype="tips" name="remarks" rows="2" placeholder="请输入用户描述">${model name='user_config.remarks' value='[#value]'/}</textarea>
                     </div>
                 </div>
                 <div class="layui-form-item">

+ 246 - 280
src/xml/xml_context.hpp

@@ -3,298 +3,264 @@
 #include <iostream>
 #include <sstream>
 #include <vector>
+#include <filesystem>
 //boost
-#include <boost/property_tree/ptree.hpp> 
+#include <boost/property_tree/ptree.hpp>
 #include <boost/property_tree/xml_parser.hpp>
 //robotics
 #include <robotics/linq.hpp>
 //local
-#include "../models/web_user_config_info.h"
 #include "../models/web_drop_config_info.h"
 #include "../models/web_general_config_info.h"
 #include "../models/web_regex_config_info.h"
 #include "../models/web_sync_config_info.h"
-/**
- * @brief 配置
- */
+#include "../models/web_user_config_info.h"
+
 class xml_context {
 public:
-    /**
-     * @brief 
-     * @tparam _Type 
-     * @param reset 
-     * @return 
-     */
-    template<typename _Type>
-    static v3::linq_ptr<_Type>& from(bool reset = true) {
-        if constexpr (std::is_same<web_user_config_info, _Type>::value) {
-            if (reset) {
-                instance()->linq_user_config_->reset();
-            }
-            return *instance()->linq_user_config_;
-        }
-        else if constexpr (std::is_same<web_drop_config_info, _Type>::value) {
-            if (reset) {
-                instance()->linq_drop_config_->reset();
-            }
-            return *instance()->linq_drop_config_;
-        }
-        else if constexpr (std::is_same<web_regex_config_info, _Type>::value) {
-            if (reset) {
-                instance()->linq_regex_config_->reset();
-            }
-            return *instance()->linq_regex_config_;
-        }
-        else if constexpr (std::is_same<web_general_config_info, _Type>::value) {
-            if (reset) {
-                instance()->linq_general_config_->reset();
-            }
-            return *instance()->linq_general_config_;
-        }
-        else if constexpr (std::is_same<web_sync_config_info, _Type>::value) {
-            if (reset) {
-                instance()->linq_sync_config_->reset();
-            }
-            return *instance()->linq_sync_config_;
-        }
-    }
+	template<typename _Type>
+	static v3::linq_ptr<_Type>& from(bool reset = true) {
+		if constexpr (std::is_same<web_drop_config_info, _Type>::value) {
+			if (reset) {
+				instance()->linq_web_drop_config_info_->reset();
+			}
+			return *instance()->linq_web_drop_config_info_;
+		}
+		else if constexpr (std::is_same<web_general_config_info, _Type>::value) {
+			if (reset) {
+				instance()->linq_web_general_config_info_->reset();
+			}
+			return *instance()->linq_web_general_config_info_;
+		}
+		else if constexpr (std::is_same<web_regex_config_info, _Type>::value) {
+			if (reset) {
+				instance()->linq_web_regex_config_info_->reset();
+			}
+			return *instance()->linq_web_regex_config_info_;
+		}
+		else if constexpr (std::is_same<web_sync_config_info, _Type>::value) {
+			if (reset) {
+				instance()->linq_web_sync_config_info_->reset();
+			}
+			return *instance()->linq_web_sync_config_info_;
+		}
+		else if constexpr (std::is_same<web_user_config_info, _Type>::value) {
+			if (reset) {
+				instance()->linq_web_user_config_info_->reset();
+			}
+			return *instance()->linq_web_user_config_info_;
+		}
+	}
 private:
-    /**
-     * @brief 单例
-     * @return
-     */
-    static xml_context* instance() {
-        static xml_context g_xml_context;
-        return &g_xml_context;
-    }
-private:
-    /**
-     * @brief 构造
-     */
-    xml_context() {
-        load();
-        //配置列表交给linq管理
-        linq_user_config_.reset(new v3::linq_ptr<web_user_config_info>(user_config_list_));
-        //绑定改变事件
-        linq_user_config_->changed_bind(&xml_context::on_table_save<web_user_config_info>, this);
-
-        //配置列表交给linq管理
-        linq_drop_config_.reset(new v3::linq_ptr<web_drop_config_info>(drop_config_list_));
-        //绑定改变事件
-        linq_drop_config_->changed_bind(&xml_context::on_table_save<web_drop_config_info>, this);
-
-        //配置列表交给linq管理
-        linq_regex_config_.reset(new v3::linq_ptr<web_regex_config_info>(regex_config_list_));
-        //绑定改变事件
-        linq_regex_config_->changed_bind(&xml_context::on_table_save<web_regex_config_info>, this);
-
-        //配置列表交给linq管理
-        linq_general_config_.reset(new v3::linq_ptr<web_general_config_info>(general_config_list_));
-        //绑定改变事件
-        linq_general_config_->changed_bind(&xml_context::on_table_save<web_general_config_info>, this);
-
-        //配置列表交给linq管理
-        linq_sync_config_.reset(new v3::linq_ptr<web_sync_config_info>(sync_config_list_));
-        //绑定改变事件
-        linq_sync_config_->changed_bind(&xml_context::on_table_save<web_sync_config_info>, this);
-    }
-    /**
-     * @brief 加载xml
-     */
-    void load() {
-        boost::property_tree::ptree root;
-        try {
-            read_xml("./config/config.xml", root);
-            //用户读取
-            for (auto& it : root.get_child("root.users")) {
-                if (it.first != "item")
-                    continue;
-                std::shared_ptr<web_user_config_info> item(new web_user_config_info);
-                item->id = it.second.get<int>("<xmlattr>.id", 0);
-                item->modify_time = it.second.get<std::string>("<xmlattr>.modify_time", v3::datetime::current_datetime().to_string("yyyy-MM-dd HH:mm:ss"));
-                item->name = it.second.get<std::string>("<xmlattr>.name", "管理员");
-                item->code = it.second.get<std::string>("<xmlattr>.code", "admin");
-                item->password = it.second.get<std::string>("<xmlattr>.password", "123456");
-                item->enable = it.second.get<bool>("<xmlattr>.enable", false);
-                item->remarks = it.second.get<std::string>("<xmlattr>.remarks", "");
-                user_config_list_.push_back(item);
-            }
-            //落格读取
-            for (auto& it : root.get_child("root.drop")) {
-                if (it.first != "item")
-                    continue;
-                std::shared_ptr<web_drop_config_info> item(new web_drop_config_info);
-                item->id = it.second.get<int>("<xmlattr>.id", 0);
-                item->modify_time = it.second.get<std::string>("<xmlattr>.modify_time", v3::datetime::current_datetime().to_string("yyyy-MM-dd HH:mm:ss"));
-                item->type = it.second.get<int>("<xmlattr>.type", 0);
-                item->name = it.second.get<std::string>("<xmlattr>.name", "");
-                item->enable = it.second.get<bool>("<xmlattr>.enable", false);
-                item->remarks = it.second.get<std::string>("<xmlattr>.remarks", "");
-                drop_config_list_.push_back(item);
-            }
-            //正则读取
-            for (auto& it : root.get_child("root.regex")) {
-                if (it.first != "item")
-                    continue;
-                std::shared_ptr<web_regex_config_info> item(new web_regex_config_info);
-                item->id = it.second.get<int>("<xmlattr>.id", 0);
-                item->modify_time = it.second.get<std::string>("<xmlattr>.modify_time", v3::datetime::current_datetime().to_string("yyyy-MM-dd HH:mm:ss"));
-                item->type = it.second.get<int>("<xmlattr>.type", 1);
-                item->name = it.second.get<std::string>("<xmlattr>.name", "");
-                item->regex = it.second.get<std::string>("<xmlattr>.regex", "");
-                item->enable = it.second.get<bool>("<xmlattr>.enable", false);
-                item->remarks = it.second.get<std::string>("<xmlattr>.remarks", "");
-                regex_config_list_.push_back(item);
-            }
-            //通用读取
-            for (auto& it : root.get_child("root.general")) {
-                if (it.first != "item")
-                    continue;
-                std::shared_ptr<web_general_config_info> item(new web_general_config_info);
-                item->id = it.second.get<int>("<xmlattr>.id", 0);
-                item->modify_time = it.second.get<std::string>("<xmlattr>.modify_time", v3::datetime::current_datetime().to_string("yyyy-MM-dd HH:mm:ss"));
-                item->key = it.second.get<int>("<xmlattr>.key", 1);
-                item->value = it.second.get<std::string>("<xmlattr>.value", "");
-                item->enable = it.second.get<bool>("<xmlattr>.enable", false);
-                item->remarks = it.second.get<std::string>("<xmlattr>.remarks", "");
-                general_config_list_.push_back(item);
-            }
-            //同步读取
-            for (auto& it : root.get_child("root.sync")) {
-                if (it.first != "item")
-                    continue;
-                std::shared_ptr<web_sync_config_info> item(new web_sync_config_info);
-                item->id = it.second.get<int>("<xmlattr>.id", 0);
-                item->create_time = it.second.get<std::string>("<xmlattr>.create_time", v3::datetime::current_datetime().to_string("yyyy-MM-dd HH:mm:ss"));
-                item->device_id = it.second.get<std::string>("<xmlattr>.device_id", "");
-                item->summary_time = it.second.get<std::string>("<xmlattr>.summary_time", v3::datetime::current_datetime().to_string("yyyy-MM-dd HH:mm:ss"));
-                item->running_distance = it.second.get<double>("<xmlattr>.running_distance", 0);
-                item->speed = it.second.get<double>("<xmlattr>.speed", 0);
-                item->express_type = it.second.get<int>("<xmlattr>.express_type", 0);
-                item->lattice_count = it.second.get<int>("<xmlattr>.lattice_count", 0);
-                item->supply_count = it.second.get<int>("<xmlattr>.supply_count", 0);
-                item->reflux_count = it.second.get<int>("<xmlattr>.reflux_count", 0);
-                item->supply_summay = it.second.get<std::string>("<xmlattr>.supply_summay","");
-                item->lattice_summay = it.second.get<std::string>("<xmlattr>.lattice_summay", "");
-                item->reflux_summay = it.second.get<std::string>("<xmlattr>.reflux_summay", "");
-                item->enable = it.second.get<bool>("<xmlattr>.enable", false);
-                item->remarks = it.second.get<std::string>("<xmlattr>.remarks", "");
-                sync_config_list_.push_back(item);
-            }
-        }
-        catch (std::exception const& ec) {
-            LOG_ERROR << "读取xml配置异常" << ec;
-        }
-    }
-    /**
-     * @brief 保存xml
-     */
-    void save() {
-        std::lock_guard<std::mutex> lock(mutex_);
-        boost::property_tree::ptree root;
-        try {
-            //保存用户
-            auto& user = root.add("root.users", "");
-            for (auto& it : user_config_list_) {
-                auto& item = user.add("item", "");
-                item.put("<xmlattr>.id", it->id);
-                item.put("<xmlattr>.modify_time", it->modify_time.to_string("yyyy-MM-dd HH:mm:ss"));
-                item.put("<xmlattr>.name", it->name);
-                item.put("<xmlattr>.code", it->code);
-                item.put("<xmlattr>.password", it->password);
-                item.put("<xmlattr>.enable", it->enable);
-                item.put("<xmlattr>.remarks", it->remarks);
-            }
-            //落格保存
-            auto& drop = root.add("root.drop", "");
-            for (auto& it : drop_config_list_) {
-                auto& item = drop.add("item", "");
-                item.put("<xmlattr>.id", it->id);
-                item.put("<xmlattr>.modify_time", it->modify_time.to_string("yyyy-MM-dd HH:mm:ss"));
-                item.put("<xmlattr>.type", it->type);
-                item.put("<xmlattr>.name", it->name);
-                item.put("<xmlattr>.enable", it->enable);
-                item.put("<xmlattr>.remarks", it->remarks);
-            }
-            //正则保存
-            auto& regex = root.add("root.regex", "");
-            for (auto& it : regex_config_list_) {
-                auto& item = regex.add("item", "");
-                item.put("<xmlattr>.id", it->id);
-                item.put("<xmlattr>.modify_time", it->modify_time.to_string("yyyy-MM-dd HH:mm:ss"));
-                item.put("<xmlattr>.type", it->type);
-                item.put("<xmlattr>.name", it->name);
-                item.put("<xmlattr>.regex", it->regex);
-                item.put("<xmlattr>.enable", it->enable);
-                item.put("<xmlattr>.remarks", it->remarks);
-            }
-            //通用保存
-            auto& general = root.add("root.general", "");
-            for (auto& it : general_config_list_) {
-                auto& item = general.add("item", "");
-                item.put("<xmlattr>.id", it->id);
-                item.put("<xmlattr>.modify_time", it->modify_time.to_string("yyyy-MM-dd HH:mm:ss"));
-                item.put("<xmlattr>.key", it->key);
-                item.put("<xmlattr>.value", it->value);
-                item.put("<xmlattr>.enable", it->enable);
-                item.put("<xmlattr>.remarks", it->remarks);
-            }
-            //同步保存
-            auto& sync = root.add("root.sync", "");
-            for (auto& it : sync_config_list_) {
-                auto& item = sync.add("item", "");
-                item.put("<xmlattr>.id", it->id);
-                item.put("<xmlattr>.create_time", it->create_time.to_string("yyyy-MM-dd HH:mm:ss"));
-                item.put("<xmlattr>.device_id", it->device_id);
-                item.put("<xmlattr>.summary_time", it->summary_time.to_string("yyyy-MM-dd HH:mm:ss"));
-                item.put("<xmlattr>.running_distance", it->running_distance);
-                item.put("<xmlattr>.speed", it->speed);
-                item.put("<xmlattr>.express_type", it->express_type);
-                item.put("<xmlattr>.lattice_count", it->lattice_count);
-                item.put("<xmlattr>.supply_count", it->supply_count);
-                item.put("<xmlattr>.reflux_count", it->reflux_count);
-                item.put("<xmlattr>.supply_summay", it->supply_summay);
-                item.put("<xmlattr>.lattice_summay", it->lattice_summay);
-                item.put("<xmlattr>.reflux_summay", it->reflux_summay);
-                item.put("<xmlattr>.enable", it->enable);
-                item.put("<xmlattr>.remarks", it->remarks);
-            }
-            boost::property_tree::xml_writer_settings<std::string> settings(' ', 4);
-            write_xml("./config/config.xml", root, std::locale(), settings);
-        }
-        catch (std::exception const& ec) {
-            LOG_ERROR << ec;
-        }
-    }
+	static xml_context* instance() {
+		static xml_context g_xml_context;
+			return &g_xml_context;
+	}
+	xml_context() {
+		create_file();
+		load();
+		linq_web_drop_config_info_.reset(new v3::linq_ptr<web_drop_config_info>(web_drop_config_info_list_));
+		linq_web_drop_config_info_->changed_bind(&xml_context::on_table_save<web_drop_config_info>, this);
+		linq_web_general_config_info_.reset(new v3::linq_ptr<web_general_config_info>(web_general_config_info_list_));
+		linq_web_general_config_info_->changed_bind(&xml_context::on_table_save<web_general_config_info>, this);
+		linq_web_regex_config_info_.reset(new v3::linq_ptr<web_regex_config_info>(web_regex_config_info_list_));
+		linq_web_regex_config_info_->changed_bind(&xml_context::on_table_save<web_regex_config_info>, this);
+		linq_web_sync_config_info_.reset(new v3::linq_ptr<web_sync_config_info>(web_sync_config_info_list_));
+		linq_web_sync_config_info_->changed_bind(&xml_context::on_table_save<web_sync_config_info>, this);
+		linq_web_user_config_info_.reset(new v3::linq_ptr<web_user_config_info>(web_user_config_info_list_));
+		linq_web_user_config_info_->changed_bind(&xml_context::on_table_save<web_user_config_info>, this);
+	}
+	void load() {
+		boost::property_tree::ptree root;
+		try {
+			read_xml("./config/config.xml", root);
+			web_drop_config_info_list_.clear();
+			for (auto& it : root.get_child("root.drop_config")) {
+				if (it.first != "item") continue;
+				std::shared_ptr<web_drop_config_info> item(new web_drop_config_info);
+				item->id = it.second.get<int>("<xmlattr>.id", 0);
+				item->modify_time = it.second.get<std::string>("<xmlattr>.modify_time", v3::datetime::current_datetime().to_string("yyyy-MM-dd HH:mm:ss"));
+				item->type = it.second.get<int>("<xmlattr>.type", 0);
+				item->name = it.second.get<std::string>("<xmlattr>.name", "");
+				item->enable = it.second.get<bool>("<xmlattr>.enable", false);
+				item->remarks = it.second.get<std::string>("<xmlattr>.remarks", "");
+				web_drop_config_info_list_.push_back(item);
+			}
+			web_general_config_info_list_.clear();
+			for (auto& it : root.get_child("root.general_config")) {
+				if (it.first != "item") continue;
+				std::shared_ptr<web_general_config_info> item(new web_general_config_info);
+				item->id = it.second.get<int>("<xmlattr>.id", 0);
+				item->modify_time = it.second.get<std::string>("<xmlattr>.modify_time", v3::datetime::current_datetime().to_string("yyyy-MM-dd HH:mm:ss"));
+				item->key = it.second.get<int>("<xmlattr>.key", 0);
+				item->value = it.second.get<std::string>("<xmlattr>.value", "");
+				item->enable = it.second.get<bool>("<xmlattr>.enable", false);
+				item->remarks = it.second.get<std::string>("<xmlattr>.remarks", "");
+				web_general_config_info_list_.push_back(item);
+			}
+			web_regex_config_info_list_.clear();
+			for (auto& it : root.get_child("root.regex_config")) {
+				if (it.first != "item") continue;
+				std::shared_ptr<web_regex_config_info> item(new web_regex_config_info);
+				item->id = it.second.get<int>("<xmlattr>.id", 0);
+				item->modify_time = it.second.get<std::string>("<xmlattr>.modify_time", v3::datetime::current_datetime().to_string("yyyy-MM-dd HH:mm:ss"));
+				item->type = it.second.get<int>("<xmlattr>.type", 0);
+				item->name = it.second.get<std::string>("<xmlattr>.name", "");
+				item->regex = it.second.get<std::string>("<xmlattr>.regex", "");
+				item->enable = it.second.get<bool>("<xmlattr>.enable", false);
+				item->remarks = it.second.get<std::string>("<xmlattr>.remarks", "");
+				web_regex_config_info_list_.push_back(item);
+			}
+			web_sync_config_info_list_.clear();
+			for (auto& it : root.get_child("root.sync_config")) {
+				if (it.first != "item") continue;
+				std::shared_ptr<web_sync_config_info> item(new web_sync_config_info);
+				item->id = it.second.get<int>("<xmlattr>.id", 0);
+				item->create_time = it.second.get<std::string>("<xmlattr>.create_time", v3::datetime::current_datetime().to_string("yyyy-MM-dd HH:mm:ss"));
+				item->device_id = it.second.get<std::string>("<xmlattr>.device_id", "");
+				item->summary_time = it.second.get<std::string>("<xmlattr>.summary_time", v3::datetime::current_datetime().to_string("yyyy-MM-dd HH:mm:ss"));
+				item->running_distance = it.second.get<double>("<xmlattr>.running_distance", 0);
+				item->speed = it.second.get<double>("<xmlattr>.speed", 0);
+				item->express_type = it.second.get<int>("<xmlattr>.express_type", 0);
+				item->lattice_count = it.second.get<int>("<xmlattr>.lattice_count", 0);
+				item->supply_count = it.second.get<int>("<xmlattr>.supply_count", 0);
+				item->reflux_count = it.second.get<int>("<xmlattr>.reflux_count", 0);
+				item->supply_summay = it.second.get<std::string>("<xmlattr>.supply_summay", "");
+				item->lattice_summay = it.second.get<std::string>("<xmlattr>.lattice_summay", "");
+				item->reflux_summay = it.second.get<std::string>("<xmlattr>.reflux_summay", "");
+				item->enable = it.second.get<bool>("<xmlattr>.enable", false);
+				item->remarks = it.second.get<std::string>("<xmlattr>.remarks", "");
+				web_sync_config_info_list_.push_back(item);
+			}
+			web_user_config_info_list_.clear();
+			for (auto& it : root.get_child("root.user_config")) {
+				if (it.first != "item") continue;
+				std::shared_ptr<web_user_config_info> item(new web_user_config_info);
+				item->id = it.second.get<int>("<xmlattr>.id", 0);
+				item->modify_time = it.second.get<std::string>("<xmlattr>.modify_time", v3::datetime::current_datetime().to_string("yyyy-MM-dd HH:mm:ss"));
+				item->name = it.second.get<std::string>("<xmlattr>.name", "");
+				item->code = it.second.get<std::string>("<xmlattr>.code", "");
+				item->password = it.second.get<std::string>("<xmlattr>.password", "");
+				item->enable = it.second.get<bool>("<xmlattr>.enable", false);
+				item->remarks = it.second.get<std::string>("<xmlattr>.remarks", "");
+				web_user_config_info_list_.push_back(item);
+			}
+		}
+		catch (std::exception const& ec) {
+			LOG_ERROR << "读取xml配置异常" << ec;
+		}
+	}
+	void save() {
+		std::lock_guard<std::mutex> lock(mutex_);
+		boost::property_tree::ptree root;
+		try {
+			auto& tmp_drop_config = root.add("root.drop_config", "");
+			for (auto& it : web_drop_config_info_list_) {
+				auto& item = tmp_drop_config.add("item", "");
+				item.put("<xmlattr>.id", it->id);
+				item.put("<xmlattr>.modify_time", it->modify_time.to_string("yyyy-MM-dd HH:mm:ss"));
+				item.put("<xmlattr>.type", it->type);
+				item.put("<xmlattr>.name", it->name);
+				item.put("<xmlattr>.enable", it->enable);
+				item.put("<xmlattr>.remarks", it->remarks);
+			}
+			auto& tmp_general_config = root.add("root.general_config", "");
+			for (auto& it : web_general_config_info_list_) {
+				auto& item = tmp_general_config.add("item", "");
+				item.put("<xmlattr>.id", it->id);
+				item.put("<xmlattr>.modify_time", it->modify_time.to_string("yyyy-MM-dd HH:mm:ss"));
+				item.put("<xmlattr>.key", it->key);
+				item.put("<xmlattr>.value", it->value);
+				item.put("<xmlattr>.enable", it->enable);
+				item.put("<xmlattr>.remarks", it->remarks);
+			}
+			auto& tmp_regex_config = root.add("root.regex_config", "");
+			for (auto& it : web_regex_config_info_list_) {
+				auto& item = tmp_regex_config.add("item", "");
+				item.put("<xmlattr>.id", it->id);
+				item.put("<xmlattr>.modify_time", it->modify_time.to_string("yyyy-MM-dd HH:mm:ss"));
+				item.put("<xmlattr>.type", it->type);
+				item.put("<xmlattr>.name", it->name);
+				item.put("<xmlattr>.regex", it->regex);
+				item.put("<xmlattr>.enable", it->enable);
+				item.put("<xmlattr>.remarks", it->remarks);
+			}
+			auto& tmp_sync_config = root.add("root.sync_config", "");
+			for (auto& it : web_sync_config_info_list_) {
+				auto& item = tmp_sync_config.add("item", "");
+				item.put("<xmlattr>.id", it->id);
+				item.put("<xmlattr>.create_time", it->create_time.to_string("yyyy-MM-dd HH:mm:ss"));
+				item.put("<xmlattr>.device_id", it->device_id);
+				item.put("<xmlattr>.summary_time", it->summary_time.to_string("yyyy-MM-dd HH:mm:ss"));
+				item.put("<xmlattr>.running_distance", it->running_distance);
+				item.put("<xmlattr>.speed", it->speed);
+				item.put("<xmlattr>.express_type", it->express_type);
+				item.put("<xmlattr>.lattice_count", it->lattice_count);
+				item.put("<xmlattr>.supply_count", it->supply_count);
+				item.put("<xmlattr>.reflux_count", it->reflux_count);
+				item.put("<xmlattr>.supply_summay", it->supply_summay);
+				item.put("<xmlattr>.lattice_summay", it->lattice_summay);
+				item.put("<xmlattr>.reflux_summay", it->reflux_summay);
+				item.put("<xmlattr>.enable", it->enable);
+				item.put("<xmlattr>.remarks", it->remarks);
+			}
+			auto& tmp_user_config = root.add("root.user_config", "");
+			for (auto& it : web_user_config_info_list_) {
+				auto& item = tmp_user_config.add("item", "");
+				item.put("<xmlattr>.id", it->id);
+				item.put("<xmlattr>.modify_time", it->modify_time.to_string("yyyy-MM-dd HH:mm:ss"));
+				item.put("<xmlattr>.name", it->name);
+				item.put("<xmlattr>.code", it->code);
+				item.put("<xmlattr>.password", it->password);
+				item.put("<xmlattr>.enable", it->enable);
+				item.put("<xmlattr>.remarks", it->remarks);
+			}
+			boost::property_tree::xml_writer_settings<std::string> settings(' ', 4);
+			write_xml("./config/config.xml", root, std::locale(), settings);
+		}
+		catch (std::exception const& ec) {
+			LOG_ERROR << "保存xml配置异常" << ec;
+		}
+	}
 private:
-    /**
-     * @brief 在表格保存操作中,根据条件决定是否执行保存。
-     * @tparam _Table 表格数据的类型。
-     * @param value 当前表格的值。
-     * @param value_tmp 临时表格的值。
-     * @param type 更改类型,指示表格发生了什么类型的更改(v3::linq_change_type)。
-     * @param end 布尔值,指示是否为保存操作的结束阶段。
-     */
-    template<typename _Table>
-    void on_table_save(_Table const& value, _Table const& value_tmp, v3::linq_change_type type, bool end) {
-        if (end) {
-            save();
-        }
-    }
+	template<typename _Table>
+	void on_table_save(_Table const& value, _Table const& value_tmp, v3::linq_change_type type, bool end) {
+		if (end) {
+			save();
+		}
+	}
+	bool create_file(std::filesystem::path const&filename = "./config/config.xml") {
+	    if (!std::filesystem::exists(filename.parent_path())) {
+	        if (!std::filesystem::create_directories(filename.parent_path()))
+	            return false;
+	    }
+	    if (!std::filesystem::exists(filename)) {
+	        std::ofstream file(filename);
+	        if (!file.is_open())
+	            return false;
+	        file.close();
+			web_user_config_info_list_.push_back(std::make_shared<web_user_config_info>(web_user_config_info{
+				1,
+				robotics::v3::datetime::current_datetime(),
+				"管理员",
+				"admin",
+				"123456",
+				true,
+				"管理员"}));
+			save();
+	    }
+	    return true;
+	}
 private:
-    std::mutex												        mutex_;
-    std::vector<std::shared_ptr<web_user_config_info>>	            user_config_list_;
-    std::shared_ptr<v3::linq_ptr<web_user_config_info>>	            linq_user_config_;
-
-    std::vector<std::shared_ptr<web_drop_config_info>>	            drop_config_list_;
-    std::shared_ptr<v3::linq_ptr<web_drop_config_info>>	            linq_drop_config_;
-
-    std::vector<std::shared_ptr<web_regex_config_info>>	            regex_config_list_;
-    std::shared_ptr<v3::linq_ptr<web_regex_config_info>>	        linq_regex_config_;
-
-    std::vector<std::shared_ptr<web_general_config_info>>	        general_config_list_;
-    std::shared_ptr<v3::linq_ptr<web_general_config_info>>	        linq_general_config_;
-
-    std::vector<std::shared_ptr<web_sync_config_info>>	            sync_config_list_;
-    std::shared_ptr<v3::linq_ptr<web_sync_config_info>>	            linq_sync_config_;
+	std::mutex mutex_;
+	std::vector<std::shared_ptr<web_drop_config_info>> web_drop_config_info_list_;
+	std::shared_ptr<v3::linq_ptr<web_drop_config_info>> linq_web_drop_config_info_;
+	std::vector<std::shared_ptr<web_general_config_info>> web_general_config_info_list_;
+	std::shared_ptr<v3::linq_ptr<web_general_config_info>> linq_web_general_config_info_;
+	std::vector<std::shared_ptr<web_regex_config_info>> web_regex_config_info_list_;
+	std::shared_ptr<v3::linq_ptr<web_regex_config_info>> linq_web_regex_config_info_;
+	std::vector<std::shared_ptr<web_sync_config_info>> web_sync_config_info_list_;
+	std::shared_ptr<v3::linq_ptr<web_sync_config_info>> linq_web_sync_config_info_;
+	std::vector<std::shared_ptr<web_user_config_info>> web_user_config_info_list_;
+	std::shared_ptr<v3::linq_ptr<web_user_config_info>> linq_web_user_config_info_;
 };

+ 100 - 49
src/xml/xml_config.hpp → src/xml/xml_update.hpp

@@ -4,24 +4,13 @@
 #include <sstream>
 #include <vector>
 //local
-#include "../xml/xml_context.hpp"
+#include "xml_context.hpp"
 
-/**
- * @brief 用于定义一个以 _Table 为模板参数的空结构体。
- * @tparam _Table 要用于结构体的类型。
- */
 template<typename _Table>
 struct _update_ {};
-/**
- * @brief 更新指定的 web_drop_config_info 实例:先根据 id 删除已有项,再追加新的值并提交更改。
- */
 template<>
 struct _update_<web_drop_config_info> {
-	/**
-	 * @brief 更新或添加 web_after_config_info 配置信息到 XML 上下文中。
-	 * @param value 要更新或添加的 web_after_config_info 对象。
-	 */
-	static void invoke(web_drop_config_info const& value) {
+	_update_(web_drop_config_info const&value) {
 		if (xml_context::from<web_drop_config_info>().where([value](auto it) {return it->type == value.type; }).empty()) {
 			web_drop_config_info info{
 				.id = 0,
@@ -30,7 +19,6 @@ struct _update_<web_drop_config_info> {
 				.name = value.name,
 				.enable = value.enable,
 				.remarks = value.remarks };
-
 			xml_context::from<web_drop_config_info>().
 				max(info.id, [](auto it) {return it->id; }).
 				inc(info.id).
@@ -56,16 +44,9 @@ struct _update_<web_drop_config_info> {
 		}
 	}
 };
-/**
- * @brief 更新或添加 web_general_config_info 配置信息到 XML 上下文中。
- */
 template<>
 struct _update_<web_general_config_info> {
-	/**
-	 * @brief 检查是否存在指定的 key,如果不存在则添加新的配置项,否则更新现有配置项。
-	 * @param value 要更新或添加的 web_general_config_info 对象。
-	 */
-	static void invoke(web_general_config_info const& value) {
+	_update_(web_general_config_info const&value) {
 		if (xml_context::from<web_general_config_info>().where([value](auto it) {return it->key == value.key; }).empty()) {
 			web_general_config_info info{
 				.id = 0,
@@ -74,7 +55,6 @@ struct _update_<web_general_config_info> {
 				.value = value.value,
 				.enable = value.enable,
 				.remarks = value.remarks };
-
 			xml_context::from<web_general_config_info>().
 				max(info.id, [](auto it) {return it->id; }).
 				inc(info.id).
@@ -96,20 +76,13 @@ struct _update_<web_general_config_info> {
 						it->remarks = value.remarks;
 						return true;
 					}).
-						submit();
+				submit();
 		}
 	}
 };
-/**
- * @brief 将 web_regex_config_info 配置信息更新或添加到 XML 上下文中。
- */
 template<>
 struct _update_<web_regex_config_info> {
-	/**
-	 * @brief 更新或添加 web_after_config_info 配置信息到 XML 上下文中。
-	 * @param value 要更新或添加的 web_after_config_info 对象。
-	 */
-	static void invoke(web_regex_config_info const& value) {
+	_update_(web_regex_config_info const&value) {
 		if (xml_context::from<web_regex_config_info>().where([value](auto it) {return it->type == value.type; }).empty()) {
 			web_regex_config_info info{
 				.id = 0,
@@ -119,7 +92,6 @@ struct _update_<web_regex_config_info> {
 				.regex = value.regex,
 				.enable = value.enable,
 				.remarks = value.remarks };
-
 			xml_context::from<web_regex_config_info>().
 				max(info.id, [](auto it) {return it->id; }).
 				inc(info.id).
@@ -146,29 +118,108 @@ struct _update_<web_regex_config_info> {
 		}
 	}
 };
-/**
- * @brief 用于更新指定表或表项的数据。
- */
-class xml_config {
+template<>
+struct _update_<web_sync_config_info> {
+	_update_(web_sync_config_info const&value) {
+		if (xml_context::from<web_sync_config_info>().where([value](auto it) {return it->id == value.id; }).empty()) {
+			web_sync_config_info info{
+				.id = 0,
+				.create_time = v3::datetime::current_time_stamp(),
+				.device_id = value.device_id,
+				.summary_time = value.summary_time,
+				.running_distance = value.running_distance,
+				.speed = value.speed,
+				.express_type = value.express_type,
+				.lattice_count = value.lattice_count,
+				.supply_count = value.supply_count,
+				.reflux_count = value.reflux_count,
+				.supply_summay = value.supply_summay,
+				.lattice_summay = value.lattice_summay,
+				.reflux_summay = value.reflux_summay,
+				.enable = value.enable,
+				.remarks = value.remarks };
+			xml_context::from<web_sync_config_info>().
+				max(info.id, [](auto it) {return it->id; }).
+				inc(info.id).
+				append(info).
+				submit();
+		}
+		else {
+			xml_context::from<web_sync_config_info>().
+				where([value](auto it)
+					{
+						return it->id == value.id;
+					}).
+				update([value](auto it)
+					{
+						it->create_time = v3::datetime::current_time_stamp();
+						it->device_id = value.device_id;
+						it->summary_time = value.summary_time;
+						it->running_distance = value.running_distance;
+						it->speed = value.speed;
+						it->express_type = value.express_type;
+						it->lattice_count = value.lattice_count;
+						it->supply_count = value.supply_count;
+						it->reflux_count = value.reflux_count;
+						it->supply_summay = value.supply_summay;
+						it->lattice_summay = value.lattice_summay;
+						it->reflux_summay = value.reflux_summay;
+						it->enable = value.enable;
+						it->remarks = value.remarks;
+						return true;
+					}).
+				submit();
+		}
+	}
+};
+template<>
+struct _update_<web_user_config_info> {
+	_update_(web_user_config_info const&value) {
+		if (xml_context::from<web_user_config_info>().where([value](auto it) {return it->id == value.id; }).empty()) {
+			web_user_config_info info{
+				.id = 0,
+				.modify_time = v3::datetime::current_time_stamp(),
+				.name = value.name,
+				.code = value.code,
+				.password = value.password,
+				.enable = value.enable,
+				.remarks = value.remarks };
+			xml_context::from<web_user_config_info>().
+				max(info.id, [](auto it) {return it->id; }).
+				inc(info.id).
+				append(info).
+				submit();
+		}
+		else {
+			xml_context::from<web_user_config_info>().
+				where([value](auto it)
+					{
+						return it->id == value.id;
+					}).
+				update([value](auto it)
+					{
+						it->modify_time = v3::datetime::current_time_stamp();
+						it->name = value.name;
+						it->code = value.code;
+						it->password = value.password;
+						it->enable = value.enable;
+						it->remarks = value.remarks;
+						return true;
+					}).
+				submit();
+		}
+	}
+};
+class xml_update {
 public:
-	/**
-	 * @brief 更新指定表的数据。
-	 * @tparam _Table 要更新的数据表类型。
-	 * @param value 要更新的数据表对象的常量引用。
-	 */
 	template<typename _Table>
 	static void update(_Table const& value) {
-		_update_<_Table>::invoke(value);
+		(_update_<_Table>)(value);
 	}
-	/**
-	 * @brief 使用给定的值集合更新表项。
-	 * @tparam _Table 表示表项类型的模板参数。
-	 * @param values 包含要更新的表项的常量引用向量。
-	 */
 	template<typename _Table>
 	static void update(std::vector<_Table> const& values) {
 		for (auto const& value : values) {
-			_update_<_Table>::invoke(value);
+			(_update_<_Table>)(value);
 		}
 	}
 };