rabin пре 3 дана
родитељ
комит
c1f31925cd
3 измењених фајлова са 21 додато и 2 уклоњено
  1. 16 0
      boot.php
  2. 1 1
      src/Dever/Route.php
  3. 4 1
      src/Dever/Sql.php

+ 16 - 0
boot.php

@@ -26,6 +26,22 @@ class Dever
             $connection->send('hello world');
         };
 
+        /*
+        $http_worker->onMessage = function($connection, $request) {
+            try {
+                // 这里直接调用 run()
+                ob_start(); // 捕获 run() 的输出
+                Dever::run();
+                $output = ob_get_clean();
+
+                // 返回给客户端
+                $connection->send($output);
+            } catch (\Throwable $e) {
+                $connection->send(Dever\Output::error($e->getMessage()));
+                Dever::log('server_error', $e->getMessage());
+            }
+        };*/
+
         \Workerman\Worker::runAll();
     }
     public static function run()

+ 1 - 1
src/Dever/Route.php

@@ -125,7 +125,7 @@ class Route
         }
         self::match();
         self::filter(self::$data);
-        if (isset(self::$data['uuid']) && isset(Config::get('setting')['redis']) && !\Dever\Helper\Redis::lock(self::$data['uuid'], 1, 10)) {
+        if (isset(self::$data['uuid']) && isset(Config::get('setting')['redis']) && !\Dever\Helper\Redis::lock(self::$data['uuid'], 1, 60)) {
             Output::error('route repeat');
         }
         return self::$data;

+ 4 - 1
src/Dever/Sql.php

@@ -292,7 +292,10 @@ class Sql
             $sql .= 'instr('.$key.','.$index.')'.' > 0';
         } elseif ($symbol == 'group') {
             $value = ','.$value.',';
-            $sql .= 'instr(concat(",",'.$key.',","),'.$index.')' . ' > 0';
+            $sql .= 'instr(concat(",",'.$key.',","),'.$index.')' . ' = 1';
+            //$sql .= 'FIND_IN_SET("'.$index.'", '.$key.') = 1';
+        } elseif ($symbol == 'JSON_CONTAINS') {
+            $sql .= 'JSON_CONTAINS('.$key.', "'.$index.'", "$")';
         } elseif ($symbol == 'between') {
             $state && $bind[$index.'_e'] = $value[1];
             $value = $value[0];