git hace 2 años
commit
9e82cd0d24

+ 2 - 0
.data/log/route/2022-10-09/tslog/route_error.txt

@@ -0,0 +1,2 @@
+[22-10-09 15:37:26]Instantiation RouteTableStore fail EndPoint:  AccessKeyID:  AccessKeySecret:  InstanceName:  OTS_DSN not configed
+[22-10-09 15:37:26]Instantiation RouteRedisStore fail  REDIS_DSN not configed

+ 394 - 0
.data/log/workerman/APP_PREFIX.log

@@ -0,0 +1,394 @@
+2022-10-09 16:21:00 pid:32026 Workerman[index.php] start in DEBUG mode
+2022-10-09 16:21:29 pid:32026 worker[none:32064] exit with status 65280
+2022-10-09 16:21:58 pid:32026 Workerman[index.php] Stopping ...
+2022-10-09 16:21:58 pid:32026 Workerman[index.php] has been stopped
+2022-10-09 16:27:29 pid:12881 Workerman[index.php] start in DEBUG mode
+2022-10-09 16:27:32 pid:12881 worker[none:12884] exit with status 65280
+2022-10-09 16:27:52 pid:12881 Workerman[index.php] Stopping ...
+2022-10-09 16:27:52 pid:12881 Workerman[index.php] has been stopped
+2022-10-09 16:28:43 pid:14831 Workerman[index.php] start in DEBUG mode
+2022-10-09 16:28:47 pid:14831 worker[none:14841] exit with status 65280
+2022-10-09 16:29:34 pid:14831 Workerman[index.php] Stopping ...
+2022-10-09 16:29:34 pid:14831 Workerman[index.php] has been stopped
+2022-10-09 16:36:03 pid:29810 Workerman[index.php] start in DEBUG mode
+2022-10-09 16:36:07 pid:29810 worker[none:29814] exit with status 65280
+2022-10-09 16:37:06 pid:29810 Workerman[index.php] Stopping ...
+2022-10-09 16:37:06 pid:29810 Workerman[index.php] has been stopped
+2022-10-09 16:37:07 pid:32032 Workerman[index.php] start in DEBUG mode
+2022-10-09 16:37:47 pid:32032 Workerman[index.php] Stopping ...
+2022-10-09 16:37:47 pid:32032 Workerman[index.php] has been stopped
+2022-10-09 16:37:49 pid:1147 Workerman[index.php] start in DEBUG mode
+2022-10-09 16:38:20 pid:1147 Workerman[index.php] Stopping ...
+2022-10-09 16:38:20 pid:1147 Workerman[index.php] has been stopped
+2022-10-09 16:38:21 pid:2376 Workerman[index.php] start in DEBUG mode
+2022-10-09 16:38:32 pid:2376 Workerman[index.php] Stopping ...
+2022-10-09 16:38:33 pid:2376 Workerman[index.php] has been stopped
+2022-10-09 16:38:48 pid:3339 Workerman[index.php] start in DEBUG mode
+2022-10-09 16:40:51 pid:3339 Workerman[index.php] Stopping ...
+2022-10-09 16:40:51 pid:3339 Workerman[index.php] has been stopped
+2022-10-09 16:44:21 pid:16383 Workerman[index.php] start in DEBUG mode
+2022-10-09 16:47:20 pid:16383 Workerman[index.php] Stopping ...
+2022-10-09 16:47:20 pid:16383 Workerman[index.php] has been stopped
+2022-10-09 16:47:21 pid:23010 Workerman[index.php] start in DEBUG mode
+2022-10-09 16:50:58 pid:23010 Workerman[index.php] Stopping ...
+2022-10-09 16:50:58 pid:23010 Workerman[index.php] has been stopped
+2022-10-09 18:02:51 pid:28996 Workerman[index.php] start in DEBUG mode
+2022-10-09 18:02:56 pid:29063 exception 'ThinkException' with message 'Action:fun您所请求的方法不存在!' in /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/Common/functions.php:75
+Stack trace:
+#0 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/Lib/Core/Action.class.php(268): throw_exception('Action:fun\xE6\x82\xA8\xE6\x89...')
+#1 /data/wwwroot/nbfd.rltest.cn/Home/Lib/Action/NingboAction.class.php(38): Action->__call('fun', Array)
+#2 /data/wwwroot/nbfd.rltest.cn/Home/Lib/Action/NingboAction.class.php(38): NingboAction->fun(Object(Workerman\Connection\TcpConnection), Array)
+#3 [internal function]: NingboAction->{closure}(Object(Workerman\Connection\TcpConnection), Array, '\xAA\xAA\xFF\x04\xB2\x8F\xFE\x83\x00\x00\xC9\x84')
+#4 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-workerman352/Connection/TcpConnection.php(632): call_user_func(Object(Closure), Object(Workerman\Connection\TcpConnection), Array, '\xAA\xAA\xFF\x04\xB2\x8F\xFE\x83\x00\x00\xC9\x84')
+#5 [internal function]: Workerman\Connection\TcpConnection->baseRead(Resource id #87, 2, NULL)
+#6 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-workerman352/Events/Libevent.php(202): event_base_loop(Resource id #80)
+#7 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-workerman352/Worker.php(1763): Workerman\Events\Libevent->loop()
+#8 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-workerman352/Worker.php(1051): Workerman\Worker->run()
+#9 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-workerman352/Worker.php(1014): Workerman\Worker::forkOneWorker(Object(Workerman\Worker))
+#10 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-workerman352/Worker.php(431): Workerman\Worker::forkWorkers()
+#11 /data/wwwroot/nbfd.rltest.cn/Home/Lib/Action/NingboAction.class.php(45): Workerman\Worker::runAll()
+#12 [internal function]: NingboAction->dahua()
+#13 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/Lib/Core/App.class.php(160): ReflectionMethod->invoke(Object(NingboAction))
+#14 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/Lib/Core/App.class.php(198): App::exec()
+#15 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/Lib/Core/Think.class.php(68): App::run()
+#16 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/Common/runtime.php(245): Think::start()
+#17 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/ThinkPHP.php(151): require('/data/wwwroot/n...')
+#18 /data/wwwroot/nbfd.rltest.cn/index.php(27): require('/data/wwwroot/n...')
+#19 {main}
+2022-10-09 18:02:56 pid:29063 Worker[29063] process terminated
+2022-10-09 18:02:56 pid:28996 worker[none:29063] exit with status 64000
+2022-10-09 18:03:03 pid:28996 Workerman[index.php] Stopping ...
+2022-10-09 18:03:03 pid:28996 Workerman[index.php] has been stopped
+2022-10-09 18:06:38 pid:4795 Workerman[index.php] start in DEBUG mode
+2022-10-09 18:06:43 pid:4795 worker[none:4807] exit with status 65280
+2022-10-09 18:07:33 pid:4795 Workerman[index.php] Stopping ...
+2022-10-09 18:07:33 pid:4795 Workerman[index.php] has been stopped
+2022-10-09 18:07:34 pid:6779 Workerman[index.php] start in DEBUG mode
+2022-10-09 18:07:44 pid:6779 Workerman[index.php] Stopping ...
+2022-10-09 18:07:44 pid:6779 Workerman[index.php] has been stopped
+2022-10-11 14:25:11 pid:27111 Workerman[index.php] start in DEBUG mode
+2022-10-11 14:26:10 pid:27111 worker[none:27151] exit with status 65280
+2022-10-11 14:26:18 pid:27111 Workerman[index.php] Stopping ...
+2022-10-11 14:26:18 pid:27111 Workerman[index.php] has been stopped
+2022-10-11 14:28:55 pid:3415 Workerman[index.php] start in DEBUG mode
+2022-10-11 14:29:00 pid:3415 worker[none:3423] exit with status 65280
+2022-10-11 14:30:40 pid:3415 Workerman[index.php] Stopping ...
+2022-10-11 14:30:41 pid:3415 Workerman[index.php] has been stopped
+2022-10-11 14:31:28 pid:9435 Workerman[index.php] start in DEBUG mode
+2022-10-11 14:31:32 pid:9437 exception 'ThinkException' with message 'Action:getb您所请求的方法不存在!' in /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/Common/functions.php:75
+Stack trace:
+#0 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/Lib/Core/Action.class.php(268): throw_exception('Action:getb\xE6\x82\xA8\xE6...')
+#1 /data/wwwroot/nbfd.rltest.cn/Home/Lib/Class/DahuaUtil.php(33): Action->__call('getb', Array)
+#2 /data/wwwroot/nbfd.rltest.cn/Home/Lib/Class/DahuaUtil.php(33): NingboAction->getb(0, 7)
+#3 /data/wwwroot/nbfd.rltest.cn/Home/Lib/Action/NingboAction.class.php(69): Jiaruan\DahuaUtil->getBit(0, Array)
+#4 /data/wwwroot/nbfd.rltest.cn/Home/Lib/Action/NingboAction.class.php(35): NingboAction->fun80(Object(Workerman\Connection\TcpConnection), Array)
+#5 [internal function]: NingboAction->{closure}(Object(Workerman\Connection\TcpConnection), Array, '\xAA\xAA\xFF\x04\xB2\x8F\xFF\x80\x00\x01\x00w\xF5')
+#6 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-workerman352/Connection/TcpConnection.php(632): call_user_func(Object(Closure), Object(Workerman\Connection\TcpConnection), Array, '\xAA\xAA\xFF\x04\xB2\x8F\xFF\x80\x00\x01\x00w\xF5')
+#7 [internal function]: Workerman\Connection\TcpConnection->baseRead(Resource id #87, 2, NULL)
+#8 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-workerman352/Events/Libevent.php(202): event_base_loop(Resource id #80)
+#9 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-workerman352/Worker.php(1763): Workerman\Events\Libevent->loop()
+#10 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-workerman352/Worker.php(1051): Workerman\Worker->run()
+#11 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-workerman352/Worker.php(1014): Workerman\Worker::forkOneWorker(Object(Workerman\Worker))
+#12 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-workerman352/Worker.php(431): Workerman\Worker::forkWorkers()
+#13 /data/wwwroot/nbfd.rltest.cn/Home/Lib/Action/NingboAction.class.php(45): Workerman\Worker::runAll()
+#14 [internal function]: NingboAction->dahua()
+#15 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/Lib/Core/App.class.php(160): ReflectionMethod->invoke(Object(NingboAction))
+#16 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/Lib/Core/App.class.php(198): App::exec()
+#17 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/Lib/Core/Think.class.php(68): App::run()
+#18 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/Common/runtime.php(245): Think::start()
+#19 /data/wwwroot/nbfd.rltest.cn/vendor/zmcoding/php-tp313/ThinkPHP.php(151): require('/data/wwwroot/n...')
+#20 /data/wwwroot/nbfd.rltest.cn/index.php(27): require('/data/wwwroot/n...')
+#21 {main}
+2022-10-11 14:31:32 pid:9437 Worker[9437] process terminated
+2022-10-11 14:31:32 pid:9435 worker[none:9437] exit with status 64000
+2022-10-11 14:31:44 pid:9435 Workerman[index.php] Stopping ...
+2022-10-11 14:31:44 pid:9435 Workerman[index.php] has been stopped
+2022-10-11 14:32:32 pid:11939 Workerman[index.php] start in DEBUG mode
+2022-10-11 14:32:37 pid:11939 worker[none:11941] exit with status 65280
+2022-10-11 14:34:11 pid:11939 Workerman[index.php] Stopping ...
+2022-10-11 14:34:11 pid:11939 Workerman[index.php] has been stopped
+2022-10-11 14:34:12 pid:16944 Workerman[index.php] start in DEBUG mode
+2022-10-11 14:34:42 pid:16944 Workerman[index.php] Stopping ...
+2022-10-11 14:34:42 pid:16944 Workerman[index.php] has been stopped
+2022-10-11 14:34:55 pid:18744 Workerman[index.php] start in DEBUG mode
+2022-10-11 14:53:06 pid:30608 Workerman[index.php] status 
+2022-10-11 16:01:41 pid:18744 Workerman[index.php] Stopping ...
+2022-10-11 16:01:41 pid:18744 Workerman[index.php] has been stopped
+2022-10-11 16:01:43 pid:11531 Workerman[index.php] start in DEBUG mode
+2022-10-11 16:02:05 pid:11531 Workerman[index.php] Stopping ...
+2022-10-11 16:02:07 pid:11531 worker[none:11542] exit with status 9
+2022-10-11 16:02:07 pid:11531 Workerman[index.php] has been stopped
+2022-10-11 16:04:56 pid:18596 Workerman[index.php] start in DEBUG mode
+2022-10-11 16:05:00 pid:18596 Workerman[index.php] Stopping ...
+2022-10-11 16:05:00 pid:18596 Workerman[index.php] has been stopped
+2022-10-11 16:05:10 pid:19191 Workerman[index.php] start in DEBUG mode
+2022-10-12 09:12:48 pid:19191 worker[none:19204] exit with status 5247
+2022-10-12 09:12:55 pid:19191 Workerman[index.php] Stopping ...
+2022-10-12 09:12:55 pid:19191 Workerman[index.php] has been stopped
+2022-10-12 13:32:42 pid:21847 Workerman[index.php] start in DEBUG mode
+2022-10-12 13:32:45 pid:21847 Workerman[index.php] Stopping ...
+2022-10-12 13:32:45 pid:21847 Workerman[index.php] has been stopped
+2022-10-12 13:32:57 pid:22154 Workerman[index.php] start in DEBUG mode
+2022-10-12 15:19:21 pid:22154 Workerman[index.php] Stopping ...
+2022-10-12 15:19:21 pid:22154 Workerman[index.php] has been stopped
+2022-10-12 15:20:56 pid:25367 Workerman[index.php] start in DEBUG mode
+2022-10-12 15:21:03 pid:25367 Workerman[index.php] Stopping ...
+2022-10-12 15:21:03 pid:25367 Workerman[index.php] has been stopped
+2022-10-12 15:21:11 pid:26123 Workerman[index.php] start in DEBUG mode
+2022-10-12 15:21:15 pid:26123 Workerman[index.php] Stopping ...
+2022-10-12 15:21:15 pid:26123 Workerman[index.php] has been stopped
+2022-10-12 15:21:25 pid:26764 Workerman[index.php] start in DEBUG mode
+2022-10-12 17:08:52 pid:26270 Workerman[index.php] status 
+2022-10-12 17:31:39 pid:17423 Workerman[index.php] status 
+2022-10-12 17:37:27 pid:26764 Workerman[index.php] Stopping ...
+2022-10-12 17:37:28 pid:26764 Workerman[index.php] has been stopped
+2022-10-12 17:37:31 pid:23668 Workerman[index.php] start in DEBUG mode
+2022-10-12 17:48:24 pid:2050 Workerman[index.php] status 
+2022-10-12 17:52:10 pid:5794 Workerman[index.php] status 
+2022-10-12 17:54:29 pid:7991 Workerman[index.php] status 
+2022-10-12 18:20:16 pid:2541 Workerman[index.php] status 
+2022-10-12 18:26:06 pid:23668 Workerman[index.php] Stopping ...
+2022-10-12 18:26:06 pid:23668 Workerman[index.php] has been stopped
+2022-10-12 18:49:06 pid:32296 Workerman[index.php] start in DEBUG mode
+2022-10-12 18:57:51 pid:8431 Workerman[index.php] status 
+2022-10-13 10:49:57 pid:7278 Workerman[index.php] status 
+2022-10-13 10:53:10 pid:13368 Workerman[index.php] status 
+2022-10-13 11:12:03 pid:32296 Workerman[index.php] Stopping ...
+2022-10-13 11:12:03 pid:32296 Workerman[index.php] has been stopped
+2022-10-13 11:12:15 pid:21420 Workerman[index.php] start in DAEMON mode
+2022-10-13 11:12:44 pid:21422 worker[none:21426] exit with status 65280
+2022-10-13 11:13:10 pid:23430 Workerman[index.php] stop 
+2022-10-13 11:13:10 pid:23430 Workerman[index.php] is stoping ...
+2022-10-13 11:13:10 pid:21422 Workerman[index.php] Stopping ...
+2022-10-13 11:13:10 pid:21422 Workerman[index.php] has been stopped
+2022-10-13 11:13:10 pid:23430 Workerman[index.php] stop success
+2022-10-13 11:13:16 pid:23635 Workerman[index.php] start in DEBUG mode
+2022-10-13 11:13:23 pid:23635 worker[none:23639] exit with status 65280
+2022-10-13 11:13:31 pid:23635 Workerman[index.php] Stopping ...
+2022-10-13 11:13:31 pid:23635 Workerman[index.php] has been stopped
+2022-10-13 11:14:15 pid:25639 Workerman[index.php] start in DEBUG mode
+2022-10-13 11:14:33 pid:25639 Workerman[index.php] Stopping ...
+2022-10-13 11:14:33 pid:25639 Workerman[index.php] has been stopped
+2022-10-13 11:21:12 pid:7283 Workerman[index.php] stop 
+2022-10-13 11:21:12 pid:7283 Workerman[index.php] not run
+2022-10-13 11:21:17 pid:7401 Workerman[index.php] start in DEBUG mode
+2022-10-13 11:21:21 pid:7401 Workerman[index.php] Stopping ...
+2022-10-13 11:21:21 pid:7401 Workerman[index.php] has been stopped
+2022-10-13 11:21:30 pid:7823 Workerman[index.php] start in DEBUG mode
+2022-10-13 11:34:18 pid:2513 Workerman[index.php] status 
+2022-10-13 12:13:12 pid:19439 Workerman[index.php] status 
+2022-10-13 12:16:33 pid:26339 Workerman[index.php] status 
+2022-10-13 14:06:51 pid:29952 Workerman[index.php] status 
+2022-10-13 14:13:48 pid:11588 Workerman[index.php] status 
+2022-10-13 14:21:01 pid:20157 Workerman[index.php] status 
+2022-10-13 14:22:41 pid:21285 Workerman[index.php] status 
+2022-10-13 14:24:34 pid:22500 Workerman[index.php] status 
+2022-10-13 14:30:50 pid:26722 Workerman[index.php] status 
+2022-10-13 14:32:22 pid:27695 Workerman[index.php] status 
+2022-10-13 14:35:24 pid:29889 Workerman[index.php] status 
+2022-10-13 14:40:08 pid:587 Workerman[index.php] status 
+2022-10-13 14:42:06 pid:1988 Workerman[index.php] status 
+2022-10-13 14:44:11 pid:3394 Workerman[index.php] status 
+2022-10-13 14:44:32 pid:3584 Workerman[index.php] status 
+2022-10-13 14:47:52 pid:5858 Workerman[index.php] status 
+2022-10-13 14:50:08 pid:7376 Workerman[index.php] status 
+2022-10-13 14:53:02 pid:9322 Workerman[index.php] status 
+2022-10-13 14:56:20 pid:7823 Workerman[index.php] Stopping ...
+2022-10-13 14:56:20 pid:7823 Workerman[index.php] has been stopped
+2022-10-13 14:56:37 pid:11718 Workerman[index.php] start in DEBUG mode
+2022-10-13 14:56:51 pid:11933 Workerman[index.php] status 
+2022-10-13 14:56:56 pid:11999 Workerman[index.php] status 
+2022-10-13 14:57:16 pid:12391 Workerman[index.php] status 
+2022-10-13 15:04:51 pid:18299 Workerman[index.php] status 
+2022-10-13 15:08:54 pid:20972 Workerman[index.php] status 
+2022-10-13 15:09:18 pid:21313 Workerman[index.php] status 
+2022-10-13 15:13:14 pid:11718 Workerman[index.php] Stopping ...
+2022-10-13 15:13:14 pid:11718 Workerman[index.php] has been stopped
+2022-10-13 15:13:22 pid:24121 Workerman[index.php] start in DEBUG mode
+2022-10-13 15:13:25 pid:24121 Workerman[index.php] Stopping ...
+2022-10-13 15:13:25 pid:24121 Workerman[index.php] has been stopped
+2022-10-13 15:13:26 pid:24143 Workerman[index.php] start in DEBUG mode
+2022-10-13 15:13:32 pid:24226 Workerman[index.php] status 
+2022-10-13 15:17:20 pid:26667 Workerman[index.php] status 
+2022-10-13 15:21:26 pid:29426 Workerman[index.php] status 
+2022-10-13 15:27:09 pid:687 Workerman[index.php] start in DEBUG mode
+2022-10-13 15:30:43 pid:3177 Workerman[index.php] status 
+2022-10-13 15:37:00 pid:7020 Workerman[index.php] status 
+2022-10-13 15:37:26 pid:7360 Workerman[index.php] status 
+2022-10-13 15:38:40 pid:8142 Workerman[index.php] status 
+2022-10-13 15:39:01 pid:8430 Workerman[index.php] status 
+2022-10-13 15:39:06 pid:8540 Workerman[index.php] status 
+2022-10-13 15:41:13 pid:10032 Workerman[index.php] status 
+2022-10-13 15:43:12 pid:11277 Workerman[index.php] status 
+2022-10-13 15:44:00 pid:11709 Workerman[index.php] status 
+2022-10-13 15:44:07 pid:11885 Workerman[index.php] status 
+2022-10-13 15:44:25 pid:12078 Workerman[index.php] status 
+2022-10-13 15:44:34 pid:687 Workerman[index.php] Stopping ...
+2022-10-13 15:44:34 pid:687 Workerman[index.php] has been stopped
+2022-10-13 15:44:40 pid:12273 Workerman[index.php] start in DEBUG mode
+2022-10-13 15:44:45 pid:12323 Workerman[index.php] status 
+2022-10-13 15:45:01 pid:12510 Workerman[index.php] status 
+2022-10-13 15:48:33 pid:15800 Workerman[index.php] status 
+2022-10-13 15:49:24 pid:16356 Workerman[index.php] status 
+2022-10-13 15:49:29 pid:16451 Workerman[index.php] status 
+2022-10-13 15:49:44 pid:16590 Workerman[index.php] status 
+2022-10-13 15:50:16 pid:17118 Workerman[index.php] status 
+2022-10-13 15:53:59 pid:19414 Workerman[index.php] status 
+2022-10-13 15:54:09 pid:19572 Workerman[index.php] status 
+2022-10-13 15:57:27 pid:21745 Workerman[index.php] status 
+2022-10-13 15:58:43 pid:22651 Workerman[index.php] status 
+2022-10-13 15:58:47 pid:22713 Workerman[index.php] status 
+2022-10-13 15:59:09 pid:23016 Workerman[index.php] status 
+2022-10-13 16:05:04 pid:27012 Workerman[index.php] status 
+2022-10-13 16:05:52 pid:27605 Workerman[index.php] status 
+2022-10-13 16:12:41 pid:31733 Workerman[index.php] status 
+2022-10-13 16:12:49 pid:31846 Workerman[index.php] status 
+2022-10-13 16:13:00 pid:32005 Workerman[index.php] status 
+2022-10-13 16:13:10 pid:32159 Workerman[index.php] status 
+2022-10-13 16:13:31 pid:32365 Workerman[index.php] status 
+2022-10-13 16:13:47 pid:32587 Workerman[index.php] status 
+2022-10-13 16:14:02 pid:32757 Workerman[index.php] stop 
+2022-10-13 16:14:02 pid:32757 Workerman[index.php] is stoping ...
+2022-10-13 16:14:02 pid:12273 Workerman[index.php] Stopping ...
+2022-10-13 16:14:02 pid:12273 Workerman[index.php] has been stopped
+2022-10-13 16:14:02 pid:32757 Workerman[index.php] stop success
+2022-10-13 16:14:25 pid:623 Workerman[index.php] start in DEBUG mode
+2022-10-13 16:19:51 pid:623 Workerman[index.php] Stopping ...
+2022-10-13 16:19:51 pid:623 Workerman[index.php] has been stopped
+2022-10-13 16:19:55 pid:4130 Workerman[index.php] start in DEBUG mode
+2022-10-13 16:25:32 pid:4130 Workerman[index.php] Stopping ...
+2022-10-13 16:25:32 pid:4130 Workerman[index.php] has been stopped
+2022-10-13 16:25:33 pid:7770 Workerman[index.php] start in DEBUG mode
+2022-10-13 16:26:14 pid:8212 Workerman[index.php] status 
+2022-10-13 16:33:27 pid:7770 Workerman[index.php] Stopping ...
+2022-10-13 16:33:27 pid:7770 Workerman[index.php] has been stopped
+2022-10-13 16:33:35 pid:12659 Workerman[index.php] start in DEBUG mode
+2022-10-13 16:34:19 pid:13137 Workerman[index.php] status 
+2022-10-13 16:34:44 pid:13499 Workerman[index.php] status 
+2022-10-13 16:35:06 pid:13925 Workerman[index.php] status 
+2022-10-13 16:50:12 pid:12659 Workerman[index.php] Stopping ...
+2022-10-13 16:50:13 pid:12659 Workerman[index.php] has been stopped
+2022-10-13 16:50:14 pid:24458 Workerman[index.php] start in DEBUG mode
+2022-10-13 16:54:51 pid:24458 Workerman[index.php] Stopping ...
+2022-10-13 16:54:51 pid:24458 Workerman[index.php] has been stopped
+2022-10-13 16:54:53 pid:27150 Workerman[index.php] start in DEBUG mode
+2022-10-13 17:00:46 pid:27150 Workerman[index.php] Stopping ...
+2022-10-13 17:00:46 pid:27150 Workerman[index.php] has been stopped
+2022-10-13 17:00:47 pid:30674 Workerman[index.php] start in DEBUG mode
+2022-10-13 17:01:27 pid:31195 Workerman[index.php] status 
+2022-10-13 17:08:45 pid:3259 Workerman[index.php] status 
+2022-10-13 17:08:57 pid:3365 Workerman[index.php] status 
+2022-10-13 17:09:09 pid:3581 Workerman[index.php] status 
+2022-10-13 17:09:26 pid:3797 Workerman[index.php] status 
+2022-10-13 17:10:06 pid:4249 Workerman[index.php] status 
+2022-10-13 17:11:26 pid:5027 Workerman[index.php] status 
+2022-10-13 17:16:47 pid:8292 Workerman[index.php] status 
+2022-10-13 17:16:56 pid:8371 Workerman[index.php] status 
+2022-10-13 19:10:05 pid:30674 Workerman[index.php] Stopping ...
+2022-10-13 19:10:05 pid:30674 Workerman[index.php] has been stopped
+2022-10-13 19:11:12 pid:12132 Workerman[index.php] start in DEBUG mode
+2022-10-13 19:11:47 pid:13337 Workerman[index.php] status 
+2022-10-13 19:11:56 pid:13850 Workerman[index.php] status 
+2022-10-13 19:12:06 pid:14528 Workerman[index.php] status 
+2022-10-13 19:12:56 pid:16785 Workerman[index.php] status 
+2022-10-13 19:13:48 pid:18525 Workerman[index.php] status 
+2022-10-13 19:15:24 pid:21836 Workerman[index.php] status 
+2022-10-13 19:15:38 pid:22401 Workerman[index.php] status 
+2022-10-13 19:15:50 pid:22807 Workerman[index.php] status 
+2022-10-13 19:16:58 pid:25074 Workerman[index.php] status 
+2022-10-13 19:18:34 pid:27916 Workerman[index.php] status 
+2022-10-13 19:20:18 pid:31008 Workerman[index.php] status 
+2022-10-13 19:20:30 pid:12132 Workerman[index.php] Stopping ...
+2022-10-13 19:20:30 pid:12132 Workerman[index.php] has been stopped
+2022-10-13 19:28:59 pid:17089 Workerman[index.php] status 
+2022-10-13 19:28:59 pid:17089 Workerman[index.php] not run
+2022-10-13 19:47:34 pid:23420 Workerman[index.php] start in DEBUG mode
+2022-10-13 19:47:37 pid:23499 Workerman[index.php] status 
+2022-10-13 19:48:06 pid:24492 Workerman[index.php] status 
+2022-10-13 19:48:30 pid:25280 Workerman[index.php] status 
+2022-10-13 19:49:27 pid:26955 Workerman[index.php] status 
+2022-10-13 19:50:19 pid:23420 Workerman[index.php] Stopping ...
+2022-10-13 19:50:21 pid:23420 worker[none:23425] exit with status 9
+2022-10-13 19:50:21 pid:23420 worker[none:23424] exit with status 9
+2022-10-13 19:50:21 pid:23420 worker[none:23422] exit with status 9
+2022-10-13 19:50:21 pid:23420 worker[none:23423] exit with status 9
+2022-10-13 19:50:21 pid:23420 Workerman[index.php] has been stopped
+2022-10-13 19:57:11 pid:9704 Workerman[index.php] start in DEBUG mode
+2022-10-13 19:57:48 pid:11011 Workerman[index.php] status 
+2022-10-13 19:58:02 pid:11532 Workerman[index.php] status 
+2022-10-13 20:08:51 pid:1222 Workerman[index.php] status 
+2022-10-13 20:09:07 pid:1895 Workerman[index.php] status 
+2022-10-13 20:10:50 pid:9704 Workerman[index.php] Stopping ...
+2022-10-13 20:10:50 pid:9704 Workerman[index.php] has been stopped
+2022-10-13 20:10:51 pid:5354 Workerman[index.php] start in DEBUG mode
+2022-10-13 20:11:11 pid:6051 Workerman[index.php] status 
+2022-10-13 20:12:36 pid:8526 Workerman[index.php] status 
+2022-10-13 20:12:58 pid:9125 Workerman[index.php] status 
+2022-10-13 20:27:43 pid:7296 Workerman[index.php] status 
+2022-10-13 20:31:53 pid:16697 Workerman[index.php] status 
+2022-10-13 20:34:29 pid:21507 Workerman[index.php] status 
+2022-10-14 17:59:44 pid:13453 Workerman[index.php] status 
+2022-10-14 18:00:59 pid:16934 Workerman[index.php] status 
+2022-10-15 09:56:36 pid:27843 Workerman[index.php] status 
+2022-10-15 10:21:15 pid:14031 Workerman[index.php] status 
+2022-10-15 10:21:21 pid:5354 Workerman[index.php] Stopping ...
+2022-10-15 10:21:21 pid:5354 Workerman[index.php] has been stopped
+2022-10-15 11:11:23 pid:22737 Workerman[index.php] start in DEBUG mode
+2022-10-15 11:12:42 pid:22737 Workerman[index.php] Stopping ...
+2022-10-15 11:12:42 pid:22737 Workerman[index.php] has been stopped
+2022-10-15 11:12:43 pid:25257 Workerman[index.php] start in DEBUG mode
+2022-10-15 11:16:45 pid:25257 Workerman[index.php] Stopping ...
+2022-10-15 11:16:47 pid:25257 worker[none:25261] exit with status 9
+2022-10-15 11:16:47 pid:25257 worker[none:25258] exit with status 9
+2022-10-15 11:16:47 pid:25257 worker[none:25259] exit with status 9
+2022-10-15 11:16:47 pid:25257 Workerman[index.php] has been stopped
+2022-10-15 11:22:07 pid:5774 Workerman[index.php] start in DEBUG mode
+2022-10-15 11:24:23 pid:5774 Workerman[index.php] Stopping ...
+2022-10-15 11:24:23 pid:5774 Workerman[index.php] has been stopped
+2022-10-15 11:34:36 pid:31813 Workerman[index.php] start in DEBUG mode
+2022-10-15 11:36:20 pid:31813 Workerman[index.php] Stopping ...
+2022-10-15 11:36:22 pid:31813 worker[none:31839] exit with status 9
+2022-10-15 11:36:22 pid:31813 worker[none:31840] exit with status 9
+2022-10-15 11:36:22 pid:31813 worker[none:31842] exit with status 9
+2022-10-15 11:36:22 pid:31813 worker[none:31841] exit with status 9
+2022-10-15 11:36:22 pid:31813 Workerman[index.php] has been stopped
+2022-10-15 11:44:29 pid:6476 Workerman[index.php] start in DEBUG mode
+2022-10-15 11:45:22 pid:6476 Workerman[index.php] Stopping ...
+2022-10-15 11:45:23 pid:6476 Workerman[index.php] has been stopped
+2022-10-15 11:48:48 pid:9120 Workerman[index.php] start in DEBUG mode
+2022-10-15 11:50:26 pid:9120 Workerman[index.php] Stopping ...
+2022-10-15 11:50:26 pid:9120 Workerman[index.php] has been stopped
+2022-10-15 11:52:01 pid:11239 Workerman[index.php] start in DEBUG mode
+2022-10-15 12:15:27 pid:11239 Workerman[index.php] Stopping ...
+2022-10-15 12:15:27 pid:11239 Workerman[index.php] has been stopped
+2022-10-15 12:17:20 pid:28379 Workerman[index.php] start in DEBUG mode
+2022-10-15 12:21:43 pid:28379 Workerman[index.php] Stopping ...
+2022-10-15 12:21:43 pid:28379 Workerman[index.php] has been stopped
+2022-10-15 12:21:44 pid:31213 Workerman[index.php] start in DEBUG mode
+2022-10-15 13:36:46 pid:31213 Workerman[index.php] Stopping ...
+2022-10-15 13:36:46 pid:31213 Workerman[index.php] has been stopped
+2022-10-15 13:46:00 pid:22005 Workerman[index.php] start in DEBUG mode
+2022-10-15 13:46:07 pid:22005 Workerman[index.php] Stopping ...
+2022-10-15 13:46:07 pid:22005 Workerman[index.php] has been stopped
+2022-10-15 13:46:12 pid:22245 Workerman[index.php] start in DEBUG mode
+2022-10-15 13:47:32 pid:22245 Workerman[index.php] Stopping ...
+2022-10-15 13:47:32 pid:22245 Workerman[index.php] has been stopped
+2022-10-18 17:42:30 pid:15788 Workerman[index.php] start in DEBUG mode
+2022-10-18 17:46:39 pid:15788 Workerman[index.php] Stopping ...
+2022-10-18 17:46:39 pid:15788 Workerman[index.php] has been stopped
+2022-10-18 17:46:42 pid:19022 Workerman[index.php] start in DEBUG mode
+2022-10-18 20:28:59 pid:19022 Workerman[index.php] Stopping ...
+2022-10-18 20:28:59 pid:19022 Workerman[index.php] has been stopped
+2022-10-18 20:31:02 pid:31494 Workerman[index.php] start in DEBUG mode
+2022-10-18 20:33:53 pid:31494 Workerman[index.php] Stopping ...
+2022-10-18 20:33:53 pid:31494 Workerman[index.php] has been stopped
+2022-10-19 10:39:35 pid:31308 Workerman[index.php] start in DEBUG mode
+2022-10-19 10:39:40 pid:31308 Workerman[index.php] Stopping ...
+2022-10-19 10:39:40 pid:31308 Workerman[index.php] has been stopped
+2022-10-19 10:39:44 pid:31637 Workerman[index.php] start in DEBUG mode
+2022-10-19 14:48:09 pid:7229 Workerman[index.php] status 
+2022-10-19 15:17:36 pid:31637 Workerman[index.php] Stopping ...
+2022-10-19 15:17:36 pid:31637 Workerman[index.php] has been stopped
+2022-10-19 16:03:32 pid:29513 Workerman[index.php] start in DEBUG mode
+2022-10-19 16:08:20 pid:29513 Workerman[index.php] Stopping ...
+2022-10-19 16:08:21 pid:29513 Workerman[index.php] has been stopped

