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.

53 lines
1.3 KiB

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. $time1 = strtotime(($store->time1));
  23. $time2 = strtotime(($store->time2));
  24. if($time1 < $nowTime && $nowTime < $time2){
  25. return true;
  26. }
  27. $time3 = strtotime(($store->time3));
  28. $time4 = strtotime(($store->time4));
  29. if($time3 < $nowTime && $nowTime < $time4){
  30. return true;
  31. }
  32. }
  33. return false;
  34. }
  35. public function undo()
  36. {
  37. // TODO: Implement undo() method.
  38. }
  39. public function detail($storeId)
  40. {
  41. return Store::query()
  42. ->with('market')
  43. ->where('id',$storeId)
  44. ->first()->toArray();
  45. }
  46. }