diff --git a/app/Amqp/Consumer/SendStationMessageConsumer.php b/app/Amqp/Consumer/SendStationMessageConsumer.php index f3fb48b..842a5f5 100644 --- a/app/Amqp/Consumer/SendStationMessageConsumer.php +++ b/app/Amqp/Consumer/SendStationMessageConsumer.php @@ -29,12 +29,12 @@ class SendStationMessageConsumer extends ConsumerMessage */ public function consumeMessage($data, AMQPMessage $message): string { - Log::getInstance()->info("开始执行 站内消息推送 队列:" . json_encode($data, JSON_UNESCAPED_UNICODE)); + Log::getInstance("queue-SendStationMessage")->info("开始:" . json_encode($data, JSON_UNESCAPED_UNICODE)); // 验证推送参数 $res = $this->checkPushParams($data); if (!$res){ - Log::getInstance()->error("站内消息推送失败:入参错误"); + Log::getInstance("queue-SendStationMessage")->error("站内消息推送失败:入参错误"); return Result::DROP; } @@ -43,7 +43,7 @@ class SendStationMessageConsumer extends ConsumerMessage $params['user_id'] = $data['user_id']; $user = User::getOne($params); if(empty($user)){ - Log::getInstance()->error("站内消息推送失败:推送用户信息错误"); + Log::getInstance("queue-SendStationMessage")->error("站内消息推送失败:推送用户信息错误"); return Result::DROP; } @@ -57,7 +57,7 @@ class SendStationMessageConsumer extends ConsumerMessage // 患者系统消息 $message_type = 5; }else{ - Log::getInstance()->error("站内消息推送失败:消息类型错误"); + Log::getInstance("queue-SendStationMessage")->error("站内消息推送失败:消息类型错误"); $this->saveErrorPushLog($user['user_type'],$data,"消息类型错误"); return Result::DROP; } @@ -88,11 +88,11 @@ class SendStationMessageConsumer extends ConsumerMessage // 新增成功通知消息表 $this->saveMessageNotice($user->toArray(),$data); - Log::getInstance()->info("站内消息推送成功"); + Log::getInstance("queue-SendStationMessage")->info("站内消息推送成功"); $this->saveSuccessPushLog($user['user_type'],$data); } catch (\Exception $e) { - Log::getInstance()->error("站内消息推送执行失败:" . $e->getMessage()); + Log::getInstance("queue-SendStationMessage")->error("站内消息推送执行失败:" . $e->getMessage()); $this->saveErrorPushLog($user['user_type'],$data,$e->getMessage()); @@ -153,7 +153,7 @@ class SendStationMessageConsumer extends ConsumerMessage $data['content'] = json_encode($push_data,JSON_UNESCAPED_UNICODE); $log_message_push = LogMessagePush::addLogMessagePush($data); if (empty($log_message_push)){ - Log::getInstance()->error("站内消息推送成功,增加推送日志失败:" . json_encode($data,JSON_UNESCAPED_UNICODE)); + Log::getInstance("queue-SendStationMessage")->error("站内消息推送成功,增加推送日志失败:" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } @@ -175,7 +175,7 @@ class SendStationMessageConsumer extends ConsumerMessage $data['content'] = json_encode($push_data,JSON_UNESCAPED_UNICODE); $log_message_push = LogMessagePush::addLogMessagePush($data); if (empty($log_message_push)){ - Log::getInstance()->error("站内消息推送成功,增加推送日志失败:" . json_encode($data,JSON_UNESCAPED_UNICODE)); + Log::getInstance("queue-SendStationMessage")->error("站内消息推送成功,增加推送日志失败:" . json_encode($data,JSON_UNESCAPED_UNICODE)); } } @@ -246,7 +246,7 @@ class SendStationMessageConsumer extends ConsumerMessage $message_notice = MessageNotice::addMessageNotice($notice_data); if (empty($message_notice)){ - Log::getInstance()->error("站内消息推送成功,记录通知消息表失败:" . json_encode($notice_data,JSON_UNESCAPED_UNICODE)); + Log::getInstance("queue-SendStationMessage")->error("站内消息推送成功,记录通知消息表失败:" . json_encode($notice_data,JSON_UNESCAPED_UNICODE)); } } } diff --git a/app/Command/GrantUserCouponCommand.php b/app/Command/GrantUserCouponCommand.php index 17e5aad..84ff3e9 100644 --- a/app/Command/GrantUserCouponCommand.php +++ b/app/Command/GrantUserCouponCommand.php @@ -43,7 +43,7 @@ class GrantUserCouponCommand extends HyperfCommand // 获取需要发放的优惠卷数据 $params = array(); - $params['coupon_id'] = 3; + $params['coupon_id'] = 5; $coupon = Coupon::getOne($params); if (empty($coupon)){ $this->line("结束:无可执行优惠卷"); @@ -80,6 +80,7 @@ class GrantUserCouponCommand extends HyperfCommand Db::commit(); $this->line("用户" . $user['user_name'] . "执行完毕"); + sleep(1); } $this->line("发放完毕");