You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

42 lines
1006 B

<?php
declare(strict_types=1);
namespace App\Amqp\Consumer;
use App\Constants\SsdbKeysPrefix;
use Hyperf\Amqp\Result;
use Hyperf\Amqp\Annotation\Consumer;
use Hyperf\Amqp\Message\ConsumerMessage;
use Hyperf\Utils\ApplicationContext;
use PhpAmqpLib\Message\AMQPMessage;
use App\Service\CouponRebateService;
use App\Service\CouponRebateServiceInterface;
use Hyperf\Di\Annotation\Inject;
/**
* @Consumer(exchange="couponRebate", routingKey="couponRebate", queue="couponRebate", name ="couponRebateConsumer", nums=1)
*/
class couponRebateConsumer extends ConsumerMessage
{
/**
* @Inject
* @var CouponRebateService
*/
protected $CouponRebateService;
public function consumeMessage($data, AMQPMessage $message): string
{
$res = $this->CouponRebateService->couponRebate($data);
if (!$res) {
return Result::REQUEUE;
}
return Result::ACK;
}
public function isEnable(): bool
{
return parent::isEnable();
}
}