From e491cdb48129752324c4e3764f99bd9203c56dec Mon Sep 17 00:00:00 2001
From: lgq <1015864684@qq.com>
Date: 星期二, 31 三月 2026 09:48:44 +0800
Subject: [PATCH] 1.新增VF205门禁机代码
---
vf205_access/dxmodules/dxSqlite.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/vf205_access/dxmodules/dxSqlite.js b/vf205_access/dxmodules/dxSqlite.js
new file mode 100644
index 0000000..b4c44ab
--- /dev/null
+++ b/vf205_access/dxmodules/dxSqlite.js
@@ -0,0 +1,54 @@
+//build: 20240525
+//渚濊禆缁勪欢:dxCommon
+import { sqliteClass } from './libvbar-m-dxsqlite.so'
+import dxCommon from './dxCommon.js'
+const sqliteObj = new sqliteClass();
+const sqlite = {}
+
+/**
+ * 鍒濆鍖栨暟鎹簱
+ * @param {string} path db鏂囦欢鍏ㄨ矾寰勶紝蹇呭~
+ * @param {string} id 鍙ユ焺id锛岄潪蹇呭~锛堣嫢鍒濆鍖栧涓疄渚嬮渶瑕佷紶鍏ュ敮涓�id锛�
+ */
+sqlite.init = function (path, id) {
+ if (path == undefined || path.length == 0) {
+ throw new Error("dxsqliteObj.initDb:path should not be null or empty")
+ }
+ let pointer = sqliteObj.open(path);
+ dxCommon.handleId("sqlite", id, pointer)
+}
+
+/**
+ * 鎵ц璇彞
+ * @param {string} sql 鑴氭湰璇彞锛屽繀濉�
+ * @param {string} id 鍙ユ焺id锛岄潪蹇呭~锛堥渶淇濇寔鍜宨nit涓殑id涓�鑷达級
+ * @returns 0:鎴愬姛锛岄潪0澶辫触
+ */
+sqlite.exec = function (sql, id) {
+ let pointer = dxCommon.handleId("sqlite", id)
+ return sqliteObj.sql_exec(pointer, sql)
+}
+
+
+/**
+ * 鎵ц鏌ヨ璇彞
+ * @param {string} sql 鑴氭湰璇彞锛屽繀濉�
+ * @param {string} id 鍙ユ焺id锛岄潪蹇呭~锛堥渶淇濇寔鍜宨nit涓殑id涓�鑷达級
+ * @returns 鏌ヨ缁撴灉锛屽舰濡傦細[{"id":"1","type":200,"code":"aad7485a","door":"澶ч棬","extra":"","tiemType":0,"beginTime":1716613766,"endTime":1716613766,"repeatBeginTime":1716613766,"repeatEndTime":1716613766,"period":"extra"}]
+ */
+sqlite.select = function (sql, id) {
+ let pointer = dxCommon.handleId("sqlite", id)
+ return sqliteObj.select(pointer, sql);
+}
+
+/**
+ * 鍏抽棴鏁版嵁搴撹繛鎺�
+ * @param {string} id 鍙ユ焺id锛岄潪蹇呭~锛堥渶淇濇寔鍜宨nit涓殑id涓�鑷达級
+ * @returns 0:鎴愬姛锛岄潪0澶辫触
+ */
+sqlite.close = function (id) {
+ let pointer = dxCommon.handleId("sqlite", id)
+ return sqliteObj.close(pointer)
+}
+
+export default sqlite;
\ No newline at end of file
--
Gitblit v1.9.3