lip 1 lună în urmă
părinte
comite
86897f7f01

+ 1 - 1
app/admin/controller/Kefu.php

@@ -54,7 +54,7 @@ class Kefu extends BaseController
             }
             }
 
 
             $count = $query->count();
             $count = $query->count();
-            $list = $query->field(['kefu_work.id', 'user.realname as nickname','user.is_online', 'user.chat_num','kefu_work.transfer_num','kefu_work.intervention_num','kefu_work.completed_num','kefu_work.created_at'])
+            $list = $query->field(['kefu_work.id', 'user.user_id','user.realname as nickname','user.is_online', 'user.chat_num','kefu_work.transfer_num','kefu_work.intervention_num','kefu_work.completed_num','kefu_work.created_at'])
                         ->order('user.is_online', 'desc')  
                         ->order('user.is_online', 'desc')  
                         ->limit($limit)
                         ->limit($limit)
                         ->page($page)
                         ->page($page)

+ 9 - 9
app/common/controller/User.php

@@ -47,14 +47,14 @@ class User
         $token = $this->request->param('token');
         $token = $this->request->param('token');
         
         
         if (!$token) {
         if (!$token) {
-            return json(['code' => 400, 'msg' => 'user.token_error']);
+            return ret(lang('user.token_error'));
         }
         }
         
         
         try {
         try {
             Db::startTrans();
             Db::startTrans();
             $user_id = UserSession::where('token',$token)->where('expire_time','>', time())->value('user_id');
             $user_id = UserSession::where('token',$token)->where('expire_time','>', time())->value('user_id');
             if(!$user_id){
             if(!$user_id){
-                return json(['code' => 400, 'msg' => 'user.token_error']);
+                return ret(lang('user.token_error'));
             }
             }
 
 
             $cs_uid = getAutoCsUid();   
             $cs_uid = getAutoCsUid();   
@@ -77,8 +77,8 @@ class User
                 $userInfo['setting']=$setting;
                 $userInfo['setting']=$setting;
             }
             }
             
             
-            if($userInfo['status']==0){
-                return warning(lang('user.forbid'));
+            if($userInfo['status']==1){
+                return ret(lang('user.forbid'));
             }  
             }  
             
             
             $update=[
             $update=[
@@ -102,7 +102,7 @@ class User
             Db::commit();
             Db::commit();
         } catch (\Exception $e) {
         } catch (\Exception $e) {
             Db::rollback();
             Db::rollback();
-            return json(['code' => 400, 'msg' => $e->getMessage()]);
+            return error($e->getMessage());
         }
         }
         
         
         //如果登录信息中含有client——id则自动进行绑定
         //如果登录信息中含有client——id则自动进行绑定
@@ -132,7 +132,7 @@ class User
         $params=request()->param();
         $params=request()->param();
         $where['role'] = 0;
         $where['role'] = 0;
         if (empty($params['account']) || empty($params['uid']) || empty($params['from'])) {
         if (empty($params['account']) || empty($params['uid']) || empty($params['from'])) {
-            return json(['code' => 400, 'msg' => '参数错误']);
+            return ret(lang('参数错误'));
         }
         }
         if (!empty($params['account'])) {
         if (!empty($params['account'])) {
             $where[] = ['account', '=', $params['account']];
             $where[] = ['account', '=', $params['account']];
@@ -185,8 +185,8 @@ class User
                     $userInfo['setting']=$setting;
                     $userInfo['setting']=$setting;
                 }
                 }
             }
             }
-            if($userInfo['status']==0){
-                return warning(lang('user.forbid'));
+            if($userInfo['status']==1){
+                return ret(lang('user.forbid'));
             }  
             }  
             
             
             $update=[
             $update=[
@@ -211,7 +211,7 @@ class User
             Db::commit();
             Db::commit();
         } catch (\Exception $e) {
         } catch (\Exception $e) {
             Db::rollback();
             Db::rollback();
-            return json(['code' => 400, 'msg' => $e->getMessage()]);
+            return error($e->getMessage());
         }
         }
         
         
         //如果登录信息中含有client——id则自动进行绑定
         //如果登录信息中含有client——id则自动进行绑定

+ 7 - 7
app/enterprise/controller/Im.php

@@ -273,7 +273,7 @@ class Im extends BaseController
     {
     {
         $this->userInfo['cs_uid'] = User::where('user_id', $this->userInfo['user_id'])->value('cs_uid');
         $this->userInfo['cs_uid'] = User::where('user_id', $this->userInfo['user_id'])->value('cs_uid');
 
 
-       $map = [['status', '=', 1], ['user_id', '<>', $this->userInfo['user_id']]];
+       $map = [['status', '=', 0], ['user_id', '<>', $this->userInfo['user_id']]];
     //   if ($this->userInfo['role'] != 0) {
     //   if ($this->userInfo['role'] != 0) {
     //       $map[] = ['service_status', '<>', -1];
     //       $map[] = ['service_status', '<>', -1];
     //   }
     //   }
@@ -329,15 +329,15 @@ class Im extends BaseController
             return warning("请输入内容");
             return warning("请输入内容");
         }
         }
         $param['user_id'] = $this->userInfo['user_id'];
         $param['user_id'] = $this->userInfo['user_id'];
-        $param['language_code'] = $this->lang;
+        $param['language'] = $this->lang;
         if ($this->userInfo['role'] != 0 && $param['type'] == 'text') {
         if ($this->userInfo['role'] != 0 && $param['type'] == 'text') {
             //客服或管理员给用户发送消息,需要按照用户的语言做翻译
             //客服或管理员给用户发送消息,需要按照用户的语言做翻译
             $toContactId = $param['toContactId'];
             $toContactId = $param['toContactId'];
-            $toUser = User::where('user_id', $toContactId)->field(['role', 'language_code'])->find();
-            if ($toUser && $toUser['role'] == 0 && $toUser['language_code']) {
+            $toUser = User::where('user_id', $toContactId)->field(['role', 'language'])->find();
+            if ($toUser && $toUser['role'] == 0 && $toUser['language']) {
                 //谷歌翻译
                 //谷歌翻译
-                $param['translate_content'] = google_translate($param['content'], $toUser['language_code']);
-                $param['language_code'] = $toUser['language_code'];
+                $param['translate_content'] = google_translate($param['content'], $toUser['language']);
+                $param['language'] = $toUser['language'];
             }
             }
         }
         }
         // if ($this->userInfo['role'] == 0) {
         // if ($this->userInfo['role'] == 0) {
@@ -347,7 +347,7 @@ class Im extends BaseController
         //         User::where('user_id', $this->userInfo['user_id'])->update(['service_status' => 0]);
         //         User::where('user_id', $this->userInfo['user_id'])->update(['service_status' => 0]);
         //     }
         //     }
         // }
         // }
-        $param['language_code'] = $this->lang;
+        $param['language'] = $this->lang;
         $message=new Message();
         $message=new Message();
         $data = $message->sendMessage($param,$this->globalConfig);
         $data = $message->sendMessage($param,$this->globalConfig);
         //已发送的消息,设置成已读
         //已发送的消息,设置成已读

+ 3 - 3
app/enterprise/model/Message.php

@@ -73,7 +73,7 @@ class Message extends BaseModel
 
 
          //    发送消息
          //    发送消息
     public function sendMessage($param,$globalConfig=false){
     public function sendMessage($param,$globalConfig=false){
-        $param['language_code'] = $param['language_code'] ?? 'en';
+        $param['language'] = $param['language'] ?? 'en';
         $is_group = $param['is_group'] ?? 0;
         $is_group = $param['is_group'] ?? 0;
         $uid=self::$uid ? : ($param['user_id'] ?? 1);
         $uid=self::$uid ? : ($param['user_id'] ?? 1);
         $is_robot = false; //是否给机器人发送消息
         $is_robot = false; //是否给机器人发送消息
@@ -191,13 +191,13 @@ class Message extends BaseModel
                 if ($question) {
                 if ($question) {
                     $param['type'] = 'list';
                     $param['type'] = 'list';
                     $content = [
                     $content = [
-                        'title' => Config::getFieldValue('reply_keyword',$param['language_code']),
+                        'title' => Config::getFieldValue('reply_keyword',$param['language']),
                         'list' => $question,
                         'list' => $question,
                     ];
                     ];
                     $param['content'] = json_encode($content);
                     $param['content'] = json_encode($content);
                 } else {
                 } else {
                     $param['type'] = 'text';
                     $param['type'] = 'text';
-                    $param['content'] = Config::getFieldValue('reply_keyword_math_fail',$param['language_code']);
+                    $param['content'] = Config::getFieldValue('reply_keyword_math_fail',$param['language']);
                 }
                 }
             }
             }