|
|
@@ -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;
|
|
|
+ }
|
|
|
|
|
|
}
|