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

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
+82 -12
View File
@@ -144,6 +144,53 @@ class MessagePush extends BaseService
}
}
/**
* 患者-分配医生失败
* 订阅
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function assignDoctorFail(): void
{
try {
// 订阅
// 获取医生数据
$params = array();
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
$user_doctor = UserDoctor::getOne($params);
if (empty($user_doctor)){
Log::getInstance("MessagePush")->error("错误:医生数据为空");
return;
}
$sub_data = array();
$sub_data['push_user_id'] = $this->user['user_id'];
$sub_data['wx_template_id'] = "UOMww1S30Oq7rErJrqO8wN6lNEVKRo2fgcXnb0tBwHI";//问诊异常通知
$sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}";
$sub_data['params']['data'] = [
"character_string1" => (string)$this->order_inquiry['inquiry_no'],// 订单ID
"name2" => (string)$user_doctor['user_name'],// 问诊医生
"date3" => $this->order_inquiry['created_at'],// 问诊时间
"thing4" => inquiryCancelReasonToPushString($this->order_inquiry['cancel_reason']),// 取消原因
"thing5" => "已进行退款处理,请注意查看账户信息",// 提示说明
];
$data = array();
$data['sub_data'] = $sub_data;
$data['sms_data'] = array();
$message = new SendSubMessageProducer($data);
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
Log::getInstance("MessagePush")->error("错误:" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
Log::getInstance("MessagePush")->error("错误:" . $e->getMessage());
}
}
/**
* 医生-通知患者回复
* 订阅
@@ -558,7 +605,7 @@ class MessagePush extends BaseService
}
/**
* 优惠劵退还
* 患者-优惠劵退还
* 站内
* @param string $coupon_name
* @return void
@@ -590,7 +637,7 @@ class MessagePush extends BaseService
}
/**
* 优惠劵过期
* 患者-优惠劵过期
* 站内
* @return void
* @throws ContainerExceptionInterface
@@ -841,32 +888,55 @@ class MessagePush extends BaseService
}
/**
* 物流信息-暂时无法开发,无物流信息
* 患者-物流信息
* 已揽收、已发货、自动收货
* 站内
* @param string $status 已揽收、已发货、已签收
* @param string $order_product_id
* @return bool
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function logistics(string $order_product_id): bool
public function logistics(string $status,string $order_product_id): void
{
try {
// 站内
// 服务消息
$data = array();
$data['user_id'] = $this->user['user_id'];
$data['notice_type'] = 3;
$data['notice_system_type'] = 4;// 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息)
$data['from_name'] = "肝胆小秘书";
$data['notice_brief_title'] = "您购买的药品【{$status}】,点击查看物流详情。";
$data['notice_title'] = "您购买的药品【{$status}】,点击查看物流详情。";
$data['notice_content'] = "您购买的药品【{$status}】,点击查看物流详情。";
$data['link_type'] = 9;// 物流详情
$link_params = array();
$link_params['order_product_id'] = $order_product_id;
$data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数
$message = new SendStationMessageProducer($data);
$producer = ApplicationContext::getContainer()->get(Producer::class);
$result = $producer->produce($message);
if (!$result) {
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
}
} catch (\Exception $e) {
throw new BusinessException("加入推送队列失败" . $e->getMessage());
Log::getInstance("MessagePush")->error("错误:加入推送队列失败" . $e->getMessage());
}
return true;
}
/**
* 药品已发货
* 患者-药品已发货
* 订阅失败发送短信
* @param string $order_product_id
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function ProductDelivery(string $order_product_id): void
public function productDelivery(string $order_product_id): void
{
try {
// 获取药品订单数据
@@ -924,9 +994,9 @@ class MessagePush extends BaseService
"thing3" => $order_product['province'] . $order_product['city'] . $order_product['county'],// 收货地址
"thing6" => $order_product['consignee_name'],// 收货人
"thing6" => (string)$order_product['consignee_name'],// 收货人
"thing5" => "您的药品已发货,点击可以查看订单详情",// 备注
"thing5" => "您的药品已发货,点击可以查看订单详情",// 备注
];
// 短信