CashierNotify.php 801 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace addons\Happiness\common\logic\notify;
  3. use addons\Happiness\common\models\HappinessCashierOrder;
  4. use common\enums\RabbitMqEnum;
  5. use common\traits\ErrorTrait;
  6. use Exception;
  7. class CashierNotify
  8. {
  9. use ErrorTrait;
  10. public function notify($order_info)
  11. {
  12. try {
  13. $order = HappinessCashierOrder::getOne([['order_no' => $order_info['order_no']]],true);
  14. $order['pay_type'] =$order_info['pay_type'];
  15. \Yii::$app->services->rabbitMq->push(RabbitMqEnum::EXCHANGE_ORDER, RabbitMqEnum::ORDER_QUEUE, $order, HappinessCashierOrder::class, 'pay');
  16. return true;
  17. } catch (Exception $e) {
  18. echo $e->getMessage();
  19. $this->setStaticError($e->getMessage());
  20. return false;
  21. }
  22. }
  23. }