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);