|
@@ -65,6 +65,37 @@ class Wenzhen extends Api
|
|
$this->error('价格为零');
|
|
$this->error('价格为零');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //排班判断
|
|
|
|
+ if($ordertype == 1){
|
|
|
|
+ $book_time = 0;
|
|
|
|
+ }
|
|
|
|
+ if($ordertype == 2){
|
|
|
|
+ //检查
|
|
|
|
+ if($book_time < time() + 7200){
|
|
|
|
+ $this->error('最早只能预约'.date('m-d H:00',time() + 10800)); //最早预约两个小时后的一个整点
|
|
|
|
+ }
|
|
|
|
+ //排班状态
|
|
|
|
+ $doctor_paiban = Db::name('doctor_paiban')->where('doctor_id',$doctor_id)->where('activetime',$book_time)->find();
|
|
|
|
+ if(empty($doctor_paiban)){
|
|
|
|
+ $this->error('您预约的时间该医生无法接诊');
|
|
|
|
+ }
|
|
|
|
+ if($doctor_paiban['active'] != 1){
|
|
|
|
+ $this->error('您预约的时间该医生无法接诊');
|
|
|
|
+ }
|
|
|
|
+ //是否排满
|
|
|
|
+ $map = [
|
|
|
|
+ 'doctor_id' => $doctor_id,
|
|
|
|
+ 'book_time' => $book_time,
|
|
|
|
+ 'ordertype' => 2,
|
|
|
|
+ 'status' => ['IN','10,20,25,30'],
|
|
|
|
+ ];
|
|
|
|
+ $order_count = Db::name('wenzhen_order')->where($map)->count();
|
|
|
|
+ if($order_count >= 4){
|
|
|
|
+ $this->error('该时间点已排满');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
//订单数据
|
|
//订单数据
|
|
$order_data = [
|
|
$order_data = [
|
|
'order_no' => $order_no,
|
|
'order_no' => $order_no,
|
|
@@ -73,7 +104,7 @@ class Wenzhen extends Api
|
|
'doctor_id' => $doctor_id,
|
|
'doctor_id' => $doctor_id,
|
|
'ordertype' => $ordertype,
|
|
'ordertype' => $ordertype,
|
|
'total_fee' => $price,
|
|
'total_fee' => $price,
|
|
- 'book_time' => strtotime($book_time),
|
|
|
|
|
|
+ 'book_time' => $book_time,
|
|
'createtime' => time(),
|
|
'createtime' => time(),
|
|
'status' => 0,//订单状态enum
|
|
'status' => 0,//订单状态enum
|
|
];
|
|
];
|
|
@@ -157,7 +188,7 @@ class Wenzhen extends Api
|
|
'name' => '待接单',
|
|
'name' => '待接单',
|
|
'status' => '10',
|
|
'status' => '10',
|
|
'id' => (string)$order_id,
|
|
'id' => (string)$order_id,
|
|
- 'content' => '已通知医生尽快接诊,超时自动取消订单并退款',
|
|
|
|
|
|
+ 'content' => '已通知医生尽快接诊,超时未接诊的将自动取消订单并退款',
|
|
];
|
|
];
|
|
$rs = $tenim->sendCustomMessageToUser('user'.$this->auth->id,'doctor'.$wenzhen_order['doctor_id'],$message);
|
|
$rs = $tenim->sendCustomMessageToUser('user'.$this->auth->id,'doctor'.$wenzhen_order['doctor_id'],$message);
|
|
}
|
|
}
|