فهرست منبع

后台聊天记录

lizhen_gitee 1 سال پیش
والد
کامیت
513a796437

+ 37 - 1
application/admin/controller/Imlogc2c.php

@@ -65,19 +65,55 @@ class Imlogc2c extends Backend
 				$row->getRelation('touser')->visible(['nickname']);
             }
 
-            $result = array("total" => $list->total(), "rows" => $list->items());
+            $list2 = collection($list->items())->toArray();
+
+            $type_arr = $this->type_arr();
+            foreach($list2 as $key => &$val){
+                $val['MsgType'] = isset($type_arr[$val['MsgType']]) ? $type_arr[$val['MsgType']] : '其他';
+            }
+
+            $result = array("total" => $list->total(), "rows" => $list2);
 
             return json($result);
         }
         return $this->view->fetch();
     }
 
+    private function type_arr(){
+        $type_arr = [
+            'TIMTextElem' => '文本',
+            'TIMImageElem' => '图片',
+            'TIMSoundElem' => '声音',
+            'TIMVideoFileElem' => '视频',
+        ];
+        return $type_arr;
+    }
+
     /**
      * 消息体
      */
     public function showbody(){
         $id = input('id',0);
         $info = Db::name('imlog_c2c')->where('id',$id)->find();
+
+
+        $type_arr = $this->type_arr();
+
+        $info['typetext'] = isset($type_arr[$info['MsgType']]) ? $type_arr[$info['MsgType']] : '其他';
+
+        if($info['MsgType'] == 'TIMTextElem'){
+            $info['MsgInfo'] = $info['MsgInfo'];
+        }
+        if($info['MsgType'] == 'TIMImageElem'){
+            $info['MsgInfo'] = '<img width="800" height="800" src="'.$info['MsgInfo'].'">';
+        }
+        if($info['MsgType'] == 'TIMSoundElem'){
+            $info['MsgInfo'] = '<audio controls><source src="'.$info['MsgInfo'].'"></audio>';
+        }
+        if($info['MsgType'] == 'TIMVideoFileElem'){
+            $info['MsgInfo'] = '<video width="800" height="800" controls preload src="'.$info['MsgInfo'].'"></video>';
+        }
+
         $this->assign('info',$info);
 
         return $this->view->fetch();

+ 7 - 1
application/admin/view/imlogc2c/showbody.html

@@ -1,10 +1,16 @@
 <table class="table table-bordered">
-    <tr>
+    <!--<tr>
         <td><?php
             $body = json_decode($info['MsgBody'],true);
             dump($body);
 
         ?></td>
+    </tr>-->
+    <tr>
+        <td><?php echo $info['typetext']?><td>
+    </tr>
+    <tr>
+        <td><?php echo $info['MsgInfo']?><td>
     </tr>
 
 </table>

+ 1 - 1
public/assets/js/backend/imlogc2c.js

@@ -29,7 +29,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'ClientIP', title: __('Clientip'), operate: 'LIKE'},
                         {field: 'From_Account', title: __('From_account')},
                         {field: 'fromuser.nickname', title: __('fromuser.nickname'), operate: 'LIKE'},
-//                        {field: 'MsgBody', title: __('Msgbody')},
+                        {field: 'MsgType', title: '类型'},
                         {field: 'MsgFromPlatform', title: __('Msgfromplatform'), operate: 'LIKE'},
                         {field: 'MsgRandom', title: __('Msgrandom'), operate: 'LIKE'},
                         {field: 'MsgSeq', title: __('Msgseq'), operate: 'LIKE'},