lizhen_gitee 1 rok pred
rodič
commit
08a094d596

+ 2 - 2
application/admin/lang/zh-cn/imlogc2c.php

@@ -8,6 +8,6 @@ return [
     'Msgfromplatform' => '平台',
     'Msgtimestamp'    => '发送时间',
     'To_account'      => '接收人id',
-    'fromuser.nickname' => '昵称',
-    'touser.nickname'   => '昵称'
+    'fromuser.nickname' => '发送人昵称',
+    'touser.nickname'   => '接收人昵称'
 ];

+ 36 - 2
application/index/controller/Test.php

@@ -41,7 +41,7 @@ class Test extends Controller
 //            'ChatType' => 'Group',
             'ChatType' => 'C2C',
 //            'MsgTime'  => date('YmdH',strtotime('-1 Days')),
-            'MsgTime'  => date('YmdH',strtotime('-1 Hours')),
+            'MsgTime'  => date('YmdH',strtotime('-3 Hours')),
         ];
         $tasklog = [
             'type' => $data['ChatType'] == 'C2C' ? 1 : 2,
@@ -157,7 +157,7 @@ class Test extends Controller
             if(!empty($MsgList)){
                 foreach($MsgList as $key => $val)
                 {
-                    $newMsgList[] = [
+                    $newone = [
                         'ClientIP'        => $val['ClientIP'],
                         'CloudCustomData' => isset($val['CloudCustomData']) ? $val['CloudCustomData'] : '',
                         'From_Account'    => intval($val['From_Account']),
@@ -168,6 +168,40 @@ class Test extends Controller
                         'MsgTimestamp'    => $val['MsgTimestamp'],
                         'To_Account'      => intval($val['To_Account']),
                     ];
+                    //解析数据类型
+                    if(isset($val['MsgBody'][0]['MsgType'])){
+                        $newone['MsgType'] = $val['MsgBody'][0]['MsgType'];
+                        //文本
+                        if($val['MsgBody'][0]['MsgType'] == 'TIMTextElem'){
+                            $newone['MsgInfo'] = '';
+                            if(isset($val['MsgBody'][0]['MsgContent']['Text'])){
+                                $newone['MsgInfo'] = $val['MsgBody'][0]['MsgContent']['Text'];
+                            }
+                        }
+                        //图片
+                        if($val['MsgBody'][0]['MsgType'] == 'TIMImageElem'){
+                            $newone['MsgInfo'] = '';
+                            if(isset($val['MsgBody'][0]['MsgContent']['ImageInfoArray'][0]['URL'])){
+                                $newone['MsgInfo'] = $val['MsgBody'][0]['MsgContent']['ImageInfoArray'][0]['URL'];
+                            }
+                        }
+                        //声音
+                        if($val['MsgBody'][0]['MsgType'] == 'TIMSoundElem'){
+                            $newone['MsgInfo'] = '';
+                            if(isset($val['MsgBody'][0]['MsgContent']['Url'])){
+                                $newone['MsgInfo'] = $val['MsgBody'][0]['MsgContent']['Url'];
+                            }
+                        }
+                        //视频
+                        if($val['MsgBody'][0]['MsgType'] == 'TIMVideoFileElem'){
+                            $newone['MsgInfo'] = '';
+                            if(isset($val['MsgBody'][0]['MsgContent']['VideoUrl'])){
+                                $newone['MsgInfo'] = $val['MsgBody'][0]['MsgContent']['VideoUrl'];
+                            }
+                        }
+                    }
+
+                    $newMsgList[] = $newone;
                 }
             }
         }