HomeOrderServer.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace app\admin\server\home;
  3. use app\admin\model\HomeOrder;
  4. class HomeOrderServer
  5. {
  6. /**
  7. * Notes:获取订单列表
  8. * @param string $keywords
  9. * @param int $page
  10. * @param int $limit
  11. * @return array
  12. * User: YCP
  13. * Date: 2022/11/2
  14. */
  15. public static function getOrderList(int $page, int $limit, string $keywords)
  16. {
  17. [$list, $count] = HomeOrder::getOrderList($page, $limit,$keywords);
  18. return compact('list', 'page', 'limit', 'count');
  19. }
  20. /**
  21. * Notes:获取订单详情
  22. * @param int $order_id
  23. * @return int
  24. * User: YCP
  25. * Date: 2022/11/2
  26. */
  27. public static function orderInfo(int $order_id)
  28. {
  29. HomeOrder::affairBegin();
  30. try {
  31. $where = [];
  32. $where['order_id'] = $order_id;
  33. $result = HomeOrder::with(['User','HomeGoods'])->where($where)->first();
  34. if (!empty($result)){
  35. HomeOrder::affairCommit();
  36. return $result;
  37. }else{
  38. return false;
  39. }
  40. }catch (\Exception $exception){
  41. HomeOrder::affairRollback();
  42. throw new \Exception($exception->getMessage(), 500);
  43. }
  44. }
  45. }