HdNotifyClass.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace biz\common\classes;
  3. use biz\base\classes\BaseClass;
  4. use common\components\noticeUtil;
  5. use Yii;
  6. class HdNotifyClass extends BaseClass
  7. {
  8. public static function newOrderNotify($orderId)
  9. {
  10. try {
  11. $producer = Yii::$app->rabbitmq->getProducer('notifyProducer');
  12. $msg = serialize(['type' => 'hd_new_order_notify', 'orderId' => $orderId]);
  13. $producer->publish($msg, 'notifyExchange', 'notifyRoute');
  14. } catch (\Exception $e) {
  15. $msg = $e->getMessage();
  16. $remind = "花店新订单通知,生产消息报错 {$orderId} {$msg}";
  17. noticeUtil::push($remind, '15280215347');
  18. }
  19. }
  20. public static function newCgNotify($cgId)
  21. {
  22. try {
  23. $producer = Yii::$app->rabbitmq->getProducer('notifyProducer');
  24. $msg = serialize(['type' => 'hd_new_cg_notify', 'cgId' => $cgId]);
  25. $producer->publish($msg, 'notifyExchange', 'notifyRoute');
  26. } catch (\Exception $e) {
  27. $msg = $e->getMessage();
  28. $remind = "花店新采购单通知,生产消息报错 {$cgId} {$msg}";
  29. noticeUtil::push($remind, '15280215347');
  30. }
  31. }
  32. }