songdb 6 anos atrás
pai
commit
78bd46378f

+ 13 - 0
app/Http/Controllers/Wap/Book/ChapterController.php

@@ -369,6 +369,14 @@ class ChapterController extends BaseController
             $this->getChapter();
             $this->getChapter();
             return response()->item(new ChapterTransformer, $this->chapter);
             return response()->item(new ChapterTransformer, $this->chapter);
         }
         }
+        //判断当前是否有强制显示服务号信息的cookie、已经关注 跳转到服务号信息引导页
+        if(Cookie::get('force_show_qrcode') && $is_had_subscribe)
+        {
+            $force_read_url = '/subscribe/getFromUser';//服务号信息引导页
+            $force_read_data = ['data' => ['src' => $force_read_url]];
+            return response()->error('WAP_NOT_SUBSCRIBE', $force_read_data);
+        }
+
         //需要强制关注 不是vip章节 已经关注了
         //需要强制关注 不是vip章节 已经关注了
         if (!$force_subscribe && $chapter->is_vip == 0 && $is_had_subscribe) {
         if (!$force_subscribe && $chapter->is_vip == 0 && $is_had_subscribe) {
             $this->getChapter();
             $this->getChapter();
@@ -676,6 +684,11 @@ class ChapterController extends BaseController
         return false;
         return false;
     }
     }
 
 
+    private function getOfficialAccountForceReadNotice()
+    {
+
+    }
+
     //强关页面的统计
     //强关页面的统计
     private function subscribeStats()
     private function subscribeStats()
     {
     {

+ 27 - 0
app/Http/Controllers/Wap/Subscribe/SubscribeController.php

@@ -7,6 +7,7 @@ use GuzzleHttp\Client;
 use App\Http\Controllers\Wap\BaseController;
 use App\Http\Controllers\Wap\BaseController;
 use Redis;
 use Redis;
 use App\Modules\OfficialAccount\Services\OfficialAccountService;
 use App\Modules\OfficialAccount\Services\OfficialAccountService;
+use App\Modules\OfficialAccount\Services\ForceSubscribeService;
 use Cookie;
 use Cookie;
 use Hashids;
 use Hashids;
 use Log;
 use Log;
@@ -103,4 +104,30 @@ class SubscribeController extends BaseController
 
 
         return false;
         return false;
     }
     }
+
+    //获取用户的强关信息
+    function getFromUser()
+    {
+        $uid = $this->uid;
+        $user_info = ForceSubscribeService::forceSubscribeUsersByUid(compact('uid'));
+        if($user_info)
+        {
+            $appid = $user_info->appid;
+            $official_account = OfficialAccountService::officialAccountByAppid(compact('appid'));
+            $title = $official_account->nickname;
+            $img = $official_account->qrcode_url;
+        }else{
+            return redirect()->to('/recent');
+        }
+
+        $head_img_pool = [
+            'https://cdn-novel.iycdm.com/h5/subscribe/headimg/1.png',
+            'https://cdn-novel.iycdm.com/h5/subscribe/headimg/2.png',
+            'https://cdn-novel.iycdm.com/h5/subscribe/headimg/3.png'
+        ];
+
+        $head_img = array_random($head_img_pool);
+
+        return view('wap.userSubInfo',compact('head_img','img','title'));
+    }
 }
 }

+ 3 - 0
app/Http/Routes/Wap/WapRoutes.php

@@ -186,6 +186,9 @@ Route::group(['domain'=>env('WAP_DOMAIN'),'namespace'=>'App\Http\Controllers\Wap
         //继续阅读
         //继续阅读
         Route::get('continue','User\ReadRecordController@latestRead');
         Route::get('continue','User\ReadRecordController@latestRead');
 
 
+        //用户强关信息页
+        Route::any('subscribe/getFromUser','Subscribe\SubscribeController@subscribeView');
+
         Route::any('{slug}','Web\WelcomeController@index')->where('slug', '(.*)?');
         Route::any('{slug}','Web\WelcomeController@index')->where('slug', '(.*)?');
 
 
     });
     });