+ 7 - 0
.gitignore

@@ -0,0 +1,7 @@
+Upload/
+.env
+.debug
+composer.lock
+vendor/
+oss.html
+workerman.pid

+ 1 - 0
Home/Common/common.php

@@ -0,0 +1 @@
+<?php

+ 15 - 0
Home/Lib/Action/IndexAction.class.php

@@ -0,0 +1,15 @@
+<?php
+
+
+
+class IndexAction extends Action {
+			
+
+
+ 
+	public  function index(  ){
+		Workerman\Worker::runAll();
+	}
+	
+
+}

+ 276 - 0
Home/Lib/Action/NingboAction.class.php

@@ -0,0 +1,276 @@
+<?php
+
+
+
+class NingboAction extends Action {
+			
+
+
+ 
+	public  function dahua(  ){
+		Vendor('Workerman352.Autoloader');
+		$worker = new \Workerman\Worker("Dahua://0.0.0.0:1234");
+		$worker->count = 4;
+		$worker->onWorkerStart  = function($worker){
+			 $timeInterval = 60 * 5;//秒
+		    \Workerman\Lib\Timer::add($timeInterval, function()
+		    {
+		        foreach(\Workerman\Connection\TcpConnection::$connections as $connection) {
+		            if (time() - $connection->recvTime > 10 * 60) {
+		                \Jiaruan\DahuaUtil::rlog("close idle", $connection->getRemoteIp() . ':' . $connection->getRemotePort());
+		                $connection->close();
+		            }
+		        }
+		    });
+			\Jiaruan\DahuaUtil::rlog("workstart");
+		};
+		
+		$worker->onConnect = function($connection){
+			$connection->recvTime = time();
+		    \Jiaruan\DahuaUtil::rlog('imsync', "[newConn]", $connection->getRemoteIp() . ':' . $connection->getRemotePort());
+		};
+		
+		$worker->onMessage = function($connection, $data){
+			 $fun = 'fun' . $data['cmd'];
+			 if (method_exists($this, $fun)){
+		    	$this->$fun($connection, $data);
+			 } else {
+				 \Jiaruan\DahuaUtil::rlog("ERR", "fun " . $fun . " not exists");
+			 }
+		};
+		
+		$worker->onClose = function($connection){
+			\Jiaruan\DahuaUtil::rlog('imsync', "[shutConn]", $connection->getRemoteIp() . ':' . $connection->getRemotePort());
+		};
+		
+		$worker->onError = function($connection, $code, $msg)
+		{
+			\Jiaruan\DahuaUtil::rlog("[ONERR]", $connection->getRemoteIp() . ':' . $connection->getRemotePort(), $code, $msg);
+		};
+		
+		$worker->onBufferFull = function($connection)
+		{
+		   \Jiaruan\DahuaUtil::rlog("[ONFULL]", $connection->getRemoteIp() . ':' . $connection->getRemotePort());
+		};
+		$worker->onBufferDrain = function($connection)
+		{
+		    \Jiaruan\DahuaUtil::rlog("[ONDRAIN]", $connection->getRemoteIp() . ':' . $connection->getRemotePort());
+		};
+		
+		\Workerman\Worker::runAll();
+	}
+	
+ 
+	private  function fun83( $connection, $data ){
+		//心跳 AAAAFF04B28FFE830000C984
+		\Jiaruan\DahuaUtil::rlog("heartbeat", $data['mac']);
+		$this->pushQueue(['methond' => 'heartbeat', 'mac' => $data['mac'], 'time' => time()]);
+		$connection->send($data);
+	}
+	
+ 
+	private  function pushQueue( $data ){
+		$data = json_encode($data);
+		$startTime = microtime(true);
+		\Jiaruan\DahuaUtil::rlog(microtime(true) . '[pushQueue]', $data);
+		//return;
+		
+		$topic = 'ningbo_dahua';
+		
+		        if (empty($topic)) {
+		            \Jiaruan\DahuaUtil::rlog("error TRAVEL_ROUTE_INDEX_KAFKA_TOPIC empty");
+		            return;
+		        }
+		        static $rk;
+		        if (!extension_loaded('rdkafka')){
+		            \Jiaruan\DahuaUtil::rlog('pushToKafka fail,extension of rdkafka has not installed!!');
+		            return false;
+		        }
+		        if(!$rk){
+		            $conf = new Rdkafka\Conf();
+		           //$conf->set('batch.num.messages', 2);
+		            //$conf->set('linger.ms', 10);
+		            //$conf->set('log_level', (string) LOG_DEBUG);
+		            //$conf->set('debug', 'all');
+		             $conf->setErrorCb(function($producer, $err, $reason) {
+		                 \Jiaruan\DahuaUtil::rlog('err', 'setErrorCb:' . rd_kafka_err2str($err) . ';' . $reason);
+		            });
+		            $conf->setDrMsgCb(function($producer, $msg) {
+		                if($msg->err) {
+		                    \Jiaruan\DahuaUtil::rlog('err', 'setDrMsgCb:' . $msg->errstr());
+		                } else {
+		                  \Jiaruan\DahuaUtil::rlog('info', "kafka sent ok.");
+		                }
+		            });
+		            $rk = new RdKafka\Producer($conf);
+		        }
+		         
+		        //$rk->setLogLevel(LOG_DEBUG);
+		        //$rk->addBrokers(C('KAFKA_BROKER_LIST'));
+					
+		        $topic = $rk->newTopic($topic);
+		 
+		        $topic->produce(RD_KAFKA_PARTITION_UA, 0, $data); 
+		         
+		         
+		        //$rk->poll(20000);
+		        \Jiaruan\DahuaUtil::rlog(microtime(true) . 'info', "kafka start poll");
+		
+		
+				  $rec = 0;
+		        while ($rk->getOutQLen() > 0) {//让回调成功或失败生效
+						$rec++;
+					   if ($rec > 3) {
+						   \Jiaruan\DahuaUtil::rlog('WARN', "getOutQLen");
+							break;
+						}
+						$rk->poll(10);
+		        }
+		         
+		        /*
+		        $result = $rk->flush(10000);
+		        if (RD_KAFKA_RESP_ERR_NO_ERROR !== $result) {
+		            \Jiaruan\Plate::log('error', 'push alarm err');
+		        }
+		        */
+		$runTime = (microtime(true) - $startTime) * 1000; 
+		\Jiaruan\DahuaUtil::rlog(microtime(true) . 'info', 'push OK runTime:' . intval($runTime) . 'ms');
+		
+		
+		        //sleep(2);
+	}
+	
+ 
+	private  function fun80( $connection, $data ){
+		 //登录 AAAAFF04B28FFF8000010077F5AAAAFF04B290FF8000010018F7
+		    $staionInfo = ord($data['buf'][0]);
+		    $gps = '';
+		    if (strlen($data['buf']) > 1) {
+		        $gps = \Jiaruan\DahuaUtil::parseLocation(rtrim(substr($data['buf'], 1), "\0"));//会在右边补null
+		    }
+		    $stationType = \Jiaruan\DahuaUtil::getBit($staionInfo, [7]);
+		    $version = \Jiaruan\DahuaUtil::getBit($staionInfo, ['0-5']);
+		//    $gpsStr = json_encode(json_encode);
+		//    \Jiaruan\DahuaUtil::rlog("login", $data['mac'],  "stationType:{$stationType}", "version:{$version}", "gps:{$gpsStr}");
+		
+		    $this->pushQueue(['methond' => 'login', 'mac' => $data['mac'], 'time' => time(),
+		        'gps' => $gps, 'stationType' => $stationType, 'version' => $version]);
+		
+		    //回复
+		    /*
+		数据索引	位	取值范围	备注
+		0~5		    BCD码	6字节,系统时间,BCD码:YYMMDDHHMMSS,年在先
+		6	    7	0/1	设备类型:0-野外基站,1-出入管理
+			    6~0	0~126	心跳间隔,单位30S,(取值+1)*30S
+		7	    7~0	0~254	野外基站模式RFID离开超时,单位2S,(取值+1)*2S,最大510S,8分钟多
+		8		0~254	射频触发读卡持续时间:单位秒。大端存储,0-射频常开,取值1~254,为射频触发读卡持续时间.(取值+1)×30S
+		9		0~254	白名单控制字节
+		        位7~1,保留;
+		         位0,白名单开启;	0000 0000
+		10~25			保留
+		     * */
+		    $bit0_5 = date('ymdHis', time()); //220928140554
+		
+		    $bit6 = 0;
+		    $headBeat = 0;// 0 -> (0+1)*30=30秒  2 -> (2+1)*30=90秒
+		    $stationType = 0;
+		    \Jiaruan\DahuaUtil::setBit($bit6, ['0-6'], $headBeat);
+		    \Jiaruan\DahuaUtil::setBit($bit6, [7], $stationType);
+		
+		    $bit7 = 0xf;// f -> (15+1)*2=32秒
+		    $bit8 = 0;
+		    $bit9 = 0;
+		    $bit10 = 0xb;//宁波这样回复的 不知道含义
+		    $bit11_25 = '';
+		
+		    $data['reply']['buf'] = pack('H12C5a15', $bit0_5, $bit6, $bit7, $bit8, $bit9, $bit10, $bit11_25);
+		    $connection->send($data);
+	}
+	
+ 
+	private  function fun82( $connection, $data ){
+		//确认包 AAAAFF04B28FFF820000F5D4
+		\Jiaruan\DahuaUtil::rlog("ack", $data['mac']);
+	}
+	
+ 
+	private  function funfe( $connection, $data ){
+		//上报两个读头的id号 客户端断开后 重新连接后不会发这个包 AAAAFFFFFFFC00FE00090AFF04B28FFF04B2904576
+		    $upk = unpack('H2unknow/H8id1/H8id2', $data['buf']);
+		    \Jiaruan\DahuaUtil::rlog("ID", $data['mac'], "id1:{$upk['id1']}",  "id2:{$upk['id2']}");
+	}
+	
+ 
+	private  function fun84( $connection, $data ){
+		//AAAAFF04B28F008400AA000003410F700096D714220930020104700096D708220930020106700096D714220930020109700096D708220930020111700096D714220930020114B05C
+		    $subpackageLen = 5;//头部5字节是分包
+		    $labelLen = 11;//每个标签
+		    $buf = $data['buf'];
+		
+		
+		    if (isset($data['lenBug'])) {//把有效数据取出来
+		        if (strlen($buf) < $subpackageLen + $labelLen) {//没有轨迹
+		            return;
+		        }
+		        $dropLen = (strlen($buf) - $subpackageLen) % $labelLen;
+		        $buf = substr($buf, 0, strlen($buf) - $dropLen);
+		        return;//先不处理错误的包了 这行反注释 就会处理错误的包
+		    }
+		
+		
+		    \Jiaruan\DahuaUtil::rlog("track", $data['mac']);
+		    $gps = '';
+		    if ((strlen($buf) - $subpackageLen) % $labelLen == 0) {
+		        //不含gps
+		    } else if ((strlen($buf) - $subpackageLen - 28) % $labelLen == 0) {//28 gps
+		        $gps = parseLocation(rtrim(substr($buf, -28), "\0"));//会在右边补null
+		        $buf = substr($buf, 0, strlen($buf) - 28);
+		    } else {
+		        //协议错误
+		        \Jiaruan\DahuaUtil::rlog('fun84 protocolLen error');
+		        return;
+		    }
+		
+		    //轨迹包
+		    $recordSn = unpack('N', substr($buf, 0, $subpackageLen - 1))[1];
+		    $subpackageMax = \Jiaruan\DahuaUtil::getBit(ord($buf[$subpackageLen - 1]), ['4-7']);
+		    $subpackageCrrent = \Jiaruan\DahuaUtil::getBit(ord($buf[$subpackageLen - 1]), ['0-3']);
+		
+		    $buf = substr($buf, $subpackageLen);
+		    $labelCount = strlen($buf) / $labelLen;
+		    $allLabel = [];
+		    for ($i = 0; $i < $labelCount; $i++) {
+		        $upk = unpack('H8rfid/C1event/H12time', $buf);//4+1+6 11 byte
+		
+		        $item = [];
+		        $item['id'] = $upk['rfid'];
+		
+		        /*
+		4	0/1	所处位置:0-场外,1-场内
+		3	0/1	离开事件:0-无效,1-离开
+		2	0/1	进入事件:0-无效,1-进入
+		1	0/1	低电事件:0-无效,1-低电
+		         * */
+		        $item['event']['dec'] = $upk['event'];
+		        $item['event']['lowBattery'] = \Jiaruan\DahuaUtil::getBit($upk['event'], [1]);
+		        $item['event']['entry'] = \Jiaruan\DahuaUtil::getBit($upk['event'], [2]);
+		        $item['event']['leave'] = \Jiaruan\DahuaUtil::getBit($upk['event'], [3]);
+		        $item['event']['in'] = \Jiaruan\DahuaUtil::getBit($upk['event'], [4]);
+		
+		        $item['time'] = strtotime(substr(date('Y', time()), 0, 2) . $upk['time']);//221008155600 --> 1665215760
+		
+		        $buf = substr($buf, $labelLen);
+		        $allLabel[] = $item;
+		    }
+		
+		    $this->pushQueue(['methond' => 'track', 'mac' => $data['mac'], 'gps' => $gps, 'labels' => $allLabel,
+		    'subpackageMax' => $subpackageMax, 'subpackageCrrent' => $subpackageCrrent, 'recordSn' => $recordSn]);
+		
+		//    $gpsStr = json_encode($gps);
+		//    \Jiaruan\DahuaUtil::rlog("gps:{$gpsStr}", "recordSn:{$recordSn}",
+		//        "subpackageMax:{$subpackageMax}", "subpackageCrrent:{$subpackageCrrent}", "labelCount:{$labelCount}");
+		    $connection->send($data);
+	}
+	
+
+}

