From 57900bf2d37b268a3b2c04593ddee3ab79a87c6f Mon Sep 17 00:00:00 2001 From: liufei Date: Tue, 10 Sep 2024 10:23:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=95=86=E5=BA=97?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=97=B6=E5=8C=BA=E9=85=8D=E7=BD=AE=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Console/Command/AutoCheckInCommand.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Console/Command/AutoCheckInCommand.php b/src/Console/Command/AutoCheckInCommand.php index 6d8eb86..97e9c27 100644 --- a/src/Console/Command/AutoCheckInCommand.php +++ b/src/Console/Command/AutoCheckInCommand.php @@ -18,12 +18,17 @@ class AutoCheckInCommand extends AbstractCommand protected $events; protected $settings; + private $storeTimezone = 'Asia/Shanghai'; + public function __construct(SettingsRepositoryInterface $settings, TranslatorInterface $translator, Repository $cache, Dispatcher $events) { parent::__construct(); $this->cache = $cache; $this->events = $events; $this->settings = $settings; $this->translator = $translator; + + $storeTimezone = $this->settings->get('mattoid-store.storeTimezone', 'Asia/Shanghai'); + $this->storeTimezone = !!$storeTimezone ? $storeTimezone : 'Asia/Shanghai'; } protected function configure() @@ -33,7 +38,7 @@ protected function configure() protected function fire() { - $datetime = Carbon::now()->tz($this->settings->get('mattoid-store.storeTimezone','Asia/Shanghai')); + $datetime = Carbon::now()->tz($this->storeTimezone); $cartList = StoreCartModel::query()->where('outtime', '>=', $datetime)->where('status', 1)->where('code', 'autoCheckIn')->groupBy('user_id')->get(); foreach ($cartList as $cart) {