队列日志类型使用错误

This commit is contained in:
wucongxing 2023-12-18 09:24:34 +08:00
parent 6d2e10eb2c
commit 87f1caa555

View File

@ -34,14 +34,14 @@ class PrescriptionExpiredDelayDirectConsumer extends ConsumerMessage
public function consumeMessage($data, AMQPMessage $message): string public function consumeMessage($data, AMQPMessage $message): string
{ {
Log::getInstance()->error("开始执行 处方过期 队列:" . json_encode($data, JSON_UNESCAPED_UNICODE)); Log::getInstance("queue-PrescriptionExpired")->info(json_encode($data, JSON_UNESCAPED_UNICODE));
Db::beginTransaction(); Db::beginTransaction();
try { try {
// 验证参数 // 验证参数
if (!isset($data['order_prescription_id'])){ if (!isset($data['order_prescription_id'])){
Db::rollBack(); Db::rollBack();
Log::getInstance()->error("处方过期队列执行失败:入参错误"); Log::getInstance("queue-PrescriptionExpired")->error("入参错误");
return Result::DROP; return Result::DROP;
} }
@ -51,7 +51,7 @@ class PrescriptionExpiredDelayDirectConsumer extends ConsumerMessage
$order_prescription = OrderPrescription::getOne($params); $order_prescription = OrderPrescription::getOne($params);
if (empty($order_prescription)){ if (empty($order_prescription)){
Db::rollBack(); Db::rollBack();
Log::getInstance()->error("处方过期处方队列执行失败:获取处方数据为空"); Log::getInstance("queue-PrescriptionExpired")->error("获取处方数据为空");
return Result::DROP; return Result::DROP;
} }
@ -66,11 +66,11 @@ class PrescriptionExpiredDelayDirectConsumer extends ConsumerMessage
$this->handlePrescription($order_prescription); $this->handlePrescription($order_prescription);
Db::commit(); Db::commit();
Log::getInstance()->info("处方过期 队列执行成功"); Log::getInstance("queue-PrescriptionExpired")->info("成功");
return Result::ACK; return Result::ACK;
} catch (\Exception $e) { } catch (\Exception $e) {
Db::rollBack(); Db::rollBack();
Log::getInstance()->error("处方过期 执行失败:" . $e->getMessage()); Log::getInstance("queue-PrescriptionExpired")->error($e->getMessage());
return Result::ACK; // 重回队列 return Result::ACK; // 重回队列
} }
} }
@ -84,13 +84,13 @@ class PrescriptionExpiredDelayDirectConsumer extends ConsumerMessage
{ {
if ($order_prescription['prescription_status'] == 3){ if ($order_prescription['prescription_status'] == 3){
Db::rollBack(); Db::rollBack();
Log::getInstance()->info("处方过期 队列执行失败:处方已失效,无需处理"); Log::getInstance("queue-PrescriptionExpired")->info("处方已失效,无需处理");
return false; return false;
} }
if ($order_prescription['prescription_status'] == 4){ if ($order_prescription['prescription_status'] == 4){
Db::rollBack(); Db::rollBack();
Log::getInstance()->info("处方过期 队列执行失败:处方已使用,无需处理"); Log::getInstance("queue-PrescriptionExpired")->info("处方已使用,无需处理");
return false; return false;
} }
return true; return true;