去除验证码验证
This commit is contained in:
parent
d0d1e7494d
commit
f00894fe9f
@ -111,15 +111,15 @@ class SendSubMessageConsumer extends ConsumerMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理发送环境
|
// 处理发送环境
|
||||||
$miniprogram_state = "developer";
|
// $miniprogram_state = "developer";
|
||||||
// $miniprogram_state = "trial";
|
$miniprogram_state = "trial";
|
||||||
if (env("APP_ENV") == "prod"){
|
if (env("APP_ENV") == "prod"){
|
||||||
$miniprogram_state = "formal";
|
$miniprogram_state = "formal";
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = [
|
$options = [
|
||||||
"template_id" => $sub_template['wx_template_id'],
|
"template_id" => $sub_template['wx_template_id'],
|
||||||
"page" => $sub_template['page'] ?: "",
|
"page" => $sub_template['page'] ?: $data['sub_data']['params']['page'] ?: "",
|
||||||
"touser" => $open_id,
|
"touser" => $open_id,
|
||||||
"data" => $send_data,
|
"data" => $send_data,
|
||||||
"miniprogram_state" => $miniprogram_state,
|
"miniprogram_state" => $miniprogram_state,
|
||||||
|
|||||||
@ -436,11 +436,11 @@ class TestController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function test_10(){
|
public function test_10(){
|
||||||
$MessagePush = new MessagePush(2,"491923510680424449","499172549291458560");
|
// $MessagePush = new MessagePush(2,"491923510680424449","499172549291458560");
|
||||||
$result = $MessagePush->noInquiry();
|
// $result = $MessagePush->noInquiry();
|
||||||
|
|
||||||
// $MessagePush = new MessagePush(2,"491923510680424449","499176434366210048");
|
$MessagePush = new MessagePush(3,"491925054435950592","499176434366210048");
|
||||||
// $result = $MessagePush->patientReplyNotice("你好1");
|
$result = $MessagePush->doctorAcceptedInquiry();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -242,16 +242,16 @@ class LoginService extends BaseService
|
|||||||
$user_type = $this->request->input('user_type');
|
$user_type = $this->request->input('user_type');
|
||||||
$wx_code = $this->request->input('wx_code');
|
$wx_code = $this->request->input('wx_code');
|
||||||
|
|
||||||
$redis = $this->container->get(Redis::class);
|
// $redis = $this->container->get(Redis::class);
|
||||||
// 验证验证码
|
// // 验证验证码
|
||||||
$sms_code = $redis->get("login_code" . $phone);
|
// $sms_code = $redis->get("login_code" . $phone);
|
||||||
if (empty($sms_code)){
|
// if (empty($sms_code)){
|
||||||
return fail(HttpEnumCode::CODE_EXPIRED);
|
// return fail(HttpEnumCode::CODE_EXPIRED);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if ($sms_code != $code){
|
// if ($sms_code != $code){
|
||||||
return fail(HttpEnumCode::CODE_ERROR);
|
// return fail(HttpEnumCode::CODE_ERROR);
|
||||||
}
|
// }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$weChat = new Wechat($user_type);
|
$weChat = new Wechat($user_type);
|
||||||
|
|||||||
@ -2,11 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Amqp\Producer\SendSmsMessageProducer;
|
||||||
use App\Amqp\Producer\SendStationMessageProducer;
|
use App\Amqp\Producer\SendStationMessageProducer;
|
||||||
use App\Amqp\Producer\SendSubMessageProducer;
|
use App\Amqp\Producer\SendSubMessageProducer;
|
||||||
use App\Constants\HttpEnumCode;
|
use App\Constants\HttpEnumCode;
|
||||||
use App\Exception\BusinessException;
|
use App\Exception\BusinessException;
|
||||||
use App\Model\OrderInquiry;
|
use App\Model\OrderInquiry;
|
||||||
|
use App\Model\OrderPrescription;
|
||||||
|
use App\Model\SystemInquiryConfig;
|
||||||
use App\Model\User;
|
use App\Model\User;
|
||||||
use App\Model\UserDoctor;
|
use App\Model\UserDoctor;
|
||||||
use Hyperf\Amqp\Producer;
|
use Hyperf\Amqp\Producer;
|
||||||
@ -30,19 +33,19 @@ class MessagePush extends BaseService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $push_type 推送类型 1:站内 2:订阅 3:短信
|
* @param int $push_type 推送类型 1:站内 2:订阅 3:短信
|
||||||
* @param string $user_id 用户id(存在被推送者时存在,否则为空)
|
* @param string $to_user_id 用户id(存在被推送者时存在,否则为空)
|
||||||
* @param string $order_inquiry_id 问诊订单id
|
* @param string $order_inquiry_id 问诊订单id
|
||||||
*/
|
*/
|
||||||
public function __construct(int $push_type, string $user_id = "", string $order_inquiry_id = "")
|
public function __construct(int $push_type, string $to_user_id = "", string $order_inquiry_id = "")
|
||||||
{
|
{
|
||||||
if (!in_array($push_type, [1, 2, 3])) {
|
if (!in_array($push_type, [1, 2, 3])) {
|
||||||
throw new BusinessException("推送类型错误:" . $push_type);
|
throw new BusinessException("推送类型错误:" . $push_type);
|
||||||
}
|
}
|
||||||
$this->push_type = $push_type;
|
$this->push_type = $push_type;
|
||||||
|
|
||||||
if (!empty($user_id)) {
|
if (!empty($to_user_id)) {
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['user_id'] = $user_id;
|
$params['user_id'] = $to_user_id;
|
||||||
$user = User::getOne($params);
|
$user = User::getOne($params);
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
$this->user = $user->toArray();
|
$this->user = $user->toArray();
|
||||||
@ -96,6 +99,8 @@ class MessagePush extends BaseService
|
|||||||
$link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
$link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||||
$data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数
|
$data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数
|
||||||
|
|
||||||
|
$data['button_type'] = 4; // 订单详情
|
||||||
|
|
||||||
$message = new SendStationMessageProducer($data);
|
$message = new SendStationMessageProducer($data);
|
||||||
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||||
$result = $producer->produce($message);
|
$result = $producer->produce($message);
|
||||||
@ -115,7 +120,7 @@ class MessagePush extends BaseService
|
|||||||
$sub_data = array();
|
$sub_data = array();
|
||||||
$sub_data['push_user_id'] = $this->user['user_id'];
|
$sub_data['push_user_id'] = $this->user['user_id'];
|
||||||
$sub_data['template_title'] = "问诊异常通知";
|
$sub_data['template_title'] = "问诊异常通知";
|
||||||
$sub_data['params']['page'] = "pages/orderDetail/orderDetail";
|
$sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}";
|
||||||
$sub_data['params']['data'] = [
|
$sub_data['params']['data'] = [
|
||||||
"character_string1" => $this->order_inquiry['inquiry_no'],// 订单ID
|
"character_string1" => $this->order_inquiry['inquiry_no'],// 订单ID
|
||||||
"name2" => (string)$user_doctor['user_name'],// 问诊医生
|
"name2" => (string)$user_doctor['user_name'],// 问诊医生
|
||||||
@ -124,7 +129,6 @@ class MessagePush extends BaseService
|
|||||||
"thing5" => "点击详情更换医生问诊",// 提示说明
|
"thing5" => "点击详情更换医生问诊",// 提示说明
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['sub_data'] = $sub_data;
|
$data['sub_data'] = $sub_data;
|
||||||
$data['sms_data'] = array();
|
$data['sms_data'] = array();
|
||||||
@ -136,11 +140,6 @@ class MessagePush extends BaseService
|
|||||||
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif ($this->push_type == 3) {
|
|
||||||
// 短信 无需接入
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||||
@ -186,4 +185,321 @@ class MessagePush extends BaseService
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 医生已接诊
|
||||||
|
* @return bool
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
public function doctorAcceptedInquiry(): 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) {
|
||||||
|
// 站内
|
||||||
|
// 服务消息
|
||||||
|
$data = array();
|
||||||
|
$data['user_id'] = $this->user['user_id'];
|
||||||
|
$data['notice_type'] = 3;
|
||||||
|
$data['notice_system_type'] = 1;
|
||||||
|
$data['from_name'] = "肝胆小秘书";
|
||||||
|
$data['notice_title'] = "{$user_doctor['user_name']}医生已接诊,请尽快和医生进行沟通交流病情,点击查看详情";
|
||||||
|
$data['notice_content'] = "{$user_doctor['user_name']}医生已接诊,请您尽快和医生进行沟通交流病情,您可以点击问诊详情进行交流。";
|
||||||
|
$data['link_type'] = 1;// 聊天详情页
|
||||||
|
|
||||||
|
$link_params = array();
|
||||||
|
$link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||||
|
$link_params['inquiry_type'] = $this->order_inquiry['inquiry_type'];
|
||||||
|
$link_params['doctor_user_id'] = $user_doctor['user_id'];
|
||||||
|
$link_params['patient_user_id'] = $this->order_inquiry['user_id'];
|
||||||
|
$data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数
|
||||||
|
|
||||||
|
$data['button_type'] = 6; // 问诊详情
|
||||||
|
|
||||||
|
$message = new SendStationMessageProducer($data);
|
||||||
|
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||||
|
$result = $producer->produce($message);
|
||||||
|
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'];
|
||||||
|
$sub_data['template_title'] = "问诊提醒";
|
||||||
|
$sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}";
|
||||||
|
$sub_data['params']['data'] = [
|
||||||
|
"thing1" => "问诊内容",// 问诊内容
|
||||||
|
"thing2" => "提醒内容",// 提醒内容
|
||||||
|
"name3" => (string)$user_doctor['user_name'],// 问诊医生
|
||||||
|
"thing4" => "提示说明",// 提示说明
|
||||||
|
];
|
||||||
|
|
||||||
|
$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) {
|
||||||
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
|
}
|
||||||
|
|
||||||
|
} elseif ($this->push_type == 3) {
|
||||||
|
// 短信
|
||||||
|
// 获取系统接诊配置
|
||||||
|
$params = array();
|
||||||
|
$params['inquiry_type'] = $this->order_inquiry['inquiry_type'];
|
||||||
|
$params['inquiry_mode'] = $this->order_inquiry['inquiry_mode'];
|
||||||
|
$system_inquiry_config = SystemInquiryConfig::getOne($params);
|
||||||
|
if (empty($system_inquiry_config)) {
|
||||||
|
throw new BusinessException("加入推送队列失败:获取系统接诊配置失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
$duration = $system_inquiry_config['duration'];
|
||||||
|
if ($duration <= 0){
|
||||||
|
$duration = "不限制";
|
||||||
|
}else{
|
||||||
|
$duration = $duration . "分钟";
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['template_code'] = "SMS_271955088";
|
||||||
|
$data['scene_desc'] = "医生已接诊";
|
||||||
|
$data['phone'] = $this->user['mobile'];
|
||||||
|
$data['user_id'] = $this->user['user_id'];
|
||||||
|
|
||||||
|
$template_param = array();
|
||||||
|
$template_param['type'] = inquiryTypeToString($this->order_inquiry['inquiry_type']);
|
||||||
|
$template_param['name'] = $user_doctor['user_name'];
|
||||||
|
$template_param['duration'] = $duration; // 服务时长
|
||||||
|
$data['template_param'] = $template_param;
|
||||||
|
|
||||||
|
|
||||||
|
$message = new SendSmsMessageProducer($data);
|
||||||
|
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||||
|
$result = $producer->produce($message);
|
||||||
|
if (!$result) {
|
||||||
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务结束
|
||||||
|
* @return bool
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
public function inquiryFinish(): 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) {
|
||||||
|
// 站内
|
||||||
|
// 服务消息
|
||||||
|
$inquiry_type_string = inquiryTypeToString($this->order_inquiry['inquiry_type']);
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['user_id'] = $this->user['user_id'];
|
||||||
|
$data['notice_type'] = 3;
|
||||||
|
$data['notice_system_type'] = 1;
|
||||||
|
$data['from_name'] = "肝胆小秘书";
|
||||||
|
$data['notice_title'] = "您咨询的【{$inquiry_type_string}】服务已结束,点击查看详情。";
|
||||||
|
$data['notice_content'] = "您咨询{$user_doctor['user_name']}医生的服务已结束,请对本次问诊服务做出评价。您的评价对医生和其他患者也有很重要的参考价值。您也可以点击医生头像,进入医生主页关注医生。";
|
||||||
|
$data['link_type'] = 10;// 聊天详情页
|
||||||
|
|
||||||
|
$link_params = array();
|
||||||
|
$link_params['order_inquiry_id'] = $this->order_inquiry['order_inquiry_id'];
|
||||||
|
$link_params['inquiry_type'] = $this->order_inquiry['inquiry_type'];
|
||||||
|
$link_params['doctor_user_id'] = $user_doctor['user_id'];
|
||||||
|
$link_params['patient_user_id'] = $this->order_inquiry['user_id'];
|
||||||
|
$data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数
|
||||||
|
|
||||||
|
$data['button_type'] = 4; // 订单详情
|
||||||
|
|
||||||
|
$message = new SendStationMessageProducer($data);
|
||||||
|
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||||
|
$result = $producer->produce($message);
|
||||||
|
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'];
|
||||||
|
$sub_data['template_title'] = "问诊提醒";
|
||||||
|
$sub_data['params']['page'] = "pages/orderDetail/orderDetail?order_inquiry_id={$this->order_inquiry['order_inquiry_id']}";
|
||||||
|
$sub_data['params']['data'] = [
|
||||||
|
"thing1" => "问诊内容",// 问诊内容
|
||||||
|
"thing2" => "提醒内容",// 提醒内容
|
||||||
|
"name3" => (string)$user_doctor['user_name'],// 问诊医生
|
||||||
|
"thing4" => "提示说明",// 提示说明
|
||||||
|
];
|
||||||
|
|
||||||
|
$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) {
|
||||||
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处方审核通过
|
||||||
|
* @return bool
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
public function prescriptionVerifyPass(): 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;
|
||||||
|
$data['notice_system_type'] = 1;
|
||||||
|
$data['from_name'] = "肝胆小秘书";
|
||||||
|
$data['notice_title'] = "{$user_doctor['user_name']}医生为您开具的电子处方已审核通过,点击查看详情。";
|
||||||
|
$data['notice_content'] = "{$user_doctor['user_name']}医生为您开具的电子处方已审核通过,您可以点击查看处方进行购买药品。";
|
||||||
|
$data['link_type'] = 13;
|
||||||
|
|
||||||
|
$link_params = array();
|
||||||
|
$link_params['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||||
|
$data['link_params'] = json_encode($link_params,JSON_UNESCAPED_UNICODE);// 跳转参数
|
||||||
|
|
||||||
|
$data['button_type'] = 5; // 查看处方
|
||||||
|
|
||||||
|
$message = new SendStationMessageProducer($data);
|
||||||
|
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||||
|
$result = $producer->produce($message);
|
||||||
|
if (!$result) {
|
||||||
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
|
}
|
||||||
|
} elseif ($this->push_type == 3) {
|
||||||
|
// 短信
|
||||||
|
$data = array();
|
||||||
|
$data['template_code'] = "SMS_271540920";
|
||||||
|
$data['scene_desc'] = "处方审核通过";
|
||||||
|
$data['phone'] = $this->user['mobile'];
|
||||||
|
$data['user_id'] = $this->user['user_id'];
|
||||||
|
|
||||||
|
$template_param = array();
|
||||||
|
$template_param['name'] = $user_doctor['user_name'];
|
||||||
|
$data['template_param'] = $template_param;
|
||||||
|
|
||||||
|
|
||||||
|
$message = new SendSmsMessageProducer($data);
|
||||||
|
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||||
|
$result = $producer->produce($message);
|
||||||
|
if (!$result) {
|
||||||
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠劵发放
|
||||||
|
* @return bool
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
public function distributeCoupon(): 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;
|
||||||
|
$data['notice_system_type'] = 2; // 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息)
|
||||||
|
$data['from_name'] = "肝胆小秘书";
|
||||||
|
$data['notice_title'] = "【优惠劵名称】已到账";
|
||||||
|
$data['notice_content'] = "有新的优惠劵已下发至您的账户中,点击查看详情!";
|
||||||
|
$data['link_type'] = 7;
|
||||||
|
|
||||||
|
$message = new SendStationMessageProducer($data);
|
||||||
|
$producer = ApplicationContext::getContainer()->get(Producer::class);
|
||||||
|
$result = $producer->produce($message);
|
||||||
|
if (!$result) {
|
||||||
|
throw new BusinessException("加入推送队列失败" . json_encode($data,JSON_UNESCAPED_UNICODE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new BusinessException("加入推送队列失败" . $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user