Просмотр исходного кода

up - 通用消息增加地区业务

liugc 9 месяцев назад
Родитель
Сommit
3818262374

+ 3 - 1
app/adminapi/controller/notice/NoticeController.php

@@ -95,7 +95,9 @@ class NoticeController extends BaseAdminController
     {
         $params = $this->request->post();
         $params['admin_id'] = $this->adminId??0;
-        $result = OnlineCustomerService::getAllNotificList($params['admin_id'],$params['business_codes'],$params['is_test']??0);
+        $business_codes = [];
+        isset($params['business_codes']) && $params['business_codes'] && $business_codes = explode(',',$params['business_codes']);
+        $result = OnlineCustomerService::getAllNotificList($params['admin_id'],$business_codes,$params['prefix']??'',$params['is_test']??0);
         return $this->success('', $result?:[]);
     }
     /**

+ 5 - 0
app/adminapi/logic/works/ServiceWorkLogic.php

@@ -240,6 +240,11 @@ class ServiceWorkLogic extends BaseLogic
             ];
             ServiceWorkLogLogic::add($work_log);
             Db::commit();
+
+            // 外部平台工单 - 通知外边平台
+            if($work->external_platform_id > 0){
+                ExternalPlatformLogic::generalServiceWork('1003',['work_id' => $work->id]);
+            }
         }
         catch (\Exception $e) {
             Db::rollback();

+ 16 - 4
app/common/controller/NotificTestController.php

@@ -21,7 +21,7 @@ use think\facade\Log;
 class NotificTestController extends BaseLikeAdminController
 {
     public array $notNeedLogin = ['addOnlineCustomerService','subOnlineCustomerService','getBusinessAllocationValue',
-        'customerSendMessage','customerClsMessage','getNotificList'];
+        'customerSendMessage','assignBusinessToCustomer','customerClsMessage','getNotificList','getAllNotificList'];
 
 
     public function addOnlineCustomerService(){
@@ -35,9 +35,9 @@ class NotificTestController extends BaseLikeAdminController
     }
 
     // 新来业务分配给哪个客服编号
-    public function getBusinessAllocationValue(){
+    /*public function getBusinessAllocationValue(){
         $prams = $this->request->param();
-        return $this->success('', OnlineCustomerService::getBusinessAllocationValue($prams['business_type'],$prams['business_id']), 1, 1);
+        return $this->success('', [OnlineCustomerService::getBusinessAllocationValue($prams['business_type'],$prams['business_id'])], 1, 1);
     }
 
 
@@ -45,8 +45,16 @@ class NotificTestController extends BaseLikeAdminController
     public function customerSendMessage(){
         $prams = $this->request->param();
         return $this->success('', [OnlineCustomerService::customerSendMessage($prams['admin_id'],$prams['business_type'],$prams['business_id'])], 1, 1);
+    }*/
+
+
+
+    public function assignBusinessToCustomer(){
+        $prams = $this->request->param();
+        return $this->success('', [OnlineCustomerService::assignBusinessToCustomer($prams['business_type'],$prams['business_id'])], 1, 1);
     }
-    public function customerClsMessage($business_type,$business_id){
+
+    public function customerClsMessage(){
         $prams = $this->request->param();
         return $this->success('', [OnlineCustomerService::customerClsMessage($prams['business_type'],$prams['business_id'])], 1, 1);
     }
@@ -56,6 +64,10 @@ class NotificTestController extends BaseLikeAdminController
         return $this->success('', OnlineCustomerService::getNotificList($prams['admin_id'],$prams['business_type']), 1, 1);
     }
 
+    public function getAllNotificList(){
+        $prams = $this->request->param();
+        return $this->success('', OnlineCustomerService::getAllNotificList($prams['admin_id'],['consultation','servicework'],$prams['prefix']??'',$prams['is_test']??0), 1, 1);
+    }
 
 
 }

+ 9 - 8
app/common/service/OnlineCustomerService.php

@@ -102,8 +102,8 @@ class OnlineCustomerService
         return $admin_id;
     }
 
-    public static function getNotificList($admin_id,$business_type){
-        $notificList = Cache::store('common_redis')->get($business_type.'_notific');
+    public static function getNotificList($admin_id,$business_type,$prefix = ''){
+        $notificList = Cache::store('common_redis')->get($prefix.$business_type.'_notific');
         if(empty($notificList)) $notificList = [];
 
         $count = 0;
@@ -119,19 +119,20 @@ class OnlineCustomerService
         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){
+    public static function getAllNotificList($admin_id,$business_codes = [],$prefix = '',$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]
+                ['type'=>'consultation','mp3_url'=>'','unique_code'=> md5('consultation'.time()),'to_router'=>'/works/external_consultation','notificationTitle' => '客咨消息','notific_count' => 5],
+                ['type'=>'servicework','mp3_url'=>'','unique_code'=> md5('servicework'.time()),'to_router'=>'/works/service_work','notificationTitle' => '订单消息','notific_count' => 6]
             ];
         }
         $res = [];
-        foreach (self::$business_types as $business_type) {
+        //$prefix = ''; // 地区业务值
+        foreach (self::$business_types as $business_type => $info) {
             if(!empty($business_codes) && in_array($business_type,$business_codes)){
-                $res[] = self::getNotificList($admin_id,$business_type);
+                $res[] = self::getNotificList($admin_id,$business_type,$prefix);
             }else{
-                $res[] = self::getNotificList($admin_id,$business_type);
+                $res[] = self::getNotificList($admin_id,$business_type,$prefix);
             }
         }
         return $res;