瀏覽代碼

后台聊天记录

lizhen_gitee 1 年之前
父節點
當前提交
d174ca2a4d

+ 15 - 4
application/admin/controller/Imlogc2c.php

@@ -3,7 +3,7 @@
 namespace app\admin\controller;
 
 use app\common\controller\Backend;
-
+use think\Db;
 /**
  * 
  *
@@ -54,15 +54,15 @@ class Imlogc2c extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             $list = $this->model
-                    ->with(['user','user'])
+                    ->with(['fromuser','touser'])
                     ->where($where)
                     ->order($sort, $order)
                     ->paginate($limit);
 
             foreach ($list as $row) {
                 
-                $row->getRelation('user')->visible(['nickname']);
-				$row->getRelation('user')->visible(['nickname']);
+                $row->getRelation('fromuser')->visible(['nickname']);
+				$row->getRelation('touser')->visible(['nickname']);
             }
 
             $result = array("total" => $list->total(), "rows" => $list->items());
@@ -72,4 +72,15 @@ class Imlogc2c extends Backend
         return $this->view->fetch();
     }
 
+    /**
+     * 消息体
+     */
+    public function showbody(){
+        $id = input('id',0);
+        $info = Db::name('imlog_c2c')->where('id',$id)->find();
+        $this->assign('info',$info);
+
+        return $this->view->fetch();
+    }
+
 }

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

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

+ 2 - 2
application/admin/model/Imlogc2c.php

@@ -37,13 +37,13 @@ class Imlogc2c extends Model
 
 
 
-    public function user()
+    public function fromuser()
     {
         return $this->belongsTo('User', 'From_Account', 'id', [], 'LEFT')->setEagerlyType(0);
     }
 
 
-    public function user()
+    public function touser()
     {
         return $this->belongsTo('User', 'To_Account', 'id', [], 'LEFT')->setEagerlyType(0);
     }

+ 2 - 2
application/admin/view/imlogc2c/index.html

@@ -7,7 +7,7 @@
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
                         <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
-                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('imlogc2c/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('imlogc2c/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
                         <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('imlogc2c/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
                         <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('imlogc2c/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
                         <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('imlogc2c/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
@@ -18,7 +18,7 @@
                                 <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
                                 <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
                             </ul>
-                        </div>
+                        </div>-->
 
                         
                     </div>

+ 22 - 6
public/assets/js/backend/imlogc2c.js

@@ -7,8 +7,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 extend: {
                     index_url: 'imlogc2c/index' + location.search,
                     add_url: 'imlogc2c/add',
-                    edit_url: 'imlogc2c/edit',
-                    del_url: 'imlogc2c/del',
+//                    edit_url: 'imlogc2c/edit',
+//                    del_url: 'imlogc2c/del',
                     multi_url: 'imlogc2c/multi',
                     import_url: 'imlogc2c/import',
                     table: 'imlog_c2c',
@@ -28,15 +28,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'id', title: __('Id')},
                         {field: 'ClientIP', title: __('Clientip'), operate: 'LIKE'},
                         {field: 'From_Account', title: __('From_account')},
-                        {field: 'MsgBody', title: __('Msgbody')},
+                        {field: 'fromuser.nickname', title: __('fromuser.nickname'), operate: 'LIKE'},
+//                        {field: 'MsgBody', title: __('Msgbody')},
                         {field: 'MsgFromPlatform', title: __('Msgfromplatform'), operate: 'LIKE'},
                         {field: 'MsgRandom', title: __('Msgrandom'), operate: 'LIKE'},
                         {field: 'MsgSeq', title: __('Msgseq'), operate: 'LIKE'},
                         {field: 'MsgTimestamp', title: __('Msgtimestamp'), operate: 'LIKE'},
                         {field: 'To_Account', title: __('To_account')},
-                        {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
-                        {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {field: 'touser.nickname', title: __('touser.nickname'), operate: 'LIKE'},
+                        {field: 'operate', title: __('Operate'),
+                            buttons:[
+                                {
+                                    name:'showbody',
+                                    text:'消息体',
+                                    title:'消息体',
+                                    icon:'fa fa-exclamation-circle',
+                                    classname:'btn btn-xs btn-info btn-dialog',
+                                    url:'imlogc2c/showbody/id/{ids}?dialog=1',
+                                    target:'_self',
+                                    extend: 'data-area=["90%","90%"]'
+                                },
+                            ],
+                            table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]
             });
@@ -50,6 +63,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         edit: function () {
             Controller.api.bindevent();
         },
+        showbody: function () {
+            Controller.api.bindevent();
+        },
         api: {
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"));