Quellcode durchsuchen

custom transfer page

zz vor 5 Jahren
Ursprung
Commit
f9a94343c7

+ 54 - 0
app/Http/Controllers/Wap/Web/RedirectController.php

@@ -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);
+    }
 }

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

@@ -317,6 +317,7 @@ Route::group(['domain'=>env('WAP_DOMAIN'),'namespace'=>'App\Http\Controllers\Wap
 
         Route::get('rmonthpay','Order\OrdersController@monthPay');
         Route::get('crmpush','User\UserController@crmPushView');
+        Route::get('custom_msgs_page','Web\RedirectController@customPushtransferPage');
 
         Route::any('{slug}','Web\WelcomeController@index')->where('slug', '(.*)?');
 

+ 77 - 0
resources/views/wap/customPushtransfer.blade.php

@@ -0,0 +1,77 @@
+<!--
+?php
+**
+ * Created by PhpStorm.
+ * User: z-yang
+ * Date: 2019/9/4
+ * Time: 10:17
+ *
+-->
+<!--
+ * @Author: ZhengXiaowei
+ * @Date: 2019-08-15 16:39:23
+ * @LastEditors: ZhengXiaowei
+ * @LastEditTime: 2019-09-03 15:30:12
+ * @Description: 静态章节页
+ -->
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8" />
+    <meta
+            name="viewport"
+            content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
+    />
+    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
+    <link rel=icon type=image/png href="data:image/png;base64,iVBORw0KGgo=">
+    <style>
+        html,
+        body,
+        p {
+            margin: 0;
+            padding: 0;
+        }
+
+        html {
+            background: #e6e6e6;
+        }
+
+        .chapter-content {
+            padding: 10px 20px;
+        }
+
+        .chapter-content .chapter-text {
+            color: #1a1a1a;
+            line-height: 1.8;
+            text-indent: 2em;
+            margin-bottom: 10px;
+        }
+
+        .next-chapter__btn {
+            font-size: 14px;
+            color: #1a1a1a;
+            width: 80%;
+            margin: 0 auto;
+            border: 1px solid #666;
+            text-align: center;
+            background: #e6e6e6;
+            border-radius: 4px;
+            line-height: 40px;
+            margin-bottom: 20px;
+        }
+    </style>
+    <title>{{$name}}</title>
+</head>
+<body>
+<main>
+    <div class="chapter-content">
+        @foreach($chapter_list as $item)
+            <p class="chapter-text">
+                {{$item}}
+            </p>
+        @endforeach
+    </div>
+    <div class="next-chapter__btn"><a href="{{$next_url}}">下一章</a></div>
+</main>
+</body>
+</html>