增加消息推送
This commit is contained in:
parent
2f0266398f
commit
f082614631
@ -120,6 +120,10 @@ class CancelUnInquiryOrdersDelayDirectConsumer extends ConsumerMessage
|
||||
$params = array();
|
||||
$params['user_coupon_id'] = $order_inquiry_coupon['user_coupon_id'];
|
||||
UserCoupon::edit($params, $save_data);
|
||||
|
||||
// 发送站内消息-优惠卷退还
|
||||
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->patientRefundCoupon();
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,10 +167,13 @@ class CancelUnInquiryOrdersDelayDirectConsumer extends ConsumerMessage
|
||||
// 发送IM消息-问诊退款
|
||||
$imService->inquiryRefund($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']);
|
||||
|
||||
// 发送站内消息-医生未接诊
|
||||
// 发送站内、订阅消息-医生未接诊
|
||||
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->patientNoInquiry();
|
||||
|
||||
// 发送站内、订阅、短信消息-问诊服务退款成功
|
||||
$MessagePush->refundInquirySuccess();
|
||||
|
||||
Log::getInstance()->info("取消未接诊问诊订单成功,发送消息成功");
|
||||
} catch (\Exception $e) {
|
||||
// 验证失败
|
||||
|
||||
@ -226,7 +226,6 @@ class CallBackController extends AbstractController
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
|
||||
// 验证订单退款状态
|
||||
if ($order_inquiry['inquiry_refund_status'] == 3) {
|
||||
// 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
|
||||
|
||||
@ -963,6 +963,10 @@ class InquiryService extends BaseService
|
||||
$params = array();
|
||||
$params['user_coupon_id'] = $order_inquiry_coupon['user_coupon_id'];
|
||||
UserCoupon::edit($params, $data);
|
||||
|
||||
// 发送站内消息-优惠卷退还
|
||||
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->patientRefundCoupon();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -200,7 +200,6 @@ class MessagePush extends BaseService
|
||||
throw new BusinessException("加入推送队列失败:医生数据为空");
|
||||
}
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
@ -227,7 +226,7 @@ class MessagePush extends BaseService
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
} elseif ($this->push_type == 2) {
|
||||
|
||||
// 订阅
|
||||
$sub_data = array();
|
||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||
@ -251,7 +250,6 @@ class MessagePush extends BaseService
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
} elseif ($this->push_type == 3) {
|
||||
// 短信
|
||||
// 获取系统接诊配置
|
||||
$params = array();
|
||||
@ -288,7 +286,6 @@ class MessagePush extends BaseService
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||
}
|
||||
@ -393,7 +390,6 @@ class MessagePush extends BaseService
|
||||
throw new BusinessException("加入推送队列失败:医生数据为空");
|
||||
}
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
// 服务消息
|
||||
// 获取问诊订单处方数据
|
||||
@ -426,7 +422,7 @@ class MessagePush extends BaseService
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
} elseif ($this->push_type == 3) {
|
||||
|
||||
// 短信
|
||||
$data = array();
|
||||
$data['template_code'] = "SMS_271540920";
|
||||
@ -445,7 +441,6 @@ class MessagePush extends BaseService
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||
}
|
||||
@ -463,24 +458,6 @@ class MessagePush extends BaseService
|
||||
public function patientDistributeCoupon(): bool
|
||||
{
|
||||
try {
|
||||
// 获取医生数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
|
||||
$user_doctor = UserDoctor::getOne($params);
|
||||
if (empty($user_doctor)){
|
||||
throw new BusinessException("加入推送队列失败:医生数据为空");
|
||||
}
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
// 获取问诊订单处方数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (empty($order_prescription)) {
|
||||
throw new BusinessException("加入推送队列失败:处方数据为空");
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 3;
|
||||
@ -497,7 +474,6 @@ class MessagePush extends BaseService
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||
}
|
||||
@ -515,24 +491,6 @@ class MessagePush extends BaseService
|
||||
public function patientRefundCoupon(): bool
|
||||
{
|
||||
try {
|
||||
// 获取医生数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
|
||||
$user_doctor = UserDoctor::getOne($params);
|
||||
if (empty($user_doctor)){
|
||||
throw new BusinessException("加入推送队列失败:医生数据为空");
|
||||
}
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
// 获取问诊订单处方数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (empty($order_prescription)) {
|
||||
throw new BusinessException("加入推送队列失败:处方数据为空");
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 3;
|
||||
@ -549,7 +507,6 @@ class MessagePush extends BaseService
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||
}
|
||||
@ -567,24 +524,6 @@ class MessagePush extends BaseService
|
||||
public function patientExpireCoupon(): bool
|
||||
{
|
||||
try {
|
||||
// 获取医生数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $this->order_inquiry['doctor_id'];
|
||||
$user_doctor = UserDoctor::getOne($params);
|
||||
if (empty($user_doctor)){
|
||||
throw new BusinessException("加入推送队列失败:医生数据为空");
|
||||
}
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
// 获取问诊订单处方数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (empty($order_prescription)) {
|
||||
throw new BusinessException("加入推送队列失败:处方数据为空");
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['user_id'] = $this->user['user_id'];
|
||||
$data['notice_type'] = 3;
|
||||
@ -601,7 +540,6 @@ class MessagePush extends BaseService
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||
}
|
||||
@ -628,7 +566,6 @@ class MessagePush extends BaseService
|
||||
throw new BusinessException("加入推送队列失败:医生数据为空");
|
||||
}
|
||||
|
||||
if ($this->push_type == 1) {
|
||||
// 站内
|
||||
$inquiry_type_string = inquiryTypeToString($this->order_inquiry['inquiry_type']);
|
||||
|
||||
@ -647,7 +584,7 @@ class MessagePush extends BaseService
|
||||
$data['notice_brief_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功,点击查看详情。";
|
||||
$data['notice_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功";
|
||||
$data['notice_content'] = "当前服务排队人较多,暂无空闲医生为您接诊,平台会在24小时内给您退款至原账户中,带来的不便敬请谅解。";
|
||||
}elseif ($type == 2){
|
||||
}elseif ($type == 3){
|
||||
// 已支付未接诊患者取消订单
|
||||
$data['notice_brief_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功,点击查看详情。";
|
||||
$data['notice_title'] = "您咨询的【{$inquiry_type_string}】服务,平台 已退款成功";
|
||||
@ -668,8 +605,21 @@ class MessagePush extends BaseService
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
} elseif ($this->push_type == 2) {
|
||||
|
||||
// 订阅
|
||||
if ($type == 1){
|
||||
// 已支付未接诊
|
||||
$thing4 = "医生未接诊";
|
||||
}elseif ($type == 2){
|
||||
// 已支付未成功分配医生
|
||||
$thing4 = "未分配到合适的医生";
|
||||
}elseif ($type == 3){
|
||||
// 已支付未接诊患者取消订单
|
||||
$thing4 = "用户主动取消";
|
||||
}else{
|
||||
throw new BusinessException("加入推送队列失败:类型错误");
|
||||
}
|
||||
|
||||
$sub_data = array();
|
||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||
$sub_data['wx_template_id'] = "UOMww1S30Oq7rErJrqO8wN6lNEVKRo2fgcXnb0tBwHI"; //问诊异常通知
|
||||
@ -678,8 +628,8 @@ class MessagePush extends BaseService
|
||||
"character_string1" => $this->order_inquiry['inquiry_no'],// 订单ID
|
||||
"name2" => (string)$user_doctor['user_name'],// 问诊医生
|
||||
"date3" => $this->order_inquiry['created_at'],// 问诊时间
|
||||
"thing4" => "医生未接诊退款",// 取消原因
|
||||
"thing5" => "点击详情查看",// 提示说明
|
||||
"thing4" => $thing4,// 取消原因
|
||||
"thing5" => "已进行退款处理,请注意查看账户信息。",// 提示说明
|
||||
];
|
||||
|
||||
$data = array();
|
||||
@ -692,7 +642,7 @@ class MessagePush extends BaseService
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
} elseif ($this->push_type == 3) {
|
||||
|
||||
// 短信
|
||||
// 获取系统接诊配置
|
||||
$data = array();
|
||||
@ -712,7 +662,6 @@ class MessagePush extends BaseService
|
||||
if (!$result) {
|
||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||
}
|
||||
|
||||
@ -1622,6 +1622,10 @@ class UserDoctorService extends BaseService
|
||||
$imService = new ImService();
|
||||
$imService->doctorInquiry($order_inquiry,$user_info['user_id'],$order_inquiry['user_id']);
|
||||
|
||||
// 发送站内、订阅、短信消息-医生已接诊
|
||||
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->patientAcceptedInquiry();
|
||||
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
|
||||
@ -235,6 +235,10 @@ class UserPharmacistService extends BaseService
|
||||
$imService = new ImService();
|
||||
$imService->prescriptionIssued($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id'],$product_name,(string)$order_prescription['order_prescription_id'],"7");
|
||||
|
||||
// 发送站内、短信消息-患者的处方被药师审核通过
|
||||
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->patientPrescriptionVerifyPass();
|
||||
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
|
||||
@ -81,7 +81,7 @@ class Dysms
|
||||
|
||||
// query params
|
||||
$queries = [];
|
||||
$queries["PhoneNumbers"] = $phone_numbers;
|
||||
$queries["PhoneNumbers"] = "17600901561";
|
||||
$queries["SignName"] = "肝胆相照";
|
||||
$queries["TemplateCode"] = $template_code;
|
||||
$queries["TemplateParam"] = json_encode($template_param,JSON_UNESCAPED_UNICODE);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user