whitefang 1 سال پیش
والد
کامیت
46a7dc96e8
1فایلهای تغییر یافته به همراه16 افزوده شده و 0 حذف شده
  1. 16 0
      app/api/lists/recharge/ServiceOrderLists.php

+ 16 - 0
app/api/lists/recharge/ServiceOrderLists.php

@@ -17,6 +17,7 @@ namespace app\api\lists\recharge;
 use app\api\lists\BaseApiDataLists;
 use app\common\enum\PayEnum;
 use app\common\model\recharge\RechargeOrder;
+use app\common\model\works\ServiceWork;
 
 /**
  * 服务订单列别
@@ -27,6 +28,20 @@ class ServiceOrderLists extends BaseApiDataLists
 {
     protected $count = 0;
 
+    public function queryWhere()
+    {
+        $where = [];
+        if (isset($this->params['service_status'])) {
+            $work_ids = ServiceWork::where(['user_id' => $this->userId])->where(function ($query) {
+                if($this->params['service_status'] != 'all'){
+                    $query->where(['service_status' => $this->params['service_status']]);
+                }
+            })->column('id');
+            $where['work_id'] = ['in', $work_ids];
+        }
+        return $where;
+    }
+
     /**
      * @notes 获取列表
      * @return array
@@ -41,6 +56,7 @@ class ServiceOrderLists extends BaseApiDataLists
         },'service_work'=>function ($query) {
             $query->visible(['service_status']);
         }])
+            ->where($this->queryWhere())
             ->visible(['id','sn','order_total','order_amount','pay_status','create_time'])
             ->where([
                 'order_type' => 0,