vali 6 سال پیش
والد
کامیت
f8ba4c1ca1
1فایلهای تغییر یافته به همراه16 افزوده شده و 15 حذف شده
  1. 16 15
      datainf/logic/HttpServerSettelement.php

+ 16 - 15
datainf/logic/HttpServerSettelement.php

@@ -282,29 +282,30 @@ class HttpServerSettelement
             unset($order_ids);
 
             $redisconfig = $this->redisonfig;
+            $redis = new \Redis();
             foreach ($PageOrder_ids_1 as $p_order_ids) {
                 $nowchange_status = ($i == 1) ? $change_status : 0;
                 $data = json_encode(['ids' => $p_order_ids, 'bettype' => $bettype, 'settype' => $settype, 'game_code' => $game_code, 'match_id' => $match_id, 'change_status' => $nowchange_status], 256);
-                go(function () use ($data, $redisconfig) {
-                    $redis = new Swoole\Coroutine\Redis();
-                    $ret = $redis->connect($redisconfig['host'], $redisconfig['port']);
+                //go(function () use ($data, $redisconfig) {
+                // $redis = new Swoole\Coroutine\Redis();
+                $ret = $redis->connect($redisconfig['host'], $redisconfig['port']);
+                if (!$ret) {
+                    throw  new \Exception('redis 连接失败', 1106);
+                }
+                if (!empty($redisconfig['passwd'])) {
+                    $ret = $redis->auth($redisconfig['passwd']);
                     if (!$ret) {
-                        throw  new \Exception('redis 连接失败', 1106);
-                    }
-                    if (!empty($redisconfig['passwd'])) {
-                        $ret = $redis->auth($redisconfig['passwd']);
-                        if (!$ret) {
-                            throw  new \Exception('redis auth 失败', 1107);
-                        }
+                        throw  new \Exception('redis auth 失败', 1107);
                     }
-                    $redis->select($redisconfig['db']);
-
-                    $redis->lpush(self::TASKQNUM, $data);
-                    return;
-                });
+                }
+                $redis->select($redisconfig['db']);
+                $redis->lpush(self::TASKQNUM, $data);
+                //    return;
+                // });
                 unset($data);
                 $i++;
             }
+            $redis->close();
 
             LABRETURN:
             $data = Response::generate('', 1, ['cost' => (microtime(true) - $request->server['request_time_float'])], 'succes');