This commit is contained in:
wucongxing8150 2024-03-22 11:21:13 +08:00
parent 4804e3f930
commit 77af894a76
2 changed files with 11 additions and 10 deletions

View File

@ -29,12 +29,12 @@ class SendStationMessageConsumer extends ConsumerMessage
*/ */
public function consumeMessage($data, AMQPMessage $message): string 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); $res = $this->checkPushParams($data);
if (!$res){ if (!$res){
Log::getInstance()->error("站内消息推送失败:入参错误"); Log::getInstance("queue-SendStationMessage")->error("站内消息推送失败:入参错误");
return Result::DROP; return Result::DROP;
} }
@ -43,7 +43,7 @@ class SendStationMessageConsumer extends ConsumerMessage
$params['user_id'] = $data['user_id']; $params['user_id'] = $data['user_id'];
$user = User::getOne($params); $user = User::getOne($params);
if(empty($user)){ if(empty($user)){
Log::getInstance()->error("站内消息推送失败:推送用户信息错误"); Log::getInstance("queue-SendStationMessage")->error("站内消息推送失败:推送用户信息错误");
return Result::DROP; return Result::DROP;
} }
@ -57,7 +57,7 @@ class SendStationMessageConsumer extends ConsumerMessage
// 患者系统消息 // 患者系统消息
$message_type = 5; $message_type = 5;
}else{ }else{
Log::getInstance()->error("站内消息推送失败:消息类型错误"); Log::getInstance("queue-SendStationMessage")->error("站内消息推送失败:消息类型错误");
$this->saveErrorPushLog($user['user_type'],$data,"消息类型错误"); $this->saveErrorPushLog($user['user_type'],$data,"消息类型错误");
return Result::DROP; return Result::DROP;
} }
@ -88,11 +88,11 @@ class SendStationMessageConsumer extends ConsumerMessage
// 新增成功通知消息表 // 新增成功通知消息表
$this->saveMessageNotice($user->toArray(),$data); $this->saveMessageNotice($user->toArray(),$data);
Log::getInstance()->info("站内消息推送成功"); Log::getInstance("queue-SendStationMessage")->info("站内消息推送成功");
$this->saveSuccessPushLog($user['user_type'],$data); $this->saveSuccessPushLog($user['user_type'],$data);
} catch (\Exception $e) { } catch (\Exception $e) {
Log::getInstance()->error("站内消息推送执行失败:" . $e->getMessage()); Log::getInstance("queue-SendStationMessage")->error("站内消息推送执行失败:" . $e->getMessage());
$this->saveErrorPushLog($user['user_type'],$data,$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); $data['content'] = json_encode($push_data,JSON_UNESCAPED_UNICODE);
$log_message_push = LogMessagePush::addLogMessagePush($data); $log_message_push = LogMessagePush::addLogMessagePush($data);
if (empty($log_message_push)){ 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); $data['content'] = json_encode($push_data,JSON_UNESCAPED_UNICODE);
$log_message_push = LogMessagePush::addLogMessagePush($data); $log_message_push = LogMessagePush::addLogMessagePush($data);
if (empty($log_message_push)){ 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); $message_notice = MessageNotice::addMessageNotice($notice_data);
if (empty($message_notice)){ 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));
} }
} }
} }

View File

@ -43,7 +43,7 @@ class GrantUserCouponCommand extends HyperfCommand
// 获取需要发放的优惠卷数据 // 获取需要发放的优惠卷数据
$params = array(); $params = array();
$params['coupon_id'] = 3; $params['coupon_id'] = 5;
$coupon = Coupon::getOne($params); $coupon = Coupon::getOne($params);
if (empty($coupon)){ if (empty($coupon)){
$this->line("结束:无可执行优惠卷"); $this->line("结束:无可执行优惠卷");
@ -80,6 +80,7 @@ class GrantUserCouponCommand extends HyperfCommand
Db::commit(); Db::commit();
$this->line("用户" . $user['user_name'] . "执行完毕"); $this->line("用户" . $user['user_name'] . "执行完毕");
sleep(1);
} }
$this->line("发放完毕"); $this->line("发放完毕");