zz 6 years ago
parent
commit
5e430b0ecb

+ 18 - 18
app/Http/Controllers/Wap/Book/BookController.php

@@ -546,27 +546,27 @@ class BookController extends BaseController
         $res = BookConfigService::getRecommendBooks($bid,$book_info->channel_name);
         return response()->collection(new BookTransformer(),$res);
     }
-
+    
     /**
      * h5智能推荐图书
      * @param Request $request
      */
     public function H5SmartRecommendBooks(Request $request){
 //     	$this->uid=666;
-        if(!$this->checkUid()){
-            return response()->error('NOT_LOGIN');
-        }
-        $pos = $request->input('pos');
-        if(empty($pos)){
-            return response()->error('PARAM_ERROR');
-        }
-        // 最近阅读轮播图
-        if($pos == 'h5RecentReadLoop'){
-            $book_num = 6;
-        }
-
-        $res = BookConfigService::getH5RecommendBooks($this->uid,$pos,$book_num);
-        return response()->collection(new BookTransformer(),$res);
+    	if(!$this->checkUid()){
+    		return response()->error('NOT_LOGIN');
+    	}
+    	$pos = $request->input('pos');
+    	if(empty($pos)){
+    		return response()->error('PARAM_ERROR');
+    	}
+    	// 最近阅读轮播图
+    	if($pos == 'h5RecentReadLoop'){
+    		$book_num = 6;
+    	}
+
+    	$res = BookConfigService::getH5RecommendBooks($this->uid,$pos,$book_num);
+    	return response()->collection(new BookTransformer(),$res);
     }
 
     /**
@@ -639,7 +639,7 @@ class BookController extends BaseController
      *                   last_chapter:第254章 婚礼(大结局),
      *               },
      *           ],
-     *            female:[{},{}]
+     *            female:[{},{}] 
      *           }
      *       }
      */
@@ -686,7 +686,7 @@ class BookController extends BaseController
             }else{
                 $midstr = env('WORD_RANK_MALE_TOTAL','638,677,694,635,612,693,634,642,775,780');
                 $fidstr = env('WORD_RANK_FEMALE_TOTAL','57,636,614,1,10,48,58,324,354,99');
-            }
+            }    
             $female = collectionTransform(new BookTransformer,BookConfigService::getBooksByIds(explode(',',$fidstr)));
             $male = collectionTransform(new BookTransformer,BookConfigService::getBooksByIds(explode(',',$midstr)));
         }
@@ -709,7 +709,7 @@ class BookController extends BaseController
         }else{
             return response()->error('PARAM_ERROR');
         }
-
+        
         $data = ['male'=>$male,'female'=>$female];
         Cache::put($cache_key, json_encode($data), 60*24);
         return response()->success($data);

+ 41 - 41
app/Http/Controllers/Wap/Book/ChapterController.php

