liugc 1 год назад
Родитель
Сommit
d778730b1b
1 измененных файлов с 14 добавлено и 6 удалено
  1. 14 6
      app/adminapi/logic/notice/NoticeLogic.php

+ 14 - 6
app/adminapi/logic/notice/NoticeLogic.php

@@ -253,10 +253,18 @@ class NoticeLogic extends BaseLogic
                 return $noticeInfo;
             }*/
             //$params['business_code']
+            $where = [];
+            if (isset($params['all_tenant'])) {
+                if((int)$params['all_tenant'] === 1){
+                    $where[] = ['tenant_id','>' ,0];
+                }else{
+                    $where[] = ['tenant_id','=', 0];
+                }
+            }
             switch ($params['business_code']){
                 case 'service_work':
                     // 用户下单待派单 service_status
-                    $serviceWorkCount = ServiceWork::where('work_status', 0)->where('service_status','<', 3)->where('work_pay_status','>', 0)->count('id');
+                    $serviceWorkCount = ServiceWork::where($where)->where('work_status', 0)->where('service_status','<', 3)->where('work_pay_status','>', 0)->count('id');
                     if($serviceWorkCount){
                         $noticeInfo['confirm_code'] = 101;
                         $noticeInfo['count'] = $serviceWorkCount;
@@ -266,7 +274,7 @@ class NoticeLogic extends BaseLogic
                     break;
                 case 'work_status_receive':
                     // 用户下单待派单 service_status
-                    $serviceWorkCount = ServiceWork::where('work_status', 1)->where('work_pay_status','>', 0)->count('id');
+                    $serviceWorkCount = ServiceWork::where($where)->where('work_status', 1)->where('work_pay_status','>', 0)->count('id');
                     if($serviceWorkCount){
                         $noticeInfo['confirm_code'] = 101;
                         $noticeInfo['count'] = $serviceWorkCount;
@@ -276,7 +284,7 @@ class NoticeLogic extends BaseLogic
                     break;
                 case 'work_status_contact':
                     // 用户下单待派单 service_status
-                    $serviceWorkCount = ServiceWork::where('work_status', 2)->where('work_pay_status','>', 0)->count('id');
+                    $serviceWorkCount = ServiceWork::where($where)->where('work_status', 2)->where('work_pay_status','>', 0)->count('id');
                     if($serviceWorkCount){
                         $noticeInfo['confirm_code'] = 101;
                         $noticeInfo['count'] = $serviceWorkCount;
@@ -296,7 +304,7 @@ class NoticeLogic extends BaseLogic
                     break;
                 case 'appoint_approval':
                     // 用户更新工单上门时间超过15分钟工程师未确认
-                    $serviceWorkCount = ServiceWork::where('appoint_approval', 1)->where('refund_approval','=',0)->where('work_pay_status','>',0)->where('update_time','<', time()-15*60)->count('id');
+                    $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){
                         $noticeInfo['confirm_code'] = 101;
                         $noticeInfo['count'] = $serviceWorkCount;
@@ -306,7 +314,7 @@ class NoticeLogic extends BaseLogic
                     break;
                 case 'refund_approval':
                     // 用户退款状态审核中
-                    $serviceWorkCount = ServiceWork::where('refund_approval', 1)->where('work_pay_status','>',0)->count('id');
+                    $serviceWorkCount = ServiceWork::where($where)->where('refund_approval', 1)->where('work_pay_status','>',0)->count('id');
                     if($serviceWorkCount){
                         $noticeInfo['confirm_code'] = 101;
                         $noticeInfo['count'] = $serviceWorkCount;
@@ -327,7 +335,7 @@ 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]);
+                $noticeInfo = self::getInformation(['business_code'=>$business_code,'all_tenant'=>($params['all_tenant']??0)]);
                 if($noticeInfo['confirm_code'] == 101){
                     $res[$business_code] = $noticeInfo['count'];
                 }else{