TestOrderService.php 860 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: LinFei
  5. * Created time 2022/12/15 15:10:07
  6. * E-mail: fly@eyabc.cn
  7. */
  8. declare (strict_types=1);
  9. namespace LinFly\Example;
  10. class TestOrderService
  11. {
  12. public function __construct(private TestUserService $testUserService)
  13. {
  14. }
  15. /**
  16. * 获取订单信息
  17. * @param int $orderNo
  18. * @return array
  19. */
  20. public function getOrderInfo(int $orderNo)
  21. {
  22. return [
  23. 'order_no' => $orderNo,
  24. 'user_info' => $this->testUserService->getUserInfo(1),
  25. ];
  26. }
  27. /**
  28. * 获取用户订单列表
  29. * @param int $userId
  30. * @return array[]
  31. */
  32. public function getUserOrderList(int $userId)
  33. {
  34. return [
  35. $this->getOrderInfo(1),
  36. $this->getOrderInfo(2),
  37. $this->getOrderInfo(3),
  38. ];
  39. }
  40. }