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

Merge branch 'master' of e.coding.net:zdap/weixiu/weixiu_api into m--douyin

# Conflicts:
#	app/adminapi/logic/external/ExternalConsultationLogic.php
liugc 9 месяцев назад
Родитель
Сommit
1b5ba6bd52

+ 5 - 3
app/adminapi/lists/works/ServiceWorkLists.php

@@ -61,7 +61,8 @@ class ServiceWorkLists extends BaseAdminDataLists implements ListsSearchInterfac
             $work_ids = PropertyOrder::where('property_head_id','in',$data_rules['property_head_id'])->column('work_id')??[];
             $where[] = ['id','in' ,$work_ids];
         }
-        if(in_array($this->adminId,OnlineCustomerService::$admin_ids['consultation']) || in_array($this->adminId,OnlineCustomerService::$admin_ids['servicework'])){
+        if((in_array($this->adminId,OnlineCustomerService::$admin_ids['consultation']) || in_array($this->adminId,OnlineCustomerService::$admin_ids['servicework']))
+            && !in_array($this->adminId,OnlineCustomerService::$manager_admin_ids)){
             $where[] = ['admin_id','in' ,[0,$this->adminId]];
             $time = [time() - (30 * 86400), time()];
             $where[] = ['create_time', 'between', $time];
@@ -200,12 +201,13 @@ class ServiceWorkLists extends BaseAdminDataLists implements ListsSearchInterfac
             },
             'rechargeOrder' =>function(Query $query){
                 $query->field('id,work_id,tenant_id,order_type,payment_type,pay_way,pay_status,pay_time,coupon_id,coupon_price,order_total,order_amount,paid_amount,refund_status');
-            }
+            },
+            'admin'
         ])
             ->where($this->searchWhere)
             ->where($this->queryWhere())
             ->where($this->queryDataWhere())
-            ->field(['id', 'spare_total','external_platform_id', 'work_total','work_sn', 'real_name', 'mobile', 'address', 'title', 'category_type', 'goods_category_ids', 'goods_category_id', 'base_service_fee', 'service_fee', 'work_status','work_pay_status', 'service_status', 'dispatch_time', 'receive_time', 'appointment_time', 'finished_images', 'finished_time', 'master_worker_id', 'work_amount', 'work_type', 'create_time', 'update_time','lon', 'lat','appoint_approval','refund_approval','finally_door_time','property_activity_id','order_effective_id','estimated_finish_time','third_type','area_name'])
+            ->field(['id', 'admin_id','spare_total','external_platform_id', 'work_total','work_sn', 'real_name', 'mobile', 'address', 'title', 'category_type', 'goods_category_ids', 'goods_category_id', 'base_service_fee', 'service_fee', 'work_status','work_pay_status', 'service_status', 'dispatch_time', 'receive_time', 'appointment_time', 'finished_images', 'finished_time', 'master_worker_id', 'work_amount', 'work_type', 'create_time', 'update_time','lon', 'lat','appoint_approval','refund_approval','finally_door_time','property_activity_id','order_effective_id','estimated_finish_time','third_type','area_name'])
             ->append(['service_status_text','category_type_text','third_type_text'])
             ->limit($this->limitOffset, $this->limitLength)
             ->order(['id' => 'desc'])

+ 2 - 1
app/adminapi/logic/external/ExternalConsultationLogic.php

@@ -169,8 +169,9 @@ class ExternalConsultationLogic extends BaseLogic
             ]);
             Db::commit();
 
+            $admin_id = ExternalConsultation::where('id', $params['id'])->value('admin_id')??0;
             // 分配客服派单
-            OnlineCustomerService::serviceWorkMessage($work_id);
+            OnlineCustomerService::serviceWorkMessage($work_id,$admin_id);
             return $consultationOrder['id'];
         } catch (\Exception $e) {
             Db::rollback();

+ 5 - 0
app/common/model/works/ServiceWork.php

@@ -17,6 +17,7 @@ namespace app\common\model\works;
 
 use app\adminapi\logic\ConfigLogic;
 use app\api\logic\PerformanceLogic;
+use app\common\model\auth\Admin;
 use app\common\model\BaseModel;
 use app\common\model\equity\EquityConfig;
 use app\common\model\equity\UserEquity;
@@ -124,6 +125,10 @@ class ServiceWork extends BaseModel
     {
         return $this->hasMany(ServiceWorkLog::class,'work_id','id')->order(['id'=>'desc']);
     }
+    public function admin()
+    {
+        return $this->hasOne(Admin::class,'id','admin_id')->field('id,name,account,area_name');
+    }
     public function serviceWorkCustomerLog()
     {
         return $this->hasMany(ServiceWorkCustomerLog::class,'work_id','id')->order(['id'=>'desc']);

+ 5 - 4
app/common/service/OnlineCustomerService.php

@@ -14,7 +14,8 @@ class OnlineCustomerService
      *  某客服不同类型消息提醒: consultation_notific   service_work_notific
      *  $business_type: consultation servicework
      */
-
+    // 客服主管账号能看所有的
+    public static array $manager_admin_ids = [4];
     public static array $admin_ids = [
         'consultation'=>[4,16],
         'servicework'=>[4,16],
@@ -116,8 +117,8 @@ class OnlineCustomerService
     }
 
     // 新来业务分配给某个客服,并向客服发送消息提醒
-    public static function assignBusinessToCustomer($business_type,$business_id){
-        $admin_id = self::getBusinessAllocationValue($business_type,$business_id);
+    public static function assignBusinessToCustomer($business_type,$business_id,$admin_id = 0){
+        empty($admin_id) && $admin_id = self::getBusinessAllocationValue($business_type,$business_id);
         self::customerSendMessage($admin_id,$business_type,$business_id);
         return $admin_id;
     }
@@ -163,7 +164,7 @@ class OnlineCustomerService
 
     // 分配客服派单
     public static function serviceWorkMessage($work_id = '',$admin_id = 0){
-        $admin_id = self::assignBusinessToCustomer('servicework',$work_id);
+        $admin_id = self::assignBusinessToCustomer('servicework',$work_id,$admin_id);
         // 绑定 $res['data']['admin_id']
         $admin_id > 0 && ServiceWork::where('id',$work_id)->update([
             'admin_id' => $admin_id,