zilong 4 年 前
コミット
828e6314ce
1 ファイル変更3 行追加7 行削除
  1. 3 7
      app/Http/Controllers/Api/V1/DocterController.php

+ 3 - 7
app/Http/Controllers/Api/V1/DocterController.php

xqd xqd
@@ -156,7 +156,6 @@ class DocterController extends AuthController
         $req = request()->post();
         $this->validate(request(), [
             'docter_id' => 'required|integer',
-            'list_type' => 'in:0,1,2,3',
             'latitude' => 'numeric',
             'longitude' => 'numeric',
         ]);
@@ -164,13 +163,10 @@ class DocterController extends AuthController
 
         $distance_field = get_user_distance_field($user);
 
-        $data = Docter::with('office', 'qualification', 'evaluate.user')->select(['id', 'type', 'name', 'phone', 'sex', 'birthday', 'avatar', 'status', 'label', 'sign', 'intro', 'office_id', 'qualification_id', 'score', 'service_persons', 'eva_num', 'service_days', 'phone_minutes', 'chat_price', 'phone_price', 'appoint_price', 'is_chat', 'is_phone', 'is_appoint', 'latitude', 'longitude', DB::raw($distance_field)])->where('id', $req['docter_id'])->where('status', 1)->first()->toArray();
+        $data = Docter::with(['office', 'qualification', 'evaluate.user'])->select(['id', 'type', 'name', 'phone', 'sex', 'birthday', 'avatar', 'status', 'label', 'sign', 'intro', 'office_id', 'qualification_id', 'score', 'service_persons', 'eva_num', 'service_days', 'phone_minutes', 'chat_price', 'phone_price', 'appoint_price', 'is_chat', 'is_phone', 'is_appoint', 'latitude', 'longitude', DB::raw($distance_field)])->where('id', $req['docter_id'])->where('status', 1)->first()->toArray();
 
-        $data['organization'] = null;
-        if (!empty($req['list_type']) && $req['list_type'] == 3) {
-            $schedulePeriod = SchedulePeriod::with('organization')->select(['organization_id'])->where('docter_id', $req['docter_id'])->where('schedule_date', date('Y-m-d'))->first()->toArray();
-            $data['organization'] = $schedulePeriod['organization'];
-        }
+        $schedulePeriod = SchedulePeriod::with('organization')->select(['organization_id'])->where('docter_id', $req['docter_id'])->get()->toArray();
+        $data['organization'] = array_column($schedulePeriod, 'organization');
 
         return ($data);
     }