|  | @@ -2,6 +2,8 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  namespace App\Http\Controllers\Wap\Web;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +use App\Modules\Book\Services\BookConfigService;
 | 
	
		
			
				|  |  | +use App\Modules\Book\Services\ChapterService;
 | 
	
		
			
				|  |  |  use App\Modules\Subscribe\Services\OrderService;
 | 
	
		
			
				|  |  |  use App\Modules\User\Services\ReadRecordService;
 | 
	
		
			
				|  |  |  use Illuminate\Routing\Controller;
 | 
	
	
		
			
				|  | @@ -297,4 +299,56 @@ class RedirectController extends BaseController
 | 
	
		
			
				|  |  |          Redis::sadd('InnerOuterWeixinStats:'.$day,$send_order_id.':'.$this->distribution_channel_id);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    public function customPushtransferPage(Request $request,$channel_id, $domain){
 | 
	
		
			
				|  |  | +        $data = [];
 | 
	
		
			
				|  |  | +        $url = $request->get('origin_url');
 | 
	
		
			
				|  |  | +        $from_type = $request->get('fromtype');
 | 
	
		
			
				|  |  | +        if(!$url) return redirect()->to('/');
 | 
	
		
			
				|  |  | +        $url = urldecode($url);
 | 
	
		
			
				|  |  | +        $info = parse_url($url);
 | 
	
		
			
				|  |  | +        if(!isset($info['path']) || $info['path'] != '/reader'){
 | 
	
		
			
				|  |  | +            if(strpos($url,'?') === false){
 | 
	
		
			
				|  |  | +                return redirect()->to($url.'?fromtype='.$from_type);
 | 
	
		
			
				|  |  | +            }else{
 | 
	
		
			
				|  |  | +                return redirect()->to($url.'&fromtype='.$from_type);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        parse_str($info['query'],$output);
 | 
	
		
			
				|  |  | +        if(!isset($output['bid']) || !isset($output['cid'])) return redirect()->to('/');
 | 
	
		
			
				|  |  | +        $bid = explode(',',$output['bid'])[0];
 | 
	
		
			
				|  |  | +        $book_info = BookConfigService::getBookById($bid);
 | 
	
		
			
				|  |  | +        $chapter_content = ChapterService::getChapter($book_info->bid, $output['cid']);
 | 
	
		
			
				|  |  | +        $data['chapter_list'] = explode("\r\n",$chapter_content->content);
 | 
	
		
			
				|  |  | +        $data['name'] = $book_info->book_name;
 | 
	
		
			
				|  |  | +        $data['next_url'] = '/reader?bid='.$output['bid'].'&cid='.$chapter_content->next_cid.'&fromtype='.$from_type;
 | 
	
		
			
				|  |  | +        if($from_type){
 | 
	
		
			
				|  |  | +            //['custom','template']
 | 
	
		
			
				|  |  | +            $push_info = explode('_',$from_type);
 | 
	
		
			
				|  |  | +            $push_id = 0;
 | 
	
		
			
				|  |  | +            if($push_info && !empty($push_info[1]) && is_numeric($push_info[1])){
 | 
	
		
			
				|  |  | +                $push_id = $push_info[1];
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if(str_contains($from_type,['custom']) && $push_id){
 | 
	
		
			
				|  |  | +                $push_transfer_custom_flag = Cookie::get('push_transfer_custom_flag');
 | 
	
		
			
				|  |  | +                if(!$push_transfer_custom_flag || !in_array($push_id,explode(',',$push_transfer_custom_flag))){
 | 
	
		
			
				|  |  | +                    Redis::hincrby('push_transfer_page_custom_uv' , $push_id,  1);
 | 
	
		
			
				|  |  | +                    if($push_transfer_custom_flag) $push_transfer_custom_flag = $push_transfer_custom_flag.','.$push_id;
 | 
	
		
			
				|  |  | +                    else $push_transfer_custom_flag = $push_id;
 | 
	
		
			
				|  |  | +                    Cookie::queue('push_transfer_custom_flag',$push_transfer_custom_flag, env('U_COOKIE_EXPIRE'), null, null, false, false);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                Redis::hincrby('push_transfer_page_custom_pv' , $push_id,  1);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if(str_contains($from_type,['template']) && $push_id){
 | 
	
		
			
				|  |  | +                $push_transfer_template_flag = Cookie::get('push_transfer_template_flag');
 | 
	
		
			
				|  |  | +                if(!$push_transfer_template_flag || !in_array($push_id,explode(',',$push_transfer_template_flag))){
 | 
	
		
			
				|  |  | +                    Redis::hincrby('push_transfer_page_template_uv' , $push_id,  1);
 | 
	
		
			
				|  |  | +                    if($push_transfer_template_flag) $push_transfer_template_flag = $push_transfer_template_flag.','.$push_id;
 | 
	
		
			
				|  |  | +                    else $push_transfer_template_flag = $push_id;
 | 
	
		
			
				|  |  | +                    Cookie::queue('push_transfer_template_flag',$push_transfer_template_flag, env('U_COOKIE_EXPIRE'), null, null, false, false);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                Redis::hincrby('push_transfer_page_template' , $push_id, 1);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return view('wap.customPushtransfer',$data);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |