| xqd
@@ -8,16 +8,37 @@ use Dcat\Admin\Grid\LazyRenderable;
|
|
|
|
|
|
class ChatLog extends LazyRenderable
|
|
|
{
|
|
|
-
|
|
|
public function grid(): Grid
|
|
|
{
|
|
|
$chat_data = ChatList::query()->find($this->payload['id']);
|
|
|
|
|
|
return Grid::make(new ImMessage($chat_data->user_id,$chat_data->to_user_id), function (Grid $grid) {
|
|
|
$grid->column('user_id', 'ID')->sortable();
|
|
|
- $grid->column('nickname');
|
|
|
- $grid->column('created_at');
|
|
|
- $grid->column('updated_at');
|
|
|
+ $grid->column('From_Account');
|
|
|
+ $grid->column('To_Account');
|
|
|
+ $grid->column('MsgTimeStamp');
|
|
|
+ $grid->column('MsgBody')->display(function ($res){
|
|
|
+ $res = json_decode($res,true);
|
|
|
+ if($res[0]['MsgType']=='TIMTextElem'){
|
|
|
+ //文本消息
|
|
|
+ return $res[0]['MsgContent']['Text'];
|
|
|
+ }elseif ($res[0]['MsgType']=="TIMLocationElem"){
|
|
|
+ //位置消息
|
|
|
+ return $res[0]['MsgContent']['Desc'];
|
|
|
+ }elseif ($res[0]['MsgType']=="TIMFaceElem"){
|
|
|
+ //表情消息
|
|
|
+ }elseif ($res[0]['MsgType']=="TIMCustomElem"){
|
|
|
+ //自定义消息
|
|
|
+ }elseif ($res[0]['MsgType']=="TIMSoundElem"){
|
|
|
+ //语音消息
|
|
|
+ }elseif ($res[0]['MsgType']=="TIMImageElem"){
|
|
|
+ //图像消息
|
|
|
+ }elseif ($res[0]['MsgType']=="TIMFileElem"){
|
|
|
+ //文件消息
|
|
|
+ }elseif ($res[0]['MsgType']=="TIMVideoFileElem"){
|
|
|
+ //视频消息
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
$grid->quickSearch(['user_id', 'nickname']);
|
|
|
|