From b378e2fbb81ec74223289ad14ee02eb7f616be05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Fri, 10 Feb 2023 18:13:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20#10000=20=E5=BA=97=E9=93=BA=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E8=BF=87=E6=9C=9F=E7=8A=B6=E6=80=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Shop/ShopsController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/Shop/ShopsController.php b/app/Http/Controllers/Shop/ShopsController.php index 26a23a5..4c3a0c0 100644 --- a/app/Http/Controllers/Shop/ShopsController.php +++ b/app/Http/Controllers/Shop/ShopsController.php @@ -19,11 +19,15 @@ class ShopsController extends Controller public function index(Request $request) { $shops = Shop::query()->filter()->paginate($request->get('per_page')); + $time = time(); foreach ($shops as $shop) { $shop->authUrl = ''; if ('妙选' !== $shop->plat_id && ('未授权' === $shop->status || '重新授权' === $shop->status)) { $shop->authUrl = BusinessFactory::init()->make($shop->plat_id)->getAuthUrl($shop->id, $shop->getOriginal('plat_id')); } + if ($shop->expires_at && $time >= $shop->expires_at) { + Shop::query()->where('id', $shop->id)->update(['status' => Shop::$STATUS_UNAUTHORIZED]); + } } return ShopsResource::collection($shops);