| xqd
@@ -11,6 +11,7 @@ namespace App\Http\Controllers\Api\V1;
|
|
|
use App\Models\Collection;
|
|
|
use App\Models\Docter;
|
|
|
use App\Models\DocterServiceTime;
|
|
|
+use App\Models\DocterSetting;
|
|
|
use App\Models\Organization;
|
|
|
use App\Models\Schedule;
|
|
|
use App\Models\SchedulePeriod;
|
| xqd
@@ -199,9 +200,14 @@ class DocterController extends AuthController
|
|
|
if (!empty($v1['organization'])) {
|
|
|
$v1['organization']['distance'] = get_user_distance($user, $v1['organization']['latitude'], $v1['organization']['longitude']);
|
|
|
}
|
|
|
-
|
|
|
- $can_appoint_num = $v['per_time_num'] - $v1['order_num'];
|
|
|
- $v1['can_appoint_num'] = $can_appoint_num < 0 ? 0 : $can_appoint_num;
|
|
|
+ $docterSettings = DocterSetting::select(['service_num'])->where('docter_id', $req['docter_id'])->where('type', 1)->where('org_id', $v1['organization_id'])->first();
|
|
|
+ if (empty($docterSettings)) {
|
|
|
+ $v1['can_appoint_num'] = 0;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $can_appoint_num = $docterSettings['service_num'] - $v1['order_num'];
|
|
|
+ $v1['can_appoint_num'] = $can_appoint_num < 0 ? 0 : $can_appoint_num;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|