35 lines
1016 B
PHP
35 lines
1016 B
PHP
<?php
|
|
|
|
namespace app\queue\redis;
|
|
|
|
use app\admin\logic\operation\OpurchaseclassLogic;
|
|
use app\common\model\opurchase\Opurchaseinfo;
|
|
use Webman\RedisQueue\Consumer;
|
|
use Webman\Push\Api;
|
|
use support\exception\BusinessException;
|
|
use support\Log;
|
|
|
|
class PushSupplierProductsSend implements Consumer
|
|
{
|
|
// 要消费的队列名
|
|
public $queue = 'push-supplier-products';
|
|
|
|
// 连接名,对应 plugin/webman/redis-queue/redis.php 里的连接`
|
|
public $connection = 'default';
|
|
|
|
// 消费
|
|
public function consume($data)
|
|
{
|
|
$order_id=$data['order_id'];
|
|
$select=Opurchaseinfo::where('pid',$order_id)->where('is_push',0)->select();
|
|
foreach ($select as $key => $arr) {
|
|
OpurchaseclassLogic::createSupplierGoods($arr);
|
|
}
|
|
}
|
|
public function onConsumeFailure(\Throwable $e, $package)
|
|
{
|
|
$package['max_attempts']=0;
|
|
Log::error('添加推送给供应商报价失败order_id'.$package['data']['order_id']);
|
|
return $package;
|
|
}
|
|
} |