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.
45 lines
1.1 KiB
45 lines
1.1 KiB
<?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="deviceCouponRebate", routingKey="deviceCouponRebate", queue="deviceCouponRebate", 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
|
|
{
|
|
if(env('APP_ENV') == 'local') {
|
|
return false;
|
|
}
|
|
return parent::isEnable();
|
|
}
|
|
}
|