GhsNotifyClass.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace biz\common\classes;
  3. use biz\base\classes\BaseClass;
  4. use common\components\noticeUtil;
  5. use Yii;
  6. class GhsNotifyClass extends BaseClass
  7. {
  8. //供货商新订单通知 ssh 20251202
  9. public static function newOrderNotify($orderId)
  10. {
  11. try {
  12. $producer = Yii::$app->rabbitmq->getProducer('notifyProducer');
  13. $msg = serialize(['type' => 'ghs_new_order_notify', 'orderId' => $orderId]);
  14. $producer->publish($msg, 'notifyExchange', 'notifyRoute', ['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
  15. } catch (\Exception $e) {
  16. $msg = $e->getMessage();
  17. $remind = "批发,新订单通知,生产消息端报错 {$orderId} {$msg}";
  18. noticeUtil::push($remind, '15280215347');
  19. }
  20. }
  21. //跑腿异常通知
  22. public static function ptErrorNotify($orderId, $event)
  23. {
  24. try {
  25. $producer = Yii::$app->rabbitmq->getProducer('notifyProducer');
  26. $msg = serialize(['type' => 'ghs_pt_error', 'orderId' => $orderId, 'event' => $event]);
  27. $producer->publish($msg, 'notifyExchange', 'notifyRoute', ['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
  28. } catch (\Exception $e) {
  29. $msg = $e->getMessage();
  30. $remind = "批发,跑腿异常通知,生产消息端报错 {$orderId} {$msg}";
  31. noticeUtil::push($remind, '15280215347');
  32. }
  33. }
  34. }