新增物流状态推送,物流消息推送

This commit is contained in:
2023-04-26 17:22:12 +08:00
parent 2523d50e6c
commit 18a57fc781
4 changed files with 229 additions and 79 deletions
@@ -134,13 +134,31 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
$result['deliveryTime'] = date('Y-m-d H:i:s',time());
}
// 订阅快递推送
$Kuaidi = new Kuaidi();
$Kuaidi->subscribe($result['deliveryId'],$logistics_company_code,$item['consignee_tel']);
// 检测物流编号是否已经存在并订阅
if (empty($order_prescription['logistics_no']) || $order_prescription['logistics_no'] != $result['deliveryId']){
// 订阅快递推送
$Kuaidi = new Kuaidi();
$Kuaidi->subscribe($result['deliveryId'],$logistics_company_code,$item['consignee_tel']);
}
// 修改成功时药品订单数据
$this->savePreSuccessOrderStatus($item,$result['deliveryId'],$logistics_company_code,$result['deliveryTime']);
try {
// 获取患者数据
$params = array();
$params['patient_id'] = $order_prescription['patient_id'];
$user_patient = UserPatient::getOne($params);
if (empty($user_patient)){
$this->line("推送消息错误:用户数据错误");
}
// 患者-药品已发货-订阅失败发送短信
$MessagePush = new MessagePush($user_patient['user_id']);
$MessagePush->productDelivery($item['order_product_id']);
}catch (\Exception $e){
$this->line("推送消息错误:" . $e->getMessage());
}
}
$this->line("获取处方平台订单数据结束:处理完毕");