AuditOrder.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace app\queue\redis\slow;
  3. use app\extra\dyLife\data\OrderData;
  4. use app\model\saas\SaasOrder;
  5. use Webman\RedisQueue\Consumer;
  6. class AuditOrder implements Consumer
  7. {
  8. /**
  9. * 退款审核
  10. * @var string
  11. */
  12. public string $queue = "audit-order";
  13. /**
  14. * 连接配置
  15. * @var string
  16. */
  17. public string $connection = "default";
  18. public function consume($data): bool
  19. {
  20. try {
  21. echo getDateFull()."===执行推送\n";
  22. if(empty($data['order'])) return true;
  23. $order = (new SaasOrder)->where("order_sn",$data['order'])->findOrEmpty();
  24. if ($order->isEmpty()) return true;
  25. if (!in_array($order['status'],[1,6,4])) return true;
  26. $resp = (new OrderData)->config([
  27. "appid" => sConf("wechat.mini_appid"),
  28. "secret" => sConf("wechat.mini_secret"),
  29. ])->token()->auditOrder($order->toArray());
  30. echo getDateFull()."==={$data['order']}===退款审核推送\n";
  31. print_r($resp);
  32. return true;
  33. } catch (\Throwable $throwable) {
  34. echo getDateFull()."==推送退款审核报错===\n";
  35. echo $throwable->getFile()."\n";
  36. echo $throwable->getLine()."\n";
  37. echo $throwable->getMessage()."\n";
  38. }
  39. return true;
  40. }
  41. }