+ 380 - 0
Home/Lib/Action/RouteRfidKafkaAction.class.php

@@ -0,0 +1,380 @@
+<?php
+
+
+
+class RouteRfidKafkaAction extends Action {
+			
+
+
+ 
+	private  function addRfidDataToNingbo( $data ){
+		//{"methond":"track","mac":"ffc10063","gps":{"locationState":"A","lat":0,"latType":"N","lng":0,"lngType":"E"},"labels":[{"id":"01000423","event":{"dec":8,"lowBattery":0,"entry":0,"leave":1,"in":0},"time":"160621112931"},{"id":"01000424","event":{"dec":8,"lowBattery":0,"entry":0,"leave":1,"in":0},"time":"160621113202"},{"id":"01000422","event":{"dec":20,"lowBattery":0,"entry":1,"leave":0,"in":1},"time":"160621113303"}]}
+		//var_dump($data);
+		if($data['methond']!='track'){
+			return array('success'=>false,'message'=>'addRfidDataToNingbo failed,methond not track!');
+		}
+		
+		if(!$data['labels']){
+			return array('success'=>false,'message'=>'addRfidDataToNingbo failed,labels not existed!');
+		}
+		
+		$conn = null;
+		$host= '61.175.203.188';
+		$port=   '6521';
+		$instance_name= 'DSSC';
+		$username=  'dssc3';
+		$password=  'dssc3';
+		$conn = new PDO("oci:dbname=//".$host.":".$port."/".$instance_name,$username,$password);// PDO方式
+		$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+		
+		$station_sql='SELECT DEVICE_NAME FROM DSSC2.ADM_DEV WHERE LOGIN_NAME='.$data['RF_ID'];
+		$res = $conn->query($station_sql);
+		$station_info = $res->fetch(PDO::FETCH_ASSOC);
+		
+		$RF_ID=strtoupper($data['mac']);
+		foreach($data['labels'] as $val){
+			$RF_STAT=0;
+			if($val['event']['entry']==1){
+				$RF_STAT=1;
+			}elseif($val['event']['leave']==1){
+				$RF_STAT=2;
+			}
+			$RF_FLAGID=strtoupper($val['id']);
+			$RF_DATE=date('Y-m-d H:i:s',$val['time']);
+			$handle_data=array(
+				'RF_STAT'=>$RF_STAT,
+				'RF_FLAGID'=>$RF_FLAGID,
+				'RF_ID'=>$RF_ID,
+				'time'=>$val['time'],
+				'address'=>$station_info['DEVICE_NAME']
+			);
+			
+			
+			$this->handleTotalData($handle_data);
+			//检测布控
+			$this->checkControlAlarm($handle_data,$conn);
+			//违规行驶检测  超速逆行检测
+			$this->checkIllegalDriving($handle_data,$conn);
+			$sql = 'INSERT INTO "DSSC2"."W_DW_RF_RECORD"("ID", "RF_ID", "RF_FLAGID", "RF_DATE", "RF_STAT") VALUES (DSSC2.SEQ_W_DW_RF_RECORD.nextval, \''.$RF_ID.'\', \''.$RF_FLAGID.'\', TO_DATE(\''.$RF_DATE.'\', \'SYYYY-MM-DD HH24:MI:SS\'), \''.$RF_STAT.'\')';
+		 	var_dump($sql); 
+			//插入数据到oracle轨迹表
+		 	//$res = $conn -> query($sql);
+		
+		}
+		
+		if ($conn){
+		  $conn = null;
+		}
+		
+		 return array('success'=>true,'message'=>'add success');
+	}
+	
+ 
+	public  function pushRfidRouteToNingbo(  ){
+		
+		$broker_list = C('KAFKA_BROKER_LIST');
+		
+		if (empty($broker_list)) {
+			exit("KAFKA_BROKER_LIST must be config!".PHP_EOL);
+		}
+		$group = C('ROUTE_INDEX_KAFKA_GROUP');
+		if (empty($group)) {
+			exit("ROUTE_INDEX_KAFKA_GROUP must be config!".PHP_EOL);
+		}
+		$topics = 'ningbo_dahua';
+		if (empty($topics)) {
+			exit("ROUTE_INDEX_KAFKA_TOPIC must be config!".PHP_EOL);
+		}
+		$topics = explode(',',$topics);
+		
+		// 从 topic :rlstation_rfid_location 取轨迹
+		$conf = new RdKafka\Conf();
+		// Set a rebalance callback to log partition assignments (optional)(当有新的消费进程加入或者退出消费组时,kafka 会自动重新分配分区给消费者进程,这里注册了一个回调函数,当分区被重新分配时触发)
+		$conf->setRebalanceCb(function (RdKafka\KafkaConsumer $kafka, $err, array $partitions = null) {
+		    switch ($err) {
+		        case RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS:
+		            echo "Assign: ";
+		            var_dump($partitions);
+		            $kafka->assign($partitions);
+		            break;
+		
+		         case RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS:
+		             echo "Revoke: ";
+		             var_dump($partitions);
+		             $kafka->assign(NULL);
+		             break;
+		
+		         default:
+		            throw new \Exception($err);
+		    }
+		});
+		// Configure the group.id. All consumer with the same group.id will consume( 配置groud.id 具有相同 group.id 的consumer 将会处理不同分区的消息,所以同一个组内的消费者数量如果订阅了一个topic, 那么消费者进程的数量多于这个topic 分区的数量是没有意义的。)
+		// different partitions.
+		$conf->set('group.id', $group);
+		// Initial list of Kafka brokers(添加 kafka集群服务器地址)
+		
+		$conf->set('metadata.broker.list', $broker_list);
+		$topicConf = new RdKafka\TopicConf();
+		// Set where to start consuming messages when there is no initial offset in
+		// offset store or the desired offset is out of range.
+		// 'smallest': start from the beginning
+		$topicConf->set('auto.offset.reset', 'smallest');
+		// Set the configuration to use for subscribed/assigned topics
+		$conf->setDefaultTopicConf($topicConf);
+		$consumer = new RdKafka\KafkaConsumer($conf);
+		
+		
+		
+		// 订阅轨迹数据topic
+		$consumer->subscribe($topics);
+		while (true) {
+		    $message = $consumer->consume(120*1000);
+		    switch ($message->err) {
+		        case RD_KAFKA_RESP_ERR_NO_ERROR:
+						 $data = json_decode($message->payload,true);
+						 if( $data ){
+							 //$this->addRfidDataToNingbo($data);
+							 $this->addRfidDataToRenlian($data);
+						 }
+		            break;
+		        case RD_KAFKA_RESP_ERR__PARTITION_EOF:
+		            echo "No more messages; will wait for more\n";
+		            break;
+		        case RD_KAFKA_RESP_ERR__TIMED_OUT:
+		            echo "Timed out\n";
+		            break;
+		        default:
+		            throw new \Exception($message->errstr(), $message->err);
+		            break;
+		    }
+		}
+	}
+	
+ 
+	private  function addRfidDataToRenlian( $data ){
+		//{"methond":"track","mac":"ffc10063","gps":{"locationState":"A","lat":0,"latType":"N","lng":0,"lngType":"E"},"labels":[{"id":"01000423","event":{"dec":8,"lowBattery":0,"entry":0,"leave":1,"in":0},"time":"160621112931"},{"id":"01000424","event":{"dec":8,"lowBattery":0,"entry":0,"leave":1,"in":0},"time":"160621113202"},{"id":"01000422","event":{"dec":20,"lowBattery":0,"entry":1,"leave":0,"in":1},"time":"160621113303"}]}
+		//var_dump($data);
+		if($data['methond']!='track'){
+			return array('success'=>false,'message'=>'addRfidDataToNingbo failed,methond not track!');
+		}
+		
+		if(!$data['labels']){
+			return array('success'=>false,'message'=>'addRfidDataToNingbo failed,labels not existed!');
+		}
+		
+		
+		static $recvCount = 0;
+		$recvCount++;
+		var_dump($recvCount . ".".json_encode($data));
+		return;
+		
+		
+		$conn = null;
+		$host= '115.198.203.63';
+		$port=   '1521';
+		$instance_name= 'ORCL';
+		$username=  'DSSC3';
+		$password=  '123456';
+		$conn = new PDO("oci:dbname=//".$host.":".$port."/".$instance_name,$username,$password);// PDO方式
+		$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+		
+		$RF_ID=strtoupper($data['mac']);
+		
+		foreach($data['labels'] as $val){
+			$RF_STAT=0;
+			if($val['event']['entry']==1){
+				$RF_STAT=1;
+			}elseif($val['event']['leave']==1){
+				$RF_STAT=2;
+			}
+			$RF_FLAGID=strtoupper($val['id']);
+			$RF_DATE=date('Y-m-d H:i:s',$val['time']);
+			$sql = 'INSERT INTO "ROOT"."W_DW_RF_RECORD"("RF_ID", "RF_FLAGID", "RF_DATE", "RF_STAT") VALUES (\''.$RF_ID.'\', \''.$RF_FLAGID.'\', TO_DATE(\''.$RF_DATE.'\', \'SYYYY-MM-DD HH24:MI:SS\'), \''.$RF_STAT.'\')';
+			
+		 	var_dump($recvCount . '.' . $sql); 
+		 //	$res = $conn -> query($sql);
+		
+		}
+		
+		if ($conn){
+		  $conn = null;
+		}
+		
+		 return array('success'=>true,'message'=>'add success');
+	}
+	
+ 
+	private  function addControlAlarm( $data, $conn ){
+		
+		$vehicle_sql='SELECT o.PLATE_NO,s.RFID_SN FROM DSSC3.W_DW_NON_MOTOR o,DSSC3.W_DW_RFID_TAGS s WHERE s.RFID_SN ='.$data['RF_FLAGID'].'  AND o.rfid_id = s.id  ';
+		$res2 = $conn->query($vehicle_sql);
+		$vehicle_info = $res2->fetch(PDO::FETCH_ASSOC);
+		if(!$data['address']){
+			$station_sql='SELECT DEVICE_NAME FROM DSSC2.ADM_DEV WHERE LOGIN_NAME='.$data['RF_ID'];
+			$res = $conn->query($station_sql);
+			$station_info = $res->fetch(PDO::FETCH_ASSOC);
+			$data['address']=$station_info['DEVICE_NAME'];
+		}
+		$save_data=array(
+						'plate_no'=>$vehicle_info['PLATE_NO'],
+						'rfid_sn'=>$data['RF_FLAGID'],
+						'address'=>$data['address'],
+						'alarm_type'=>$data['alarm_typ'],
+						'created_at'=>$data['time'],
+						'remark'=>$data['remark']
+		);
+		$res=M('control_alarm')->createAdd($save_data);
+		return $res;
+	}
+	
+ 
+	private  function checkControlAlarm( $data, $conn ){
+		//先检测标签是否布控
+			$cond=array('control_obj'=>$data['RF_FLAGID']);
+			$ve_con=M('control_manage')->where($cond)->find();
+			//存在布控标签 并在时间内
+			if($ve_con && ($val['time']>$ve_con['start_time']) && ($val['time']<$ve_con['end_time'])){
+				$this->addControlAlarm($data,$conn);
+			}
+			//检测区域布控
+			$cond2=array('control_obj'=>array("LIKE", '%'.$data['RF_ID'].'%'));
+			$sta_con=M('control_manage')->where($cond2)->find();
+			//存在布控基站
+			if($sta_con && ($val['time']>$sta_con['start_time']) && ($val['time']<$sta_con['end_time'])){
+				if($sta_con['bw_ids']){
+					
+					$bwIdArr=explode(',',$sta_con['bw_ids']);
+					$info=M('bw_list')->where( array('id'=>array('in',$bwIdArr) ) )->find();
+					//判断是黑名单还是白名单
+					$rfid_arr=M('rfid_with_bw')->where(array('bw_id'=>array('in',$bwIdArr) ))->getField('rfid',true);
+					if($sta_con['area_type']=='1'){
+						//禁止活动区域 
+						if($info['type']=='0'){
+							//指定黑名单禁止 
+							if(in_array($data['RF_FLAGID'],$rfid_arr)){
+								//在黑名单内 告警
+								$data['alarm_typ']='forbid_b';
+								$this->addControlAlarm($data,$conn);
+							}
+						}else{
+							//白名单的不禁止   
+							if(!in_array($data['RF_FLAGID'],$rfid_arr)){
+								//不在白名单内 告警
+								$data['alarm_typ']='forbid_w';
+								$this->addControlAlarm($data,$conn);
+							}
+						}
+						
+					}else{
+						//活动区域
+						//指定黑名单
+						if(in_array($data['RF_FLAGID'],$rfid_arr)){
+								//在黑名单内 告警
+							$data['alarm_typ']='activity';
+							$this->addControlAlarm($data,$conn);
+						}
+					}
+				}else{
+					//无黑白名单布控  全部禁止
+					$data['alarm_typ']='forbid_all';
+					$this->addControlAlarm($data,$conn);
+				}
+			}
+	}
+	
+ 
+	private  function checkIllegalDriving( $data, $conn ){
+		$redis = Redis("nbfd_stuck_section_data","hash");
+		
+		//先查询基站是否设置卡点
+		$cond=array('macs'=>array("LIKE", '%'.$data['RF_ID'].'%'));
+		$section_id=M('stuck_point')->where($cond)->getField('id');
+		//检测是否是前置卡点
+		$pre_section_cond=array('pre_spot'=>$section_id);
+		$pre_section=M('stuck_section')->where($pre_section_cond)->find();
+		if($pre_section){
+			//如果是前置卡点 则记录标签进入卡点区间时间
+			$key = "stuck_section_".$pre_section['id']."_".$data['RF_FLAGID'];
+			$passInfo=json_decode($redis->get($key),true);
+			//存在逆行进入卡点时间  且启用超速检测
+			if($passInfo && ($passInfo['section']=='pos') && ($pos_section['retrograde_stat']==1)){
+				$data['alarm_typ']='retrograde';
+				
+				$this->addControlAlarm($data,$conn);
+			}
+			$redisData = array(
+				$key =>json_encode(array(
+							"section" => 'pre',
+							"time" => $data['time'],
+							)
+						)
+			);
+			$redis->add($redisData);
+			return;
+		}
+		//检查是否是后置卡点
+		$pos_section_cond=array('pos_spot'=>$section_id);
+		$pos_section=M('stuck_section')->where($pos_section_cond)->find();
+		if($pos_section){
+			//后置卡点 取标签进入卡点区间时间
+			$key = "stuck_section_".$pos_section['id']."_".$data['RF_FLAGID'];
+			$passInfo=json_decode($redis->get($key),true);
+			//存在进入卡点时间  且启用超速检测
+			if($passInfo && ($passInfo['section']=='pre') && ($pos_section['over_speed_stat']==1)){
+				$hour= ($data['time']-$passInfo['time'])/3600;
+				$speed=($pos_section['distance']/1000)/$hour;
+				if($speed>$max_speed){
+					//超速行驶
+					$data['alarm_typ']='over_speed';
+					$data['remark']='速度:'. round($speed,2);
+					$this->addControlAlarm($data,$conn);
+				}
+			}
+			//存经过后置卡点时间
+			$redisData = array(
+				$key =>json_encode(array(
+							"section" => 'pos',
+							"time" => $data['time'],
+							)
+						)
+			);
+			$redis->add($redisData);
+			return;
+		}
+		
+		
+	}
+	
+ 
+	private  function handleTotalData( $data ){
+		/*
+		$data=array(
+				'RF_STAT'=>$RF_STAT,
+				'RF_FLAGID'=>$RF_FLAGID,
+				'RF_ID'=>$RF_ID,
+				'time'=>$val['time'],
+				'address'=>$station_info['DEVICE_NAME']
+			);
+		*/
+		
+		//统计表数据添加
+		$to_cond=array(
+			'mac'=>$data['RF_ID'],
+			'date'=>date('Y-m-d',$data['time']);
+		);
+		if(!M('station_passing')->where($to_cond)->count()){
+			$total_data=array(
+				'address'=>$data['address'],
+				'mac'=>$data['RF_ID'],
+				'date'=>date('Y-m-d',$data['time']),
+				'num'=>1,
+			);
+			$res=M('station_passing')->createAdd($total_data);
+		}else{
+			$res=M('station_passing')->where($to_cond)->setInc('num');
+		}
+		return $res;
+	}
+	
+
+}

