ShopServer.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace App\Servers;
  3. use App\Models\Main\MainShop;
  4. use App\Models\TableNumber;
  5. use Illuminate\Support\Facades\DB;
  6. /**
  7. * 商家管理
  8. */
  9. class ShopServer
  10. {
  11. static private $server = null;
  12. private function __construct()
  13. {
  14. }
  15. /**
  16. * 创建对象
  17. * @return ShopServer
  18. */
  19. static function creatServer()
  20. {
  21. if (empty(self::$server)) self::$server = new ShopServer();
  22. return self::$server;
  23. }
  24. /**
  25. * 获取店铺详情
  26. * @param $shop_id
  27. * @return MainShop|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|\Illuminate\Database\Query\Builder|object|null
  28. */
  29. function getShopInfo($shop_id){
  30. //$status 1正常 2闭店
  31. return MainShop::where('id',$shop_id)->select(['id','shop_name','status','shop_logo','shop_phone','address','city_name'])->first();
  32. }
  33. /**
  34. * 获取桌号信息
  35. * @param $shop_id
  36. * @param $number
  37. * @return TableNumber|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|\Illuminate\Database\Query\Builder|object|null
  38. */
  39. function getTableInfo($shop_id,$number){
  40. //$status 1正常 2闭店
  41. return TableNumber::where('shop_id',$shop_id)->where('number',$number)->select(['id','number','title','status'])->first();
  42. }
  43. }