Ver código fonte

fix: 放号设置修改删除号ç æº源ç

jiangzixin 1 ano atrás
pai
commit
c2fa4d05cc
1 arquivos alterados com 21 adições e 0 exclusões
  1. 21 0
      app/admin/controller/Appointment.php

+ 21 - 0
app/admin/controller/Appointment.php

@@ -50,6 +50,7 @@ class Appointment extends Permissions
                 if (false == $appointment->allowField(true)->save($post)) {
                     $this->error('修改失败');
                 }
+                $this->publishAfter($pid);
                 $this->success('修改成功', 'index', ['pid' => $pid]);
             } else {
                 $this->assign('data', $appointment);
@@ -84,4 +85,24 @@ class Appointment extends Permissions
         }
     }
 
+
+    /**
+     * 放号设置修改,删除号源
+     * @param $id
+     * @author jiang
+     */
+    private function publishAfter($id)
+    {
+        $where = [];
+        if (!is_array($id)) {
+            $where['provider_id'] = $id;
+        } else {
+            $where['provider_id'] = ['in', $id];
+        }
+
+        //删除该专家所有号源和记录
+        (new \app\common\model\AppointmentTicket())->where($where)->delete();
+        (new \app\common\model\AppointmentApplication())->where($where)->delete();
+    }
+
 }