Jonlin 6 jaren geleden
bovenliggende
commit
b4cac574e7
2 gewijzigde bestanden met toevoegingen van 25 en 23 verwijderingen
  1. 23 21
      application/admin/controller/System.php
  2. 2 2
      application/admin/view/system/basics.html

+ 23 - 21
application/admin/controller/System.php

@@ -168,7 +168,7 @@ class System extends Base
     // 历史会话记录
     public function wordsLog()
     {
-        $toExcel = input('param.toExcel', 0);
+//        $toExcel = input('param.toExcel', 0);
 
         if(request()->isAjax()){
 
@@ -182,7 +182,6 @@ class System extends Base
 
             $user_id = input('param.user_id');
             $group_id = input('param.group_id');
-
             $temp = db('service_log');
             $countTmp = db('service_log');
             if(strlen($param['searchText'])){
@@ -198,12 +197,12 @@ class System extends Base
             //结束时间为空
             if(!empty($start) && empty($end)){
                 $temp = $temp->where('start_time','>',strtotime($start));
-                $countTmp = $temp->where('start_time','>',strtotime($start));
+                $countTmp = $countTmp->where('start_time','>',strtotime($start));
             }
             //开始时间为空
             if(empty($start) && !empty($end)){
                 $temp = $temp->where('start_time','<',strtotime($end . ' 23:59:59'));
-                $countTmp = $temp->where('start_time','<',strtotime($end . ' 23:59:59'));
+                $countTmp = $countTmp->where('start_time','<',strtotime($end . ' 23:59:59'));
             }
 
             //客服
@@ -214,12 +213,11 @@ class System extends Base
 
             //客服组
             if($group_id != 0){
-                $temp = $temp->where('group_id', 4);
-                $countTmp = $temp->where('group_id', 4);
+                $temp = $temp->where('group_id', $group_id);
+                $countTmp = $countTmp->where('group_id', $group_id);
             }
 
             $result = $temp->limit($offset, $limit)->order('start_time', 'desc')->select();
-            $return['total'] = $countTmp->count();  //总数据
 
             //所有客服
             $users = db('users')->select();
@@ -305,17 +303,17 @@ class System extends Base
                 }
             }
 
-//            $return['total'] = $countTmp->count();  //总数据
+            $return['total'] = $countTmp->count();  //总数据
             $return['rows'] = $result;
 
-            if (!$toExcel) {
-                return json($return);
-            } else {
-                $head = ['工单id', '访客进线时间', '接待客服', '所在组', '访客账号', '开始时间', '结束时间', '会话时长', '响应时长', '关闭原因', '满意度'];
-                $key = ['servicelog_id', 'intime', 'kefu_name', 'group_name', 'user_name', 'start_time', 'end_time', 'conversation', 'response', 'servicelog_close_type', 'evaluate_name'];
-                (new Office())->outdata('工作报表数据导出', $result, $head, $key);
-                return true;
-            }
+//            if (!$toExcel) {
+//                return json($return);
+//            } else {
+//                $head = ['工单id', '访客进线时间', '接待客服', '所在组', '访客账号', '开始时间', '结束时间', '会话时长', '响应时长', '关闭原因', '满意度'];
+//                $key = ['servicelog_id', 'intime', 'kefu_name', 'group_name', 'user_name', 'start_time', 'end_time', 'conversation', 'response', 'servicelog_close_type', 'evaluate_name'];
+//                (new Office())->outdata('工作报表数据导出', $result, $head, $key);
+//                return true;
+//            }
 
             return json($return);
 
@@ -456,19 +454,23 @@ class System extends Base
     public function toexcel()
     {
         $param = input('param.');
+
+        $limit = $param['pageSize'];
+        $offset = ($param['pageNumber'] - 1) * $limit;
+
         $start = $param['start'];
         $end = $param['end'];
         $where = [];
-        if(!empty($param['user_id'])){
-            $where['user_id'] = $param['user_id'];
+        if($param['user_id'] != 0){
+            $where['kf_id'] = $param['user_id'];
         }
-        if(!empty($param['group_id'])){
+        if($param['group_id'] != 0){
             $where['group_id'] = $param['group_id'];
         }
         if(!empty($param['username'])){
             $where['user_name'] = $param['username'];
         }
-        $result = db('service_log')->whereBetween('start_time', [strtotime($start), strtotime($end . ' 23:59:59')])->where($where)->order('start_time', 'desc')->select();
+        $result = db('service_log')->whereBetween('start_time', [strtotime($start), strtotime($end . ' 23:59:59')])->where($where)->limit($offset, $limit)->order('start_time', 'desc')->select();
 
         //所有客服
         $users = db('users')->select();
@@ -494,7 +496,7 @@ class System extends Base
             }else{
                 $result[$key]['end_time'] = '-';
             }
-            //客服
+            //客服
             for($i=0;$i<count($users);$i++){
                 if($result[$key]['kf_id'] == $users[$i]['id']){
                     $result[$key]['kefu_name'] = $users[$i]['user_name'];

+ 2 - 2
application/admin/view/system/basics.html

@@ -58,7 +58,7 @@
                             </div>
 
                         </div>
-                        <div class="form-group layui-form-item">
+                        <div class="form-group layui-form-item" style="display: none;">
                             <label class="col-sm-3 control-label">是否启用:</label>
                             <div class="input-group col-sm-6">
                                 {if !empty($status)}
@@ -79,7 +79,7 @@
                                 <button type="button" class="layui-btn layui-btn-small" id="up-logo">
                                     <i class="layui-icon"></i>上传logo</button>
                             </div>
-                            <span>建议上传70px*70px</span>
+                            <span>建议上传180px*50px</span>
                             <div class="input-group col-sm-3" id="logo">
                                 <img src="{$settings['logo']}" height="40px"/>
                             </div>