更改下发token主键类型问题
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Amqp\Consumer;
|
||||
|
||||
use App\Model\OrderPrescription;
|
||||
use App\Utils\Log;
|
||||
use Hyperf\Amqp\Message\ConsumerDelayedMessageTrait;
|
||||
use Hyperf\Amqp\Message\ProducerDelayedMessageTrait;
|
||||
@@ -37,14 +38,72 @@ class PrescriptionExpiredDelayDirectConsumer extends ConsumerMessage
|
||||
|
||||
Db::beginTransaction();
|
||||
try {
|
||||
// 验证参数
|
||||
if (!isset($data['order_prescription_id'])){
|
||||
Db::rollBack();
|
||||
Log::getInstance()->error("自动取消未使用处方队列执行失败:入参错误");
|
||||
return Result::DROP;
|
||||
}
|
||||
|
||||
// 获取处方数据
|
||||
$params = array();
|
||||
$params['order_prescription_id'] = $data['order_prescription_id'];
|
||||
$order_prescription = OrderPrescription::getOne($params);
|
||||
if (empty($order_prescription)){
|
||||
Db::rollBack();
|
||||
Log::getInstance()->error("自动取消未使用处方队列执行失败:获取处方数据为空");
|
||||
return Result::DROP;
|
||||
}
|
||||
|
||||
// 检测处方审核、使用状态
|
||||
$res = $this->checkPrescriptionStatus($order_prescription);
|
||||
if (!$res){
|
||||
Db::rollBack();
|
||||
return Result::ACK;
|
||||
}
|
||||
|
||||
// 处理处方过期状态
|
||||
|
||||
|
||||
|
||||
Db::commit();
|
||||
Log::getInstance()->info("自动取消未使用处方队列执行成功");
|
||||
Log::getInstance()->info("自动取消未使用处方 队列执行成功");
|
||||
return Result::ACK;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
Log::getInstance()->error("自动完成问诊订单执行失败:" . $e->getMessage());
|
||||
Log::getInstance()->error("自动取消未使用处方 执行失败:" . $e->getMessage());
|
||||
return Result::ACK; // 重回队列
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测处方审核状态
|
||||
* @param array|object $order_prescription
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkPrescriptionStatus(array|object $order_prescription): bool
|
||||
{
|
||||
if ($order_prescription['prescription_status'] == 3){
|
||||
Db::rollBack();
|
||||
Log::getInstance()->info("自动取消未使用处方队列执行失败:处方已失效,无需处理");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($order_prescription['prescription_status'] == 4){
|
||||
Db::rollBack();
|
||||
Log::getInstance()->info("自动取消未使用处方队列执行失败:处方已使用,无需处理");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 处理处方
|
||||
protected function handlePrescription(array|object $order_prescription){
|
||||
$pamras = array();
|
||||
$pamras['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
|
||||
$data = array();
|
||||
$data['prescription_status'] = 3;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user