@@ -1538,48 +1538,48 @@ class ChapterController extends BaseController
     public function getWechatJsConfig(Request $request)
     {
         //try {
-        // $chapter->is_show_share_button = 1;
-        $bid = $request->input('bid', '');
-        $cid = $request->input('cid', '');
-        $url = $request->input('url', '');
-        $url = urldecode($url);
-
-        \Log::info('url:' . ($this->uid) . $url);
-        if (empty($bid) || empty($cid) || empty($url)) {
-            return response()->error('PARAM_EMPTY');
-        }
-
-        $share_url = 'https://'._domain().'/detail?fromtype=readershare&id='.$bid.'&fromflag='.($this->uid).'&fromcid='.$cid;
-        //$js_config = ChapterShareWechatConfigService::getConfig($url);
-
-        $app_hash = array(
-            4025=>['appid'=>'wx80b618c9dcc940f7','appsecret'=>'255a2de8db51e4084b5e9087d26d4ecb'],
-            4147=>['appid'=>'wx2a99699cd9572812','appsecret'=>'0e0d57f94eeba50abb3af6883df05a5c'],
-            691=>['appid'=>'wx5cefcd251dc40693','appsecret'=>'755f64c85173dad21f20870e38f59d8a'],
-            123=>['appid'=>'wx983808610aa9dcc5','appsecret'=>'91002999590b79f3c7be35fd73c04049'],
-            211=>['appid'=>'wx39338e374cc2055b','appsecret'=>'1a4c2039be271b3811182be5bb53eb34'],
+            // $chapter->is_show_share_button = 1;
+            $bid = $request->input('bid', '');
+            $cid = $request->input('cid', '');
+            $url = $request->input('url', '');
+            $url = urldecode($url);
+
+            \Log::info('url:' . ($this->uid) . $url);
+            if (empty($bid) || empty($cid) || empty($url)) {
+                return response()->error('PARAM_EMPTY');
+            }
 
-        );
-        $appId = $app_hash[$this->distribution_channel_id]['appid'];
-        $appSecret = $app_hash[$this->distribution_channel_id]['appsecret'];
-        $js_config = (new ChapterShareWechatConfigService($appId,$appSecret))->getSignPackage($url);
-        /*$appid = DB::table('official_accounts')->where('distribution_channel_id',$this->distribution_channel_id)->first();//(['distribution_channel_id'=>$this->distribution_channel_id]);
-        $appid = $appid->appid;
-        //\Log::info('get_appid:'.($appid));
-        $js_config = (new ChapterShareWechatConfigService($appid))->getSignPackage($url);
-        //$chapter->js_config = $js_config;
-        //$chapter->share_url = $share_url;
-        $book = BookService::getBookById(Hashids::decode($bid)[0]);
-        $first_cid = $book->first_cid;
-        $share_url = 'https://site' . encodeDistributionChannelId($this->distribution_channel_id) . '.' . env('SHARE_DOMAIN') . '/reader?fromtype=readershare&bid=' . $bid . '&cid=' . ($first_cid) . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
-        /*if (in_array($this->uid, explode(',', env('TEST_SHARE_UIDS')))) {
-            $share_url = 'https://site5017zqeyzwgyx9n8.zhuishuyun.com/reader?fromtype=readershare&bid=' . $bid . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
-        }*/
-        $book = BookService::getBookById(Hashids::decode($bid)[0]);
-        $first_cid = $book->first_cid;
-        $share_url = 'https://site' . encodeDistributionChannelId($this->distribution_channel_id) . '.' . env('SHARE_DOMAIN') . '/reader?fromtype=readershare&bid=' . $bid . '&cid=' . ($first_cid) . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
-        if (in_array($this->distribution_channel_id, [2, 14])) {
-            $js_config = ChapterShareWechatConfigService::getConfig($url);
+            $share_url = 'https://'._domain().'/detail?fromtype=readershare&id='.$bid.'&fromflag='.($this->uid).'&fromcid='.$cid;
+            //$js_config = ChapterShareWechatConfigService::getConfig($url);
+
+            $app_hash = array(
+                4025=>['appid'=>'wx80b618c9dcc940f7','appsecret'=>'255a2de8db51e4084b5e9087d26d4ecb'],
+                4147=>['appid'=>'wx2a99699cd9572812','appsecret'=>'0e0d57f94eeba50abb3af6883df05a5c'],
+                691=>['appid'=>'wx5cefcd251dc40693','appsecret'=>'755f64c85173dad21f20870e38f59d8a'],
+                123=>['appid'=>'wx983808610aa9dcc5','appsecret'=>'91002999590b79f3c7be35fd73c04049'],
+                211=>['appid'=>'wx39338e374cc2055b','appsecret'=>'1a4c2039be271b3811182be5bb53eb34'],
+
+            );
+            $appId = $app_hash[$this->distribution_channel_id]['appid'];
+            $appSecret = $app_hash[$this->distribution_channel_id]['appsecret'];
+            $js_config = (new ChapterShareWechatConfigService($appId,$appSecret))->getSignPackage($url);
+            /*$appid = DB::table('official_accounts')->where('distribution_channel_id',$this->distribution_channel_id)->first();//(['distribution_channel_id'=>$this->distribution_channel_id]);
+            $appid = $appid->appid;
+            //\Log::info('get_appid:'.($appid));
+            $js_config = (new ChapterShareWechatConfigService($appid))->getSignPackage($url);
+            //$chapter->js_config = $js_config;
+            //$chapter->share_url = $share_url;
+            $book = BookService::getBookById(Hashids::decode($bid)[0]);
+            $first_cid = $book->first_cid;
+            $share_url = 'https://site' . encodeDistributionChannelId($this->distribution_channel_id) . '.' . env('SHARE_DOMAIN') . '/reader?fromtype=readershare&bid=' . $bid . '&cid=' . ($first_cid) . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
+            /*if (in_array($this->uid, explode(',', env('TEST_SHARE_UIDS')))) {
+                $share_url = 'https://site5017zqeyzwgyx9n8.zhuishuyun.com/reader?fromtype=readershare&bid=' . $bid . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
+            }*/
+            $book = BookService::getBookById(Hashids::decode($bid)[0]);
+            $first_cid = $book->first_cid;
+            $share_url = 'https://site' . encodeDistributionChannelId($this->distribution_channel_id) . '.' . env('SHARE_DOMAIN') . '/reader?fromtype=readershare&bid=' . $bid . '&cid=' . ($first_cid) . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
+            if (in_array($this->distribution_channel_id, [2, 14])) {
+                $js_config = ChapterShareWechatConfigService::getConfig($url);
 
             $share_url = 'https://site' . ($this->distribution_channel_id) . '.' . env('SHARE_DOMAIN') . '/reader?fromtype=readershare&bid=' . $bid . '&cid=' . ($first_cid) . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
         }