multi-store/app/queue/redis/PushDeliverySend.php

31 lines
771 B
PHP

<?php
namespace app\queue\redis;
use app\common\service\wechat\WeChatMnpService;
use Webman\RedisQueue\Consumer;
use support\Log;
/**小程序发货 */
class PushDeliverySend implements Consumer
{
// 要消费的队列名
public $queue = 'push-delivery';
// 连接名,对应 plugin/webman/redis-queue/redis.php 里的连接`
public $connection = 'default';
// 消费
public function consume($data)
{
(new WeChatMnpService)->delivery($data['order_id'], $data['openid'],$data['logistics_type']??3);
}
public function onConsumeFailure(\Throwable $e, $package)
{
$package['max_attempts']=0;
Log::error('推送小程序发货通知失败:'.$package['data']['order_id']);
return $package;
}
}