| xqd
@@ -10,6 +10,7 @@ namespace App\Http\Controllers\Api\V1;
|
|
|
|
|
|
use App\Models\Collection;
|
|
|
use App\Models\Docter;
|
|
|
+use App\Models\DocterServiceTime;
|
|
|
use App\Models\Organization;
|
|
|
use App\Models\Schedule;
|
|
|
use App\Models\SchedulePeriod;
|
| xqd
@@ -37,10 +38,14 @@ class DocterController extends AuthController
|
|
|
|
|
|
$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)->where('is_then', 1)->where('phone', '<>', '');
|
|
|
$list_type = !empty($req['list_type']) ? $req['list_type'] : 0;
|
|
|
+ $now_line = (int)date('Hi');
|
|
|
if ($list_type == 1) {
|
|
|
- $builder->where('is_phone', 1);
|
|
|
+ $ids = DocterServiceTime::where('type', 1)->where('start_time_line', '<=', $now_line)->where('end_time_line', '>', $now_line)->pluck('docter_id')->toArray();
|
|
|
+ $builder->where('is_phone', 1)->whereIn('id', $ids);
|
|
|
}
|
|
|
if ($list_type == 2) {
|
|
|
+ $ids = DocterServiceTime::where('type', 2)->where('start_time_line', '<=', $now_line)->where('end_time_line', '>', $now_line)->pluck('docter_id')->toArray();
|
|
|
+ $builder->where('is_phone', 1)->whereIn('id', $ids);
|
|
|
$builder->where('is_chat', 1);
|
|
|
}
|
|
|
if ($list_type == 3) {
|
| xqd
@@ -177,15 +182,20 @@ class DocterController extends AuthController
|
|
|
|
|
|
public function timePeriodList()
|
|
|
{
|
|
|
+ $req = request()->post();
|
|
|
+ $this->validate(request(), [
|
|
|
+ 'organization_id' => 'required|integer',
|
|
|
+ ]);
|
|
|
+
|
|
|
$data = [];
|
|
|
- $data['list'] = TimePeriod::select(['id', 'start_time_period', 'end_time_period'])->get();
|
|
|
+ $data['list'] = TimePeriod::select(['id', 'start_time_period', 'end_time_period'])->where('org_id', $req['organization_id'])->get()->toArray();
|
|
|
|
|
|
for ($i = 0; $i < 7; $i++) {
|
|
|
if ($i > 0) {
|
|
|
- $data['dates'][] = date('m-d', strtotime("+$i days"));
|
|
|
+ $data['dates'][] = date('Y-m-d', strtotime("+$i days"));
|
|
|
}
|
|
|
else {
|
|
|
- $data['dates'][] = date('m-d');
|
|
|
+ $data['dates'][] = date('Y-m-d');
|
|
|
}
|
|
|
}
|
|
|
|