liugc 10 месяцев назад
Родитель
Сommit
8c05d785d7

+ 4 - 10
app/adminapi/controller/notice/NoticeController.php

@@ -20,6 +20,7 @@ use app\adminapi\logic\notice\NoticeLogic;
 use app\adminapi\validate\notice\NoticeValidate;
 use app\common\enum\notice\NoticeEnum;
 use app\common\model\notice\NoticeSetting;
+use app\common\service\OnlineCustomerService;
 use app\common\service\wechat\WeChatOaService;
 
 /**
@@ -93,16 +94,9 @@ class NoticeController extends BaseAdminController
     public function getUnifiedNotific()
     {
         $params = $this->request->post();
-        $params['data_rules'] = $this->adminInfo['data_rules']??[];
-        if(isset($params['business_codes']) && !empty($params['business_codes'])){
-            $result = NoticeLogic::getInformationBatch($params);
-        }else{
-            $result = NoticeLogic::getInformation($params);
-        }
-        if ($result) {
-            return $this->success('获取成功', $result);
-        }
-        return $this->fail(NoticeLogic::getError());
+        $params['admin_id'] = $this->adminId??0;
+        $result = OnlineCustomerService::getAllNotificList($params['admin_id'],$params['business_codes'],$params['is_test']??0);
+        return $this->success('', $result?:[]);
     }
     /**
      * @notes 后台测试通知

+ 1 - 8
app/adminapi/logic/works/ServiceWorkLogic.php

@@ -478,14 +478,7 @@ class ServiceWorkLogic extends BaseLogic
             }
 
             $work->finished_images = $params['finished_images'];
-            // 是否有三方的订单来源,若存在说明三方有系统 则自动确认报价
-            $platformOrders = ExternalPlatformOrders::where('work_id',$work->id)->findOrEmpty();
-            if($platformOrders->isEmpty()){
-                $work->user_confirm_status = 3;//待确认服务完成
-            }else{
-                $work->work_status = 6;
-                $work->user_confirm_status = 4;
-            }
+            $work->user_confirm_status = 3;//待确认服务完成
             $work->save();
 
             //添加变更日志

+ 37 - 18
app/common/service/OnlineCustomerService.php

@@ -14,9 +14,15 @@ class OnlineCustomerService
      *  $business_type: consultation servicework
      */
 
-    public array $business_types = [
-        'consultation',
-        'servicework'
+    public static array $business_types = [
+        'consultation'=>[
+            'to_router' => '/works/external_consultation',
+            'notificationTitle' => '客咨消息',
+        ],
+        'servicework'=>[
+            'to_router' => '/works/service_work',
+            'notificationTitle' => '订单消息',
+        ],
     ];
 
 
@@ -74,8 +80,6 @@ class OnlineCustomerService
         Log::info("分给在线客服:{$admin_id}:{$business_type}:{$business_id}");
         return $admin_id;
     }
-
-
     // 向客服发送消息提醒  $business_type = 地区编码+业务类型   consultation_notific   service_work_notific
     public static function customerSendMessage($admin_id,$business_type,$business_id){
         $notificList = Cache::store('common_redis')->get($business_type.'_notific');
@@ -91,6 +95,13 @@ class OnlineCustomerService
         return true;
     }
 
+    // 新来业务分配给某个客服,并向客服发送消息提醒
+    public static function assignBusinessToCustomer($business_type,$business_id){
+        $admin_id = self::getBusinessAllocationValue($business_type,$business_id);
+        self::customerSendMessage($admin_id,$business_type,$business_id);
+        return $admin_id;
+    }
+
     public static function getNotificList($admin_id,$business_type){
         $notificList = Cache::store('common_redis')->get($business_type.'_notific');
         if(empty($notificList)) $notificList = [];
@@ -100,22 +111,30 @@ class OnlineCustomerService
             $counts = array_count_values($notificList);
             $count = $counts[$admin_id] ?? 0;
         }
-        switch ($business_type){
-            case 'consultation':
-                $to_router = '/works/external_consultation';
-                $notificationTitle = '客咨消息';
-                break;
-            case 'servicework':
-                $to_router = '/works/service_work';
-                $notificationTitle = '订单消息';
-                break;
-            default:
-                $to_router = '/workbench';
-                $notificationTitle = '';
-                break;
+        $to_router = $notificationTitle =  '';
+        if(isset(self::$business_types[$business_type]) && self::$business_types[$business_type]){
+            $to_router = self::$business_types[$business_type]['to_router']??'/workbench';
+            $notificationTitle = self::$business_types[$business_type]['notificationTitle']??'';
         }
         return ['type'=>$business_type,'unique_code'=> md5($count),'to_router'=>$to_router,'notificationTitle' => $notificationTitle,'notific_count' => $count];
     }
 
+    public static function getAllNotificList($admin_id,$business_codes = [],$is_test = 0){
+        if($is_test){
+            return [
+                ['type'=>'consultation','unique_code'=> md5(time()),'to_router'=>'/works/external_consultation','notificationTitle' => '客咨消息','notific_count' => 5],
+                ['type'=>'servicework','unique_code'=> md5(time()),'to_router'=>'/works/service_work','notificationTitle' => '订单消息','notific_count' => 6]
+            ];
+        }
+        $res = [];
+        foreach (self::$business_types as $business_type) {
+            if(!empty($business_codes) && in_array($business_type,$business_codes)){
+                $res[] = self::getNotificList($admin_id,$business_type);
+            }else{
+                $res[] = self::getNotificList($admin_id,$business_type);
+            }
+        }
+        return $res;
+    }
 
 }