浏览代码

forbid site allow paid user

zz 6 年之前
父节点
当前提交
053962109a
共有 1 个文件被更改,包括 10 次插入8 次删除
  1. 10 8
      app/Http/Middleware/ReadOauth.php

+ 10 - 8
app/Http/Middleware/ReadOauth.php

@@ -8,6 +8,7 @@ use App\Modules\Channel\Services\ChannelService;
 use App\Modules\OfficialAccount\Services\ForceSubscribeService;
 use App\Modules\SendOrder\Services\SendOrderService;
 use App\Modules\Statistic\Services\WapVisitStatService;
+use App\Modules\Subscribe\Services\OrderService;
 use App\Modules\User\Models\YqMove;
 use App\Modules\User\Services\ReadRecordService;
 use App\Modules\User\Services\UserService;
@@ -60,14 +61,7 @@ class ReadOauth
         if (!$distribution_channel_id) {
             return response()->error('WAP_SYS_ERROR');
         }
-        //禁止访问的site
-        $not_allow_access_site = env('NOT_ALLOW_ACCESS_SITE', '');
-        if ($not_allow_access_site) {
-            $not_allow_access_site_arr = explode(',', $not_allow_access_site);
-            if (in_array($distribution_channel_id, $not_allow_access_site_arr)) {
-                return response($this->notAccessPage())->header('Content-Type', 'text/html');
-            }
-        }
+
         $uri_send_order_id = 0;
         $uri = $request->input('_url');
         if (strpos($uri, '/yun/') !== false) {
@@ -101,6 +95,14 @@ class ReadOauth
             }
         }
 
+        //禁止访问的site
+        $not_allow_access_site = env('NOT_ALLOW_ACCESS_SITE', '');
+        if ($not_allow_access_site) {
+            $not_allow_access_site_arr = explode(',', $not_allow_access_site);
+            if (in_array($distribution_channel_id, $not_allow_access_site_arr) && !OrderService::isPaidUser($uid_cookie)) {
+                return response($this->notAccessPage())->header('Content-Type', 'text/html');
+            }
+        }
         //个性化推送
         $this->stylePush($request, $uid_cookie, $distribution_channel_id);