|
|
|
|
@ -915,9 +915,20 @@ class OrderController extends Controller
|
|
|
|
|
];
|
|
|
|
|
$info = $peis::Post('预约时段修改', $order_info->hospital_id, $dat);
|
|
|
|
|
}
|
|
|
|
|
$wx_day1_sendmsg_status=1;
|
|
|
|
|
$wx_day1_sendmsg_time="";
|
|
|
|
|
//判断预约的日期是否大于今天,如果是设置微信推送为0,和 预计推送时间
|
|
|
|
|
if($order_info->appointment_date > date('Y-m-d')){
|
|
|
|
|
$wx_day1_sendmsg_status=0;
|
|
|
|
|
$specifiedDateTime = new DateTime($order_info->appointment_date . ' ' . $order_info->appointment_time);
|
|
|
|
|
$previousDay = $specifiedDateTime->modify('-1 day');
|
|
|
|
|
$wx_day1_sendmsg_time=$previousDay->format('Y-m-d H:i:s');
|
|
|
|
|
}
|
|
|
|
|
$u = DB::table('orders')->where(['order_number' => $order_number])->update([
|
|
|
|
|
'appointment_number' => $create_appointment['data'][0][0],
|
|
|
|
|
'appointment_back_info' => json_encode($appointment_info['data'][0], JSON_UNESCAPED_UNICODE)
|
|
|
|
|
'appointment_back_info' => json_encode($appointment_info['data'][0], JSON_UNESCAPED_UNICODE),
|
|
|
|
|
'wx_day1_sendmsg_status'=>$wx_day1_sendmsg_status,
|
|
|
|
|
'wx_day1_sendmsg_time'=>$wx_day1_sendmsg_time,
|
|
|
|
|
]);
|
|
|
|
|
$is_sendMsg = DB::table('configs')->where(['label' => '预约完成短信通知'])->first();
|
|
|
|
|
if (!!$is_sendMsg and $is_sendMsg->value == 1 and strlen($cha->phone)>0) {
|
|
|
|
|
@ -1092,4 +1103,58 @@ class OrderController extends Controller
|
|
|
|
|
return \Yz::echoError1("未支付" . $res['data']['trade_state']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//提前1天微信通知
|
|
|
|
|
public function Day1WXSend(){
|
|
|
|
|
$id = request('id');
|
|
|
|
|
$order_info = DB::table('orders')->where(['id' => $id,'status'=>2,'wx_day1_sendmsg_status'=>0])->whereNotNull(['appointment_number'])->first();
|
|
|
|
|
if(!$order_info) return \Yz::echoError1("未找到有效订单");
|
|
|
|
|
$person= DB::table('web_user_person')->where(['id'=>$order_info->person_id])->first();
|
|
|
|
|
$appointment_datetime=$order_info->appointment_date.' '.$order_info->appointment_time; //预约的日期
|
|
|
|
|
if(!$this->isTodayTheDayBefore($appointment_datetime)) return \Yz::echoError1("已过推送时效,禁止推送");
|
|
|
|
|
$yyid=6;
|
|
|
|
|
if($order_info->hospital_id == 1){
|
|
|
|
|
$yyid=6;
|
|
|
|
|
}
|
|
|
|
|
if($order_info->hospital_id == 4){
|
|
|
|
|
$yyid=2;
|
|
|
|
|
}
|
|
|
|
|
$keshi="健康管理中心1区";
|
|
|
|
|
if($person->sex==1) $keshi="健康管理中心1区";
|
|
|
|
|
if($person->sex==2) $keshi="健康管理中心2区";
|
|
|
|
|
DB::table('orders')->where(['id' => $id])->update([
|
|
|
|
|
'wx_day1_sendmsg_status' => 1,
|
|
|
|
|
'wx_day1_sendmsg_time'=>date('Y-m-d H:i:s')
|
|
|
|
|
]);
|
|
|
|
|
//微信推送
|
|
|
|
|
$data = [
|
|
|
|
|
"ghzid" => $person->ghzid,
|
|
|
|
|
"yyid" => $yyid,
|
|
|
|
|
"type" => "7",
|
|
|
|
|
"msg1" => $person->name,
|
|
|
|
|
"msg2" => $appointment_datetime,
|
|
|
|
|
"msg3" => $keshi,
|
|
|
|
|
"msg4" => $order_info->doctor,
|
|
|
|
|
"msg5" => "请提前10分钟到(".$keshi.")签到",
|
|
|
|
|
"msg6" => "",
|
|
|
|
|
"url" => ""
|
|
|
|
|
];
|
|
|
|
|
$dnet = new AspNetZhuanController();
|
|
|
|
|
$res = $dnet->WeiXinSend($data);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//判断今天是否是给定日期的前一天
|
|
|
|
|
function isTodayTheDayBefore($targetDate) {
|
|
|
|
|
// 创建今天日期的 DateTime 对象
|
|
|
|
|
$today = new DateTime('today');
|
|
|
|
|
|
|
|
|
|
// 创建目标日期的 DateTime 对象
|
|
|
|
|
$target = new DateTime($targetDate);
|
|
|
|
|
|
|
|
|
|
// 修改目标日期为前一天
|
|
|
|
|
$target->modify('-1 day');
|
|
|
|
|
|
|
|
|
|
// 比较两个日期
|
|
|
|
|
return $today == $target;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|