+ 233 - 0
Home/Lib/Class/DahuaUtil.php

@@ -0,0 +1,233 @@
+<?php
+namespace Jiaruan;
+
+class DahuaUtil
+{
+    /*位操作*/
+    function getb($val, $pos)
+    {
+        //获取整数$val第$pos位的值
+        return (($val & 1 << $pos) > 0) ? 1 : 0;
+    }
+
+    function setb(&$val, $pos, $newVal)
+    {
+        //设置整数$val第$pos位的值 $newVal为0或1
+        if ($newVal) {//设置为1
+            $val |= (1 << $pos);
+        } else {//设置为0
+            $val &= ~(1 << $pos);
+        }
+    }
+
+    function getBit($val, $posArr)
+    {
+        //$val整数  $posArr位置数组[1,2,3]  或  $posArr[0]='1-3'; $posArr = [0, 1, 2, 3]
+        //返回值 整数
+        if (strpos($posArr[0], '-')) {
+            $tmp = explode('-', $posArr[0], 2);
+            $posArr = range($tmp[0], $tmp[1]);
+        }
+        $ret = '';
+        foreach ($posArr as $pos) {
+            $ret = DahuaUtil::getb($val, $pos) . $ret;
+        }
+        return bindec($ret);
+    }
+
+    function setBit(&$val, $posArr, $newVal)
+    {
+        //$val 整数 旧值
+        //$posArr 数组 要更改的位 $posArr[0]='1-3'; $posArr = [0, 1, 2, 3]
+        //$newVal 整数 新值
+        if (strpos($posArr[0], '-')) {
+            $tmp = explode('-', $posArr[0], 2);
+            $posArr = range($tmp[0], $tmp[1]);
+        }
+        $ival = strrev(decbin($newVal));//反转下
+        $k = 0;
+        foreach ($posArr as $pos) {
+            if (!isset($ival[$k])) {
+                $ival[$k] = 0;
+            }
+            DahuaUtil::setb($val, $pos, $ival[$k]);
+            $k++;
+        }
+    }
+
+    /*位操作*/
+
+
+    function parseLocation($str)
+    {
+        $location_arr = explode(',', $str);
+
+        $location = [];
+        $location['locationState'] = $location_arr[0];
+        $lat_d = substr($location_arr[1], 0, 2);
+        $lat_m = substr($location_arr[1], 2);
+        $location['lat'] = $lat_d + $lat_m * 60;
+        $location['latType'] = $location_arr[2];
+        $lng_d = substr($location_arr[3], 0, 3);
+        $lng_m = substr($location_arr[3], 3);
+        $location['lng'] = $lng_d + $lng_m * 60;
+        $location['lngType'] = $location_arr[4];
+        return $location;
+    }
+
+    function rlog(...$args)
+    {
+        //函数参数是可变参数 使用前查下static开始的大写变量配置是否正确
+        //rlog('info', [1,2,3], $a = null, '[]', $this, false);
+        $args = func_get_args();
+        //if (empty($args[0])) {
+            //return;
+        //}
+        static $LOG_CONSOLE = false;//是否输出到控制台 fpm需要为false cli可以为true
+        static $LOG_NAME = "dahua.log";//值为空时 不写入文件
+        static $LOG_SIZE = 128 * 1024 * 1024;//文件最大尺寸 大于这个尺寸时 会生成个后缀.old的文件
+
+        static $LOG_CACHE = true;//是否缓存日志内容 用于批量写入文件 如需强制刷新第一个参数传sync
+        static $CACHE_DURATION = 10;//缓存最大时间 秒
+        static $CACHE_SIZE = 1024;//缓存大小
+        static $cacheStartTime = 0;
+        static $cacheBuf = '';
+
+        static $LOG_TIMES = 10;//调用这个函数最大次数 超过次数或$logCount==1 会判断下文件大小 决定是否新生成文件
+        static $logCount = 0;
+
+        static $MAX_LEN = 5048;//数据不能超过这个  不然就截断了
+
+        $sync = false;//如果是true 使用$LOG_CACHE时会把数据保存到磁盘
+
+        $implicit0 = ['imsync', 'imtrace'];//这个函数的参数0 隐藏用法
+        $buf = '';
+        if (count($args) == 1 && $args[0] == "\n") {//只有换行时 不写入时间戳了
+            $buf = "\n";
+        } else {
+            $sync = strtolower($args[0]) == $implicit0[0];
+
+            $pid = '';//进程id
+            if (function_exists('posix_getpid')) {
+                $pid = ' ' . posix_getpid() . ' ';
+            }
+            $fileLine = '';//文件名:行号
+            {
+                $debug = debug_backtrace();
+                $backtrace = 0;
+                if (strpos($args[0], $implicit0[1]) === 0) {
+                    $backtrace = intval(str_replace($implicit0[1], '', $args[0]));
+                    unset($args[0]);
+                } else if ($sync) {
+                    unset($args[0]);
+                }
+                $fileLine = ($pid == '' ? ' ' : '') . basename($debug[$backtrace]['file'])
+                    . ':' . $debug[$backtrace]['line'] . '';
+
+            }
+
+            $allPara = '';
+            foreach ($args as $para) {
+                if (is_array($para)) {
+                    $allPara .= json_encode($para) . ' ';
+                } else if (is_object($para)) {
+                    if (method_exists($para, '__toString')) {
+                        $allPara .= $para . ' ';
+                    } else {
+                        $allPara .= get_class($para) . json_encode($para) . ' ';
+                    }
+                } else if (is_bool($para)) {
+                    $allPara .= $para ? 'true ' : 'false ';
+                } else if (is_null($para)) {
+                    $allPara .= 'null ';
+                } else {
+                    $allPara .= $para . ' ';
+                }
+            }
+
+            $len = strlen($allPara);
+            if ($len > $MAX_LEN) {
+                $allPara = substr($allPara, 0, $MAX_LEN) . "({$len})......";
+            }
+
+            $buf = "[" . date("y-m-d H:i:s") . "{$pid}{$fileLine}]" . $allPara . "\n";
+        }
+
+        $logCount++;
+        if (!empty($LOG_NAME)) {
+            if ($LOG_CACHE) {
+                if ($cacheBuf == '') {
+                    $cacheStartTime = time();
+                }
+                $cacheBuf .= $buf;
+                //超过缓存尺寸 或者 超过缓存时长 写缓存到文件
+                if (strlen($cacheBuf) > $CACHE_SIZE || time() - $cacheStartTime > $CACHE_DURATION) {
+                    $cacheStartTime = time();
+                    goto write;
+                } else {
+                    if ($sync) {
+                        goto write;
+                    } else {
+                        goto skipWrite;
+                    }
+                }
+            } else {
+                $cacheBuf = $buf;
+            }
+            write: {
+				if ($logCount > 100) {
+                    clearstatcache();
+                }
+                //超过尺寸后 删除旧文件 把新文件重命名为旧文件  多进程同时操作 不加锁问题不大
+                if (($logCount == 1 || $logCount > $LOG_TIMES) && filesize($LOG_NAME) > $LOG_SIZE) {
+                  //获取独占锁
+                    $fp = fopen($LOG_NAME . '.lock', 'a');
+					$k = 0;
+                    do {
+                        $isLock = flocK($fp, LOCK_EX);
+						$k++;
+                        if (!$isLock && $k > 1000) {
+                            echo "lock 1000\n";
+                            goto PUT;
+                        }
+                    } while (!$isLock);
+
+                    //另外一个进程进入时 重新判断下
+					clearstatcache();
+                    if (filesize($LOG_NAME) <= $LOG_SIZE) {
+                        goto UN;
+                    }
+
+                    $oldLogName = $LOG_NAME . '.old';
+                    if (file_exists($oldLogName)) {
+                        if (!unlink($oldLogName)) {
+                            echo "unlink err\n";
+                        }
+                    }
+                    if (!rename($LOG_NAME, $oldLogName)) {
+                        echo "rename err\n";
+                    }
+
+                    //解锁
+                UN:
+                    flock($fp, LOCK_UN);
+                    fclose($fp);
+
+
+
+                    $logCount = 0;
+                }
+				PUT:
+                if (!file_put_contents($LOG_NAME, $cacheBuf, FILE_APPEND)) {
+                    echo "file_put_contents err\n";
+                }
+                $cacheBuf = '';
+            }
+            skipWrite:{
+            }
+        }
+        if ($LOG_CONSOLE) {
+            echo $buf;
+        }
+    }
+}

