whitefang 1 год назад
Родитель
Сommit
27b76cc3ee
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      app/workerapi/logic/MasterWorkerLogic.php

+ 5 - 3
app/workerapi/logic/MasterWorkerLogic.php

@@ -136,12 +136,14 @@ class MasterWorkerLogic extends  BaseLogic
         $worker['is_bank']  =   !empty($is_bank)?1:0;
         $worker['is_service_agree'] = !empty($pdf)?1:0;
 
-        //今日收益
-        $worker['account_today'] = MasterWorkerAccountLog::where(['worker_id'=> $worker['id'],'action'=>1,'change_type'=>WorkerAccountLogEnum::UM_INC_ADMIN])->whereTime('create_time', 'today')->sum('change_amount');
+        //今日退款
+        $worker['refund_account_today'] = MasterWorkerAccountLog::where(['worker_id'=> $worker['id'],'action'=>2,'change_type'=>WorkerAccountLogEnum::UM_DEC_ADMIN])->whereTime('create_time', 'today')->sum('change_amount');
+         //今日收益
+        $worker['account_today'] = MasterWorkerAccountLog::where(['worker_id'=> $worker['id'],'action'=>1,'change_type'=>WorkerAccountLogEnum::UM_INC_ADMIN])->whereTime('create_time', 'today')->sum('change_amount')-$worker['refund_account_today'];
         //本月成功订单
         $worker['success_work'] = ServiceWork::where(['master_worker_id'=>$worker['id'],'service_status'=>3])->whereTime('create_time', 'month')->count();
         //本月失败单
-        $worker['fail_work'] = ServiceWork::where(['master_worker_id'=>$worker['id'],'service_status'=>4])->whereTime('create_time', 'month')->count();
+        $worker['fail_work'] = ServiceWork::where(['master_worker_id'=>$worker['id']])->whereIn('service_status','4,5')->whereTime('create_time', 'month')->count();
         return $worker;
     }