liugc 1 год назад
Родитель
Сommit
095d0351a8

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

@@ -78,6 +78,7 @@ class NoticeController extends BaseAdminController
     public function getInformation()
     {
         $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{

+ 44 - 2
app/adminapi/logic/notice/NoticeLogic.php

@@ -254,6 +254,7 @@ class NoticeLogic extends BaseLogic
             }*/
             //$params['business_code']
             $where = [];
+            $data_rules = $params['data_rules'];
             if (isset($params['all_tenant'])) {
                 if((int)$params['all_tenant'] === 1){
                     $where[] = ['tenant_id','>' ,0];
@@ -263,6 +264,12 @@ class NoticeLogic extends BaseLogic
             }
             switch ($params['business_code']){
                 case 'service_work':
+                    if (isset($data_rules['province']) && !empty($data_rules['province'])) {
+                        $where[] = ['province','in' ,$data_rules['province']];
+                    }
+                    if (isset($data_rules['city']) && !empty($data_rules['city'])) {
+                        $where[] = ['city','in' ,$data_rules['city']];
+                    }
                     // 用户下单待派单 service_status
                     $serviceWorkCount = ServiceWork::where($where)->where('work_status', 0)->where('service_status','<', 3)->where('work_pay_status','>', 0)->count('id');
                     if($serviceWorkCount){
@@ -273,6 +280,12 @@ class NoticeLogic extends BaseLogic
                     }
                     break;
                 case 'work_status_receive':
+                    if (isset($data_rules['province']) && !empty($data_rules['province'])) {
+                        $where[] = ['province','in' ,$data_rules['province']];
+                    }
+                    if (isset($data_rules['city']) && !empty($data_rules['city'])) {
+                        $where[] = ['city','in' ,$data_rules['city']];
+                    }
                     // 用户下单待派单 service_status
                     $serviceWorkCount = ServiceWork::where($where)->where('work_status', 1)->where('work_pay_status','>', 0)->count('id');
                     if($serviceWorkCount){
@@ -283,6 +296,12 @@ class NoticeLogic extends BaseLogic
                     }
                     break;
                 case 'work_status_contact':
+                    if (isset($data_rules['province']) && !empty($data_rules['province'])) {
+                        $where[] = ['province','in' ,$data_rules['province']];
+                    }
+                    if (isset($data_rules['city']) && !empty($data_rules['city'])) {
+                        $where[] = ['city','in' ,$data_rules['city']];
+                    }
                     // 用户下单待派单 service_status
                     $serviceWorkCount = ServiceWork::where($where)->where('work_status', 2)->where('work_pay_status','>', 0)->count('id');
                     if($serviceWorkCount){
@@ -293,8 +312,15 @@ class NoticeLogic extends BaseLogic
                     }
                     break;
                 case 'worker_register':
+                    $whereRegister = [];
+                    if (isset($data_rules['province']) && !empty($data_rules['province'])) {
+                        $whereRegister[] = ['province','in' ,$data_rules['province']];
+                    }
+                    if (isset($data_rules['city']) && !empty($data_rules['city'])) {
+                        $whereRegister[] = ['city','in' ,$data_rules['city']];
+                    }
                     // 工程师入驻待审核
-                    $workerRegisterCount = MasterWorkerRegister::where('status', 0)->count('id');
+                    $workerRegisterCount = MasterWorkerRegister::where('status', 0)->where($whereRegister)->count('id');
                     if($workerRegisterCount){
                         $noticeInfo['confirm_code'] = 101;
                         $noticeInfo['count'] = $workerRegisterCount;
@@ -303,6 +329,12 @@ class NoticeLogic extends BaseLogic
                     }
                     break;
                 case 'appoint_approval':
+                    if (isset($data_rules['province']) && !empty($data_rules['province'])) {
+                        $where[] = ['province','in' ,$data_rules['province']];
+                    }
+                    if (isset($data_rules['city']) && !empty($data_rules['city'])) {
+                        $where[] = ['city','in' ,$data_rules['city']];
+                    }
                     // 用户更新工单上门时间超过15分钟工程师未确认
                     $serviceWorkCount = ServiceWork::where($where)->where('appoint_approval', 1)->where('refund_approval','=',0)->where('work_pay_status','>',0)->where('update_time','<', time()-15*60)->count('id');
                     if($serviceWorkCount){
@@ -313,6 +345,12 @@ class NoticeLogic extends BaseLogic
                     }
                     break;
                 case 'refund_approval':
+                    if (isset($data_rules['province']) && !empty($data_rules['province'])) {
+                        $where[] = ['province','in' ,$data_rules['province']];
+                    }
+                    if (isset($data_rules['city']) && !empty($data_rules['city'])) {
+                        $where[] = ['city','in' ,$data_rules['city']];
+                    }
                     // 用户退款状态审核中
                     $serviceWorkCount = ServiceWork::where($where)->where('refund_approval', 1)->where('work_pay_status','>',0)->count('id');
                     if($serviceWorkCount){
@@ -335,7 +373,11 @@ class NoticeLogic extends BaseLogic
             $res = [];
             $params['business_codes'] = explode(',',$params['business_codes']);
             foreach ($params['business_codes'] as $business_code) {
-                $noticeInfo = self::getInformation(['business_code'=>$business_code,'all_tenant'=>($params['all_tenant']??0)]);
+                $noticeInfo = self::getInformation([
+                    'business_code'=>$business_code,
+                    'all_tenant'=>($params['all_tenant']??0),
+                    'data_rules'=>($params['data_rules']??[]),
+                ]);
                 if($noticeInfo['confirm_code'] == 101){
                     $res[$business_code] = $noticeInfo['count'];
                 }else{