瀏覽代碼

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

jiangzixin 1 年之前
父節點
當前提交
c2fa4d05cc
共有 1 個文件被更改,包括 21 次插入0 次删除
  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();
+    }
+
 }