shish 2 anos atrás
pai
commit
5f80c86694
1 arquivos alterados com 12 adições e 3 exclusões
  1. 12 3
      console/controllers/BookController.php

+ 12 - 3
console/controllers/BookController.php

@@ -16,13 +16,22 @@ class BookController extends Controller
         $cacheKey = 'assign_seat_main_book_sn_list';
         $num = Yii::$app->redis->executeCommand('SCARD', [$cacheKey]);
         if ($num <= 0) {
-            return true;
+            return false;
         }
         if ($num > 20) {
             noticeUtil::push("assign seat all 已经超过20家了,请及时解决", '15280215347');
         }
-        $eleList = Yii::$app->redis->executeCommand('SMEMBERS', [$cacheKey]);
-        print_r($eleList);
+        $list = Yii::$app->redis->executeCommand('SMEMBERS', [$cacheKey]);
+        if (empty($list)) {
+            return false;
+        }
+        foreach ($list as $key => $val) {
+            //$mainId . '_' . $bookSn
+            $arr = explode('_', $val);
+            $mainId = $arr[0];
+            $bookSn = $arr[1];
+            echo $mainId . ' ' . $bookSn . "\n";
+        }
     }
 
 }