You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.3 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Service\v3\Implementations;
  3. use App\Model\v3\Store;
  4. use App\Service\v3\Interfaces\StoreServiceInterface;
  5. class StoreService implements StoreServiceInterface
  6. {
  7. public function do()
  8. {
  9. // TODO: Implement do() method.
  10. }
  11. public function check($storeId)
  12. {
  13. $store = Store::query()->where([
  14. ['id','=',$storeId],
  15. ['is_rest','=',0],
  16. ['status','=',2]
  17. ])
  18. ->select('time1','time2','time3','time4')
  19. ->first();
  20. if(!empty($store)){
  21. $nowTime = time();
  22. $startTime = strtotime(($store->time1));
  23. if(!empty($store->time3) && !empty($store->time4)){
  24. $time4 = strtotime(($store->time4));
  25. $endTime = $time4;
  26. }else{
  27. $time2 = strtotime(($store->time2));
  28. $endTime = $time2;
  29. }
  30. if($nowTime > $startTime && $nowTime < $endTime){
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. public function undo()
  37. {
  38. // TODO: Implement undo() method.
  39. }
  40. public function detail($storeId)
  41. {
  42. return Store::query()
  43. ->with('market')
  44. ->where('id',$storeId)
  45. ->first()->toArray();
  46. }
  47. }