zilong 4 éve
szülő
commit
0953faf351
1 módosított fájl, 5 hozzáadás és 4 törlés
  1. 5 4
      app/Http/Controllers/Api/V1/DocterController.php

+ 5 - 4
app/Http/Controllers/Api/V1/DocterController.php

xqd xqd
@@ -37,13 +37,14 @@ class DocterController extends AuthController
         $distance_field = get_distance_field($latitude, $longitude);
 
         $builder = Docter::with('office', 'qualification')->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('status', 1);
-        if ($req['list_type'] == 1) {
+        $list_type = !empty($req['list_type']) ? $req['list_type'] : 0;
+        if ($list_type == 1) {
             $builder->where('is_phone', 1);
         }
-        if ($req['list_type'] == 2) {
+        if ($list_type == 2) {
             $builder->where('is_chat', 1);
         }
-        if ($req['list_type'] == 3) {
+        if ($list_type == 3) {
             $builder->where('is_appoint', 1);
         }
         if (!empty($req['name'])) {
@@ -60,7 +61,7 @@ class DocterController extends AuthController
             });
         }
 
-        if ($req['list_type'] == 3) {
+        if ($list_type == 3) {
             $docterIds2 = SchedulePeriod::where('time_period_id', $req['time_period_id'])->where('schedule_date', $req['schedule_date'])->pluck('docter_id')->toArray();
             $builder->whereIn('id', $docterIds2);
         }