<?php namespace app\queue\redis; use app\common\logic\PayNotifyLogic; use app\common\model\retail\Cashierclass; use app\common\model\store_order\StoreOrder; use app\common\model\user_recharge\UserRecharge; use app\common\service\pay\PayService; use app\common\service\PushService; use Webman\RedisQueue\Consumer; use support\exception\BusinessException; /** * 微信条码支付队列消费 */ class TaskRechargeQuerySend implements Consumer { // 要消费的队列名 public $queue = 'task-recharge-query'; // 连接名,对应 plugin/webman/redis-queue/redis.php 里的连接` public $connection = 'default'; // 消费 public function consume($data) { $pay = new PayService(); $order = [ 'out_trade_no' => $data['order_id'], ]; $res = $pay->wechat->query($order); if ($res['trade_state'] == 'SUCCESS' && $res['trade_state_desc'] == '支付成功') { if(isset($data['pay_type']) && $data['pay_type']=='recharge'){ PayNotifyLogic::handle('recharge', $res['out_trade_no'], $res); } } } // 消费失败时 public function onConsumeFailure(\Throwable $exception, $package) { return $package; } }