新增上报失败短信推送
This commit is contained in:
parent
094696df2c
commit
9d454e9ad6
@ -199,6 +199,12 @@ class SendSmsMessageConsumer extends ConsumerMessage
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'SMS_463525093':
|
||||||
|
// 客服-通知客服
|
||||||
|
if (!isset($template_param['code'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// 非法模版
|
// 非法模版
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -7,6 +7,8 @@ namespace App\Command;
|
|||||||
use App\Exception\BusinessException;
|
use App\Exception\BusinessException;
|
||||||
use App\Model\OrderPrescription;
|
use App\Model\OrderPrescription;
|
||||||
use App\Model\OrderProduct;
|
use App\Model\OrderProduct;
|
||||||
|
use App\Model\OrderSystem;
|
||||||
|
use App\Model\UserDoctor;
|
||||||
use App\Model\UserPatient;
|
use App\Model\UserPatient;
|
||||||
use App\Services\MessagePush;
|
use App\Services\MessagePush;
|
||||||
use App\Services\OrderPrescriptionService;
|
use App\Services\OrderPrescriptionService;
|
||||||
@ -92,6 +94,19 @@ class ReportPreProductOrderCommand extends HyperfCommand
|
|||||||
// $OrderProductService->OrderProductRefund($item['order_product_id'],"药品订单退款");
|
// $OrderProductService->OrderProductRefund($item['order_product_id'],"药品订单退款");
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
|
|
||||||
|
// 获取系统配置
|
||||||
|
$params = array();
|
||||||
|
$params['system_permission'] = "reportPreNotice";
|
||||||
|
$order_system = OrderSystem::getOne($params);
|
||||||
|
if (!empty($order_system)){
|
||||||
|
if ($order_system['is_sms'] == 1 && !empty($order_system['sms_mobile'])){
|
||||||
|
// 客服-通知客服药品订单上报处方平台失败
|
||||||
|
$MessagePush = new MessagePush();
|
||||||
|
$MessagePush->noticeReport($order_product['order_product_no'],$order_system['sms_mobile']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}catch(\Exception $e){
|
}catch(\Exception $e){
|
||||||
|
|||||||
82
app/Model/OrderSystem.php
Normal file
82
app/Model/OrderSystem.php
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Model;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
use Hyperf\Database\Model\Collection;
|
||||||
|
use Hyperf\Snowflake\Concern\Snowflake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property int $system_id 主键id
|
||||||
|
* @property string $system_name 配置名称
|
||||||
|
* @property string $system_remarks 配置备注
|
||||||
|
* @property int $system_status 配置状态(1:开启 2:关闭)
|
||||||
|
* @property string $system_permission 事件标识
|
||||||
|
* @property int $is_sms 是否需要短信通知(0:否 1:是)
|
||||||
|
* @property string $sms_mobile 短信通知手机号
|
||||||
|
* @property \Carbon\Carbon $created_at 创建时间
|
||||||
|
* @property \Carbon\Carbon $updated_at 修改时间
|
||||||
|
*/
|
||||||
|
class OrderSystem extends Model
|
||||||
|
{
|
||||||
|
use Snowflake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*/
|
||||||
|
protected ?string $table = 'order_system';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected array $fillable = ['system_id', 'system_name', 'system_remarks', 'system_status', 'system_permission', 'is_sms', 'sms_mobile', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
protected string $primaryKey = "family_id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据-单
|
||||||
|
* @param array $params
|
||||||
|
* @param array $fields
|
||||||
|
* @return object|null
|
||||||
|
*/
|
||||||
|
public static function getOne(array $params, array $fields = ['*']): object|null
|
||||||
|
{
|
||||||
|
return self::where($params)->first($fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据-多
|
||||||
|
* @param array $params
|
||||||
|
* @param array $fields
|
||||||
|
* @return Collection|array
|
||||||
|
*/
|
||||||
|
public static function getList(array $params = [], array $fields = ['*']): Collection|array
|
||||||
|
{
|
||||||
|
return self::where($params)->get($fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
* @param array $data
|
||||||
|
* @return \Hyperf\Database\Model\Model|OrderSystem
|
||||||
|
*/
|
||||||
|
public static function addOrderSystem(array $data = []): \Hyperf\Database\Model\Model|OrderSystem
|
||||||
|
{
|
||||||
|
return self::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
* @param array $params
|
||||||
|
* @param array $data
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function edit(array $params = [], array $data = []): int
|
||||||
|
{
|
||||||
|
return self::where($params)->update($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -2270,8 +2270,6 @@ class MessagePush extends BaseService
|
|||||||
* 订阅发送失败发送短信
|
* 订阅发送失败发送短信
|
||||||
* @param string $order_detection_id
|
* @param string $order_detection_id
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ContainerExceptionInterface
|
|
||||||
* @throws NotFoundExceptionInterface
|
|
||||||
*/
|
*/
|
||||||
public function patientDetectionResultNotice(string $order_detection_id): void
|
public function patientDetectionResultNotice(string $order_detection_id): void
|
||||||
{
|
{
|
||||||
@ -2389,4 +2387,33 @@ class MessagePush extends BaseService
|
|||||||
throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE));
|
throw new BusinessException("加入推送队列失败" . json_encode($data, JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客服-通知客服
|
||||||
|
* 短信
|
||||||
|
* @param string $order_no
|
||||||
|
* @param string $mobile
|
||||||
|
* @return void
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
public function noticeReport(string $order_no,string $mobile): void
|
||||||
|
{
|
||||||
|
// 获取系统接诊配置
|
||||||
|
$data = array();
|
||||||
|
$data['template_code'] = "SMS_463525093";
|
||||||
|
$data['scene_desc'] = "通知客服";
|
||||||
|
$data['phone'] = $mobile;
|
||||||
|
|
||||||
|
$template_param = array();
|
||||||
|
$template_param['code'] = $order_no;
|
||||||
|
$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));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user