linwu 8 månader sedan
förälder
incheckning
9500dd12d5
2 ändrade filer med 14 tillägg och 13 borttagningar
  1. 12 11
      app/admin/controller/Appointment.php
  2. 2 2
      app/admin/controller/Specialist.php

+ 12 - 11
app/admin/controller/Appointment.php

@@ -19,7 +19,7 @@ class Appointment extends Permissions
     {
         $pid = $this->request->param('pid', 0, 'intval');
 
-        $post = $this->request->post();
+        $post                = $this->request->post();
         $post['provider_id'] = $pid;
 
         if ($this->request->isPost()) {
@@ -33,19 +33,19 @@ class Appointment extends Permissions
             }
         }
 
-        $model = $this->getModel();
+        $model       = $this->getModel();
         $appointment = $model->where('provider_id', $pid)->find();
 
         if ($appointment) {
             //修改
             if ($this->request->isPost()) {
 
-                $weeks = $post['weeks']??[];
-                $weeks = array_keys($weeks);
+                $weeks         = $post['weeks'] ?? [];
+                $weeks         = array_keys($weeks);
                 $post['weeks'] = implode(',', $weeks);
 
-                $post['morning_time_periods'] = json_encode($post['morning_time_periods']??[]);
-                $post['afternoon_time_periods'] = json_encode($post['afternoon_time_periods']??[]);
+                $post['morning_time_periods']   = json_encode($post['morning_time_periods'] ?? []);
+                $post['afternoon_time_periods'] = json_encode($post['afternoon_time_periods'] ?? []);
 
                 if (false == $appointment->allowField(true)->save($post)) {
                     $this->error('修改失败');
@@ -63,12 +63,12 @@ class Appointment extends Permissions
             //新增
             if ($this->request->isPost()) {
 
-                $weeks = $post['weeks']??[];
-                $weeks = array_keys($weeks);
+                $weeks         = $post['weeks'] ?? [];
+                $weeks         = array_keys($weeks);
                 $post['weeks'] = implode(',', $weeks);
 
-                $post['morning_time_periods'] = json_encode($post['morning_time_periods']??[]);
-                $post['afternoon_time_periods'] = json_encode($post['afternoon_time_periods']??[]);
+                $post['morning_time_periods']   = json_encode($post['morning_time_periods'] ?? []);
+                $post['afternoon_time_periods'] = json_encode($post['afternoon_time_periods'] ?? []);
 
                 if (false == $model->allowField(true)->save($post)) {
                     $this->error('添加失败');
@@ -100,8 +100,9 @@ class Appointment extends Permissions
             $where['provider_id'] = ['in', $id];
         }
 
+        $where['appointment_daytime'] = ['>', time()];
         //删除该专家所有号源和记录
-//        (new \app\common\model\AppointmentTicket())->where($where)->delete();
+        (new \app\common\model\AppointmentTicket())->where($where)->delete();
 //        (new \app\common\model\AppointmentApplication())->where($where)->delete();
     }
 

+ 2 - 2
app/admin/controller/Specialist.php

@@ -117,12 +117,12 @@ class Specialist extends Permissions
                     $this->error('添加失败');
                 } else {
                     //新增放号设置记录
-                    $webconfig = \app\common\model\Webconfig::get(1);
+                    /*$webconfig = \app\common\model\Webconfig::get(1);
                     $data['provider_id'] = $model->id;
                     $data['weeks'] = $webconfig->weeks;
                     $data['morning_time_periods'] = $webconfig->morning_time_periods;
                     $data['afternoon_time_periods'] = $webconfig->afternoon_time_periods;
-                    (new \app\common\model\Appointment())->allowField(true)->save($data);
+                    (new \app\common\model\Appointment())->allowField(true)->save($data);*/
 
                     $this->success('添加成功', 'index');
                 }