whitefang hai 1 ano
pai
achega
93bf63a5e5
Modificáronse 1 ficheiros con 18 adicións e 0 borrados
  1. 18 0
      app/workerapi/controller/WorksController.php

+ 18 - 0
app/workerapi/controller/WorksController.php

@@ -2,6 +2,9 @@
 namespace app\workerapi\controller;
 namespace app\workerapi\controller;
 
 
 use app\adminapi\logic\works\ServiceWorkLogic;
 use app\adminapi\logic\works\ServiceWorkLogic;
+use app\common\model\works\IssueWork;
+use app\common\model\works\ReturnWork;
+use app\common\model\works\ServiceWork;
 use app\workerapi\lists\HistoryWorkLists;
 use app\workerapi\lists\HistoryWorkLists;
 use app\workerapi\lists\IssueWorkLists;
 use app\workerapi\lists\IssueWorkLists;
 use app\workerapi\lists\ReturnWorkLists;
 use app\workerapi\lists\ReturnWorkLists;
@@ -14,6 +17,21 @@ use app\workerapi\validate\ServiceWorkValidate;
  */
  */
 class WorksController extends BaseApiController
 class WorksController extends BaseApiController
 {
 {
+    /**
+     * 首页数量统计
+     * @return \think\response\Json
+     * @throws \think\db\exception\DbException
+     */
+    public function statistics()
+    {
+        $result['service_work_count'] = ServiceWork::where(['master_worker_id'=>$this->userId])->whereIn('service_status','0,1,2')->where('work_status','<>',1)->count();
+        $result['assign_work_count'] = ServiceWork::where(['master_worker_id'=>$this->userId,'work_status'=>0])->count();
+        $result['pick_work_count'] = 0;
+        $result['return_work_count'] = ReturnWork::where(['master_worker_id'=>$this->userId])->where('return_work_status','<>',2)->count();
+        $result['issue_work_count'] = IssueWork::where(['master_worker_id'=>$this->userId])->where('issue_approval','<>',4)->count();
+        $result['review_work_count'] = ServiceWork::where(['master_worker_id'=>$this->userId,'work_status'=>7,'service_status'=>3])->count();
+        return $this->data($result);
+    }
 
 
     /**
     /**
      * 服务工单列表-全部
      * 服务工单列表-全部