Jelajahi Sumber

activity chunfen

zz 6 tahun lalu
induk
melakukan
90c47ec1e2

+ 64 - 0
app/Http/Controllers/Wap/Web/WelcomeController.php

@@ -332,6 +332,11 @@ class WelcomeController extends BaseController
                 if ($status) {
                     $is_show_activity = 1;
                     $bottom_show_type = 2;
+                    if($activity_setting['activity_id'] == env('OTHER_ACTIVITY_ID',0)){
+                        if(!in_array($this->distribution_channel_id, explode(',', env('OTHER_ACTIVITY_CHANNEL', '1')))){
+                            $is_show_activity = 0;
+                        }
+                    }
                 }
             }
         }
@@ -1774,4 +1779,63 @@ class WelcomeController extends BaseController
         $url = env('H5_SCHEME', 'https') . '://site' . $encode_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/';
         return redirect()->to($url);
     }
+
+    //春分活动
+    public function vernalEquinoxActivity(Request $request)
+    {
+        $encode_distribution_channel_id = encodeDistributionChannelId($this->distribution_channel_id);
+        $token = $request->input('token');
+        $activity_info = ActivityService::getByToken($token);
+        if (!$activity_info) {
+            $default_url = env('H5_SCHEME', 'https') . '://site' . $encode_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/';
+            return redirect()->to($default_url);
+        }
+
+        $from = $request->input('fromtype', 'main');
+        $uv_key_format = 'activity:%s:distribution_channel_id:%s:date:%s:uv';
+        $pv_key_format = 'activity:%s:distribution_channel_id:%s:pv';
+        $uv_key = sprintf($uv_key_format, $activity_info->id, $this->distribution_channel_id, date('Y-m-d'));
+        $pv_key = sprintf($pv_key_format, $activity_info->id, $this->distribution_channel_id);
+        Redis::sadd($uv_key, $this->uid);
+        Redis::hincrby($pv_key, date('Y-m-d'), 1);
+        $redirect_url = env('H5_SCHEME', 'https') . '://site' . $encode_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/person';
+        if ($request->input('redirect_url')) {
+            $redirect_url = $request->input('redirect_url');
+            $redirect_url = urldecode($redirect_url);
+        }
+        $least_charge_amount = Order::select('id', 'price')
+            ->where('uid', $this->uid)
+            ->where('status', 'PAID')
+            ->where('created_at', '>=', strtotime($activity_info->start_time) - 60 * 86400)
+            ->max('price');
+        $type = 'litter';
+        if ($least_charge_amount && $least_charge_amount >= 30) {
+            $img = 'https://cdn-novel.iycdm.com/h5/activity-2019-03-20/bg50.jpg';
+            $product_ids = 4806;
+        }else{
+            $img = 'https://cdn-novel.iycdm.com/h5/activity-2019-03-20/bg23.jpg';
+            $product_ids = 4805;
+        }
+
+        //未开始
+        if (time() < strtotime($activity_info->start_time)) {
+            return view('pay.order.vernalEquinoxActivity', ['url' => ['javascript:void(0)', 'javascript:void(0)'], 'code' => -1, 'type' => $type, 'img' => $img]);
+        }
+        //结束
+        if (time() > strtotime($activity_info->end_time)) {
+            return view('pay.order.vernalEquinoxActivity', ['url' => ['javascript:void(0)', 'javascript:void(0)'], 'code' => -2, 'type' => $type, 'img' => $img]);
+        }
+
+            $param = [
+                'uid' => $this->uid,
+                'distribution_channel_id' => $this->distribution_channel_id,
+                'product_id' => $product_ids,
+                'activity_id' => $activity_info->id,
+                'fromtype' => $from,
+                'pay_redirect_url' => $redirect_url,
+                'limit' => 100,
+            ];
+            $url = env('CREATE_PAY_URL') . '?' . http_build_query($param);
+        return view('pay.order.vernalEquinoxActivity', ['url' => $url, 'code' => 0, 'type' => $type, 'img' => $img]);
+    }
 }

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

@@ -202,6 +202,7 @@ Route::group(['domain'=>env('WAP_DOMAIN'),'namespace'=>'App\Http\Controllers\Wap
         Route::get('sale/thanksGivingDayActivity','Web\WelcomeController@thanksGivingDayActivity');
 
         Route::get('sale/greatcold','Web\WelcomeController@greatColdActivity');
+        Route::get('sale/vernalequinox','Web\WelcomeController@vernalEquinoxActivity');
         Route::get('sale/customvip','Web\WelcomeController@channelYearActivity');
         //继续阅读
         Route::get('continue','User\ReadRecordController@latestRead');

+ 75 - 0
resources/views/pay/order/vernalEquinoxActivity.blade.php

@@ -0,0 +1,75 @@
+<!--
+/**
+ * Created by PhpStorm.
+ * User: z-yang
+ * Date: 2019/3/20
+ * Time: 11:40
+ */
+ -->
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>春分至-最是人间好时光</title>
+    <style>
+html {
+    background: #4ba0bf;
+}
+
+        html,
+        body {
+    margin: 0 auto;
+            padding: 0;
+            max-width: 450px;
+            font-size: 100px;
+        }
+
+        .main_box {
+    font-size: 0;
+            position: relative;
+        }
+
+        .main_box img {
+    width: 100%;
+}
+
+        .recharge_box_one a {
+    position: absolute;
+    width: 80%;
+    height: 0.75rem;
+            top: 72%;
+            left: 50%;
+            transform: translateX(-50%);
+            z-index: 999;
+        }
+    </style>
+</head>
+
+<body>
+<main class="main_box">
+    <img src="{{$img}}" alt="">
+    <div class="recharge_box_one">
+@if($code == -1)
+    <!-- 活动未开始 -->
+    <a href="#" class="un_begin">
+        <img src="https://cdn-novel.iycdm.com/h5/activity-2019-03-20/undone.png" alt="">
+    </a>
+@elseif($code == 0)
+    <!-- 活动进行中 -->
+    <a href="{{$url}}" class="beginning">
+        <img src="https://cdn-novel.iycdm.com/h5/activity-2019-03-20/doing.png" alt="">
+    </a>
+@elseif($code == -2)
+    <!-- 活动结束 -->
+    <a href="javascript:void(0)" class="over">
+        <img src="https://cdn-novel.iycdm.com/h5/activity-2019-03-20/over.png" alt="">
+    </a>
+    @endif
+    </div>
+    </main>
+    </body>
+
+    </html>