Browse Source

群组的消息记录

lizhen_gitee 1 year ago
parent
commit
a47e3202af
1 changed files with 9 additions and 3 deletions
  1. 9 3
      application/index/controller/Test.php

+ 9 - 3
application/index/controller/Test.php

@@ -38,7 +38,7 @@ class Test extends Controller
 
         $data = [
             'ChatType' => 'Group',
-            'MsgTime'  => date('YmdH',strtotime('-19 Hours')),
+            'MsgTime'  => date('YmdH',strtotime('-23 Hours')),
         ];
         $tasklog = [
             'type' => $data['ChatType'] == 'C2C' ? 1 : 2,
@@ -244,6 +244,10 @@ class Test extends Controller
                                 $newone['MsgInfo'] = $val['MsgBody'][0]['MsgContent']['VideoUrl'];
                             }
                         }
+                        //其他
+                        continue;
+                    }else{
+                        continue;
                     }
 
                     $newMsgList[] = $newone;
@@ -257,7 +261,7 @@ class Test extends Controller
     //读取json并分析
     public function readjson_group($json_path = ''){
         $newMsgList = [];
-        $json_path    = 'E:\phpstudy_pro\wwwnew\ggyuyin\/public/uploaded/Group/20230727/2023072615_Group.json';
+        //$json_path    = 'E:\phpstudy_pro\wwwnew\ggyuyin\/public/uploaded/Group/20230727/2023072615_Group.json';
         $json_content = file_get_contents($json_path);
         $json_content = json_decode($json_content,true);
 
@@ -268,6 +272,7 @@ class Test extends Controller
                 foreach($MsgList as $key => $val)
                 {
                     $newone = [
+                        //'key' => $key,辅助查找
                         'ClientIP'        => isset($val['ClientIP'])        ? $val['ClientIP']             : '',
                         'From_Account'    => isset($val['From_Account'])    ? intval($val['From_Account']) : 0,
                         'GroupId'         => isset($val['GroupId'])         ? intval($val['GroupId'])      : 0,
@@ -288,6 +293,7 @@ class Test extends Controller
                                 if(isset($text['type']) && $text['type'] == 1){
                                     //TYPE_NORMAL =1;//普通消息
                                     $newone['MsgInfo'] = isset($text['content']) ? $text['content'] : '';
+                                    $newMsgList[] = $newone;
                                 }
                                 //其他$text['type']的值都是房间内的,礼物的,表情等,不需要记录
                             }
@@ -299,7 +305,7 @@ class Test extends Controller
 
                     }
 
-                    $newMsgList[] = $newone;
+                    //大循环结束
                 }
             }
         }