liugc 11 месяцев назад
Родитель
Сommit
bb9834cfd1

+ 12 - 5
app/adminapi/lists/external/ExternalConsultationLists.php

@@ -38,12 +38,19 @@ class ExternalConsultationLists extends BaseAdminDataLists implements ListsSearc
     public function setSearch(): array
     {
         return [
-            '=' => ['external_platform_id'],
-            '%like%' => ['user_name', 'mobile', 'unique_code'],
+            '=' => ['external_platform_id','follow_status'],
+            '%like%' => ['user_name', 'mobile', 'unique_code','remark'],
         ];
     }
 
-
+    public function queryWhere(){
+        $where = [];
+        if(isset($this->params['create_time_range']) && !empty($this->params['create_time_range'][0]) && !empty($this->params['create_time_range'][1])){
+            $time = [strtotime($this->params['create_time_range'][0]), strtotime($this->params['create_time_range'][1])+86400-1];
+            $where[] = ['create_time', 'between', $time];
+        }
+        return  $where;
+    }
     /**
      * @notes 获取列表
      * @return array
@@ -55,7 +62,7 @@ class ExternalConsultationLists extends BaseAdminDataLists implements ListsSearc
      */
     public function lists(): array
     {
-        return ExternalConsultation::with(['goods','customerLog'])->where($this->searchWhere)
+        return ExternalConsultation::with(['goods','customerLog','customerOrder'])->where($this->searchWhere)->where($this->queryWhere())
             ->field(['*'])
             ->limit($this->limitOffset, $this->limitLength)
             ->order(['id' => 'desc'])
@@ -72,7 +79,7 @@ class ExternalConsultationLists extends BaseAdminDataLists implements ListsSearc
      */
     public function count(): int
     {
-        return ExternalConsultation::where($this->searchWhere)->count();
+        return ExternalConsultation::where($this->searchWhere)->where($this->queryWhere())->count();
     }
 
 }

+ 1 - 1
app/adminapi/lists/works/ServiceWorkLists.php

@@ -70,7 +70,7 @@ class ServiceWorkLists extends BaseAdminDataLists implements ListsSearchInterfac
     public function setSearch(): array
     {
         return [
-            '=' => ['id','category_type', 'base_service_fee', 'service_fee', 'work_status', 'service_status',  'data_type',  'finished_images', 'master_worker_id', 'work_amount','work_type','appoint_approval','refund_approval', 'city','tenant_id','third_type','group_order_id'],
+            '=' => ['id','category_type', 'base_service_fee', 'service_fee', 'work_status', 'service_status',  'data_type',  'finished_images', 'master_worker_id', 'work_amount','work_type','appoint_approval','refund_approval', 'city','tenant_id','external_platform_id','group_order_id'],
             '%like%'=>[ 'work_sn','mobile','real_name', 'title', 'address']
         ];
     }

+ 1 - 1
app/adminapi/logic/external/ExternalConsultationLogic.php

@@ -150,7 +150,7 @@ class ExternalConsultationLogic extends BaseLogic
                 'amount' => $params['amount'],
                 'lon' => $params['lon'],
                 'lat' => $params['lat'],
-                'work_id' => $work_id,
+                //'work_id' => $work_id,
                 'remark' => $params['remark']
             ]);
             ExternalConsultationOrder::create([

+ 4 - 1
app/common/model/external/ExternalConsultation.php

@@ -44,5 +44,8 @@ class ExternalConsultation extends BaseModel
     {
         return $this->hasMany(ExternalConsultationFollowLog::class,'consultation_id','id')->order(['id'=>'desc']);
     }
-
+    public function customerOrder()
+    {
+        return $this->hasMany(ExternalConsultationOrder::class,'consultation_id','id')->order(['id'=>'desc']);
+    }
 }