+ 20 - 0
composer.json

@@ -0,0 +1,20 @@
+{
+    "name": "rlfd/router-server",
+    "type": "project",
+	"repositories": [
+		{ "type": "composer", "url": "http://satis.renlianiot.com/" }
+    ],
+    "require": {
+        "php": ">=5.6.0",
+		"zmcoding/php-workerman352": "dev-master",
+		"rlfd/workerman-proto": "dev-master",
+		"jrtk/jr-phpcls2": "dev-master",
+		"jrtk/aliyun-ots-sdk-php":"2.1.1",
+		"zmcoding/php-tp313": "dev-master",
+		"zmcoding/cmp_desutils": "dev-master",
+		"jrtkcoder/redlock-php":"dev-master"
+    },
+	"config": {
+		"secure-http": false
+	}
+}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 536245 - 0
dahua.log


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 472859 - 0
dahua.log.old


+ 27 - 0
index.php

@@ -0,0 +1,27 @@
+<?php
+// echo $_GET['echostr'];exit;//微信认证时打开这行代码
+//define('APP_DOMAIN','wxt.rltest.cn');
+
+$plugins = array(
+
+);
+$prefix = substr( $_GET['s'] ,0,strpos($_GET['s'] ,'_'));
+//define('UICOMP_SERVER','http://jrcomp.rltest.cn:8080/uicomp');
+define('UICOMP_SERVER','http://jrcomp.rltest.cn/uicomp');
+define('SOLUTION_PATH',__DIR__ .'/');
+define('ENTRY_PATH',__DIR__ .'/');
+if(! $plugins[$prefix]){
+	define('SCRIPT_FILENAME',__FILE__);
+}
+else{
+	//运行相应插件
+	$path = __DIR__ . $plugins[$prefix] . 'stub.php';
+	if(! file_exists($path) )
+		die('invalid plugin path - ' . $path);
+	define('SCRIPT_FILENAME', $path);
+	require $path;
+}
+
+require 'vendor/autoload.php';
+//$c = new \Aliyun\OTS\OTSClient;
+require 'vendor/zmcoding/php-tp313/ThinkPHP.php';