Browse Source

单客服,改成多客服

lizhen_gitee 5 months ago
parent
commit
4928dd730a

+ 0 - 1
application/api/controller/Baseconfig.php

@@ -17,7 +17,6 @@ class Baseconfig extends Api
     public function index(){
 
         $config = [
-            'kefu_user_ids'            => config('site.kefu_user_ids'),//在线客服人员
             'nowtime'                  => time(),
             'nowdate'                  => date('Y-m-d H:i:s'),
             'nowdate1'                 => date('Y-m-d H:i:s',time()+3600),

+ 2 - 1
application/api/controller/Index.php

@@ -55,7 +55,8 @@ class Index extends Api
         $dongtai = list_domain_image($dongtai, ['image']);
 
         //维保公司的客服
-        $kefu_id = Db::name('pc_admin')->where('company_id',$this->auth->company_id)->order('is_kefu desc,id asc')->value('id');
+//        $kefu_id = Db::name('pc_admin')->where('company_id',$this->auth->company_id)->order('is_kefu desc,id asc')->value('id');
+        $kefu_id = $this->auth->company_id;
 
         //
         $result = [

+ 23 - 3
application/api/controller/worker/Baseconfig.php

@@ -15,16 +15,36 @@ class Baseconfig extends Apiw
    
     public function index(){
         //维保公司的客服
-        $kefu = Db::name('pc_admin')->where('company_id',$this->auth->company_id)->order('is_kefu desc,id asc')->find();
+//        $kefu = Db::name('pc_admin')->where('company_id',$this->auth->company_id)->order('is_kefu desc,id asc')->find();
+
+        $company = Db::name('company')->where('id',$this->auth->company_id)->find();
 
         $config = [
-            'company_im_kefu'      => 'kefu_'.$kefu['id'],
-            'company_mobile'      => $kefu['mobile'],
+            'company_im_kefu'      => 'kefu_'.$this->auth->company_id,
+            'company_mobile'       => $company['mobile'],
         ];
 
         $this->success('success',$config);
     }
 
+    //给师傅端用的usersig
+    //user_用户端小程序,master_师傅,kefu_客服
+    public function tenim_usersig(){
+        $user_id = "master_".$this->auth->id;
+
+        // 获取配置信息
+        $config = config("tencent_im");
+//        $usersigObj = new getusersig($config["sdkappid"],$config["key"]);
+//        $usersig = $usersigObj->genUserSig($user_id);
+
+        $rs = [
+//            'usersig' => $usersig,
+            'sdkappid' => $config['sdkappid'],
+        ];
+
+        $this->success(1,$rs);
+    }
+
 
     //师傅端版本
     public function app_version(){

+ 1 - 1
application/company/controller/Baseconfig.php

@@ -28,7 +28,7 @@ class Baseconfig extends Apic
     //给pc端用的usersig
     //user_用户端小程序,master_师傅,kefu_客服
     public function tenim_usersig(){
-        $user_id = "kefu_".$this->auth->id;
+        $user_id = "kefu_".$this->auth->company_id;
 
         // 获取配置信息
         $config = config("tencent_im");

+ 9 - 2
application/company/controller/auth/Admin.php

@@ -311,9 +311,16 @@ class Admin extends Apic
      */
     public function set_kefu(){
         $id = input('id',0);
+        $is_kefu = input('is_kefu',1);
 
-        Db::name('pc_admin')->where('company_id',$this->auth->company_id)->update(['is_kefu'=>0]);
-        Db::name('pc_admin')->where('id',$id)->update(['is_kefu'=>1]);
+        if($is_kefu == 1){
+            $count = Db::name('pc_admin')->where('company_id',$this->company_id)->where('is_kefu',1)->count();
+            if($count >= 10){
+                $this->error('最多只能设置10个客服');
+            }
+        }
+
+        Db::name('pc_admin')->where('id',$id)->update(['is_kefu'=>$is_kefu]);
 
         $this->success();
     }