LineServer.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace app\api\server\travel;
  3. use app\api\model\TravelLine;
  4. use app\api\model\TravelDate;
  5. use app\api\model\MerchantShop;
  6. use support\Redis;
  7. class LineServer
  8. {
  9. /**
  10. * Notes:获取店铺信息
  11. * @param int $shop_id
  12. * @return array
  13. * User: YCP
  14. * Date: 2022/10/27
  15. */
  16. public static function getShop(int $shop_id)
  17. {
  18. $info = MerchantShop::getShopInfo($shop_id);
  19. $info['shop_label'] = explode('|',$info['shop_label']);
  20. return $info;
  21. }
  22. /**
  23. * Notes:获取线路列表
  24. * @param string $keywords
  25. * @param int $page
  26. * @param int $limit
  27. * @return array
  28. * User: YCP
  29. * Date: 2023/05/16
  30. */
  31. public static function getLineList()
  32. {
  33. [$list, $count] = TravelLine::getLineList();
  34. return compact('list', 'count');
  35. }
  36. /**
  37. * Notes:查询线路
  38. * @param int $line_id
  39. * @return int
  40. * User: YCP
  41. * Date: 2023/05/16
  42. */
  43. public static function lineInfo($line_id)
  44. {
  45. $where = [];
  46. $where['line_id'] = $line_id;
  47. $result = TravelLine::where($where)->with(['LineDate','Shop'])->first();
  48. if(empty($result) || $result === false)
  49. {
  50. throw new \Exception('线路信息不存在');
  51. }
  52. $result['line_images'] = explode(",",$result['line_images']);
  53. $result['line_tags'] = explode(",",$result['line_tags']);
  54. $result['line_trip'] = explode(",",$result['line_trip']);
  55. return $result;
  56. }
  57. }