Browse Source

测试工具集中一下

lizhen_gitee 3 years ago
parent
commit
d4001814e6
2 changed files with 47 additions and 38 deletions
  1. 0 32
      application/index/controller/Index.php
  2. 47 6
      application/index/controller/Test.php

+ 0 - 32
application/index/controller/Index.php

@@ -11,39 +11,7 @@ class Index extends Frontend
     protected $noNeedRight = '*';
     protected $layout = '';
 
-    public function showredis(){
-        $list = Db::name('user')->order('id desc')->column('id');
-        foreach($list as $key => $id){
-            dump($id.':'.redis_matching_get($id));
-        }
-        exit;
-    }
-
-    public function clearredis(){
-        $list = Db::name('user')->order('id desc')->column('id');
-        foreach($list as $key => $id){
-            $a = redis_matching_set($id,0);
-        }
-        exit;
-    }
-
-
-    public function test1(){
-        // 文本加一个回车
-        $buffer1 = 'abcdefghijklmn';
-// 在php中双引号中的\n代表一个换行符,例如"\n"
-        $buffer2 = '{"type":"say", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello"}'."";
 
-        $buffer2 = 'abcdefghijklmn'."\n";
-
-// 与服务端建立socket连接
-        $client = stream_socket_client('tcp://1.14.197.70:2349');
-// 以text协议发送buffer1数据
-        //fwrite($client, $buffer1);
-// 以text协议发送buffer2数据
-        fwrite($client, $buffer2);
-
-    }
 
     public function index()
     {

+ 47 - 6
application/index/controller/Test.php

@@ -6,8 +6,44 @@ use think\Db;
 use Redis;
 class Test
 {
+    //显示所有人,匹配状态
+    public function showredis(){
+        $list = Db::name('user')->order('id desc')->column('id');
+        foreach($list as $key => $id){
+            dump($id.':'.redis_matching_get($id));
+            echo '<br/>';
+        }
+        exit;
+    }
+    //清除所有人,匹配状态
+    public function clearredis(){
+        $list = Db::name('user')->order('id desc')->column('id');
+        foreach($list as $key => $id){
+            $a = redis_matching_set($id,0);
+        }
+        exit;
+    }
+
+
+    public function test1(){
+        // 文本加一个回车
+        $buffer1 = 'abcdefghijklmn';
+// 在php中双引号中的\n代表一个换行符,例如"\n"
+        $buffer2 = '{"type":"say", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello", "content":"hello"}'."";
+
+        $buffer2 = 'abcdefghijklmn'."\n";
 
-    public function dellivebc(){
+// 与服务端建立socket连接
+        $client = stream_socket_client('tcp://1.14.197.70:2349');
+// 以text协议发送buffer1数据
+        //fwrite($client, $buffer1);
+// 以text协议发送buffer2数据
+        fwrite($client, $buffer2);
+
+    }
+
+    //直播间详情
+    public function show_livebc(){
         $party_id = input('party_id');
         if(empty($party_id)){
             $this->error();
@@ -20,7 +56,8 @@ class Test
         $a = $redis->get("livebc_".$party_id);
         dump($a);
     }
-    public function outlivebc(){
+    //直播间贡献值
+    public function show_livebc_jewel(){
         $party_id = input('party_id');
         if(empty($party_id)){
             $this->error();
@@ -56,15 +93,19 @@ class Test
 
     }
 
+    //清空直播间贡献值
     public function clear(){
-        $paery_id = 54;
+        $party_id = input('party_id');
+        if(empty($party_id)){
+            $this->error();
+        }
         //清空房间排行榜
         $redis = new Redis();
         $redisconfig = config("redis");
         $redis->connect($redisconfig["host"], $redisconfig["port"]);
-        $redis->del('livebc_jewel_to_' . $paery_id);
-        $redis->del('livebc_jewel_get_' . $paery_id);
-        $redis->hDel("user_jewel_top3",$paery_id);
+        $redis->del('livebc_jewel_to_' . $party_id);
+        $redis->del('livebc_jewel_get_' . $party_id);
+        $redis->hDel("user_jewel_top3",$party_id);
     }