zz пре 6 година
родитељ
комит
94311cfe24

+ 27 - 0
app/Http/Controllers/Wap/User/CoflController.php

@@ -314,6 +314,33 @@ class CoflController extends Controller
         Cookie::queue('crm_flag', $flag, env('U_COOKIE_EXPIRE'), null, null, false, false);
     }
 
+
+    public function longActivity(Request $request)
+    {
+        $openid = $request->get('openid');
+        //授权
+        $params = $request->except('_url');
+        if(empty($openid)){
+            $url = url()->current() . '?' . http_build_query($params);
+            $params['redirect_url'] = urlencode($url);
+            $app = new Application($this->auth($params));
+            return $app->oauth->redirect();
+        }
+        $user = $this->getUsers($openid);
+        if(!$user[0]){
+            $distribution_channel_id = 123;
+        }else{
+            $distribution_channel_id = $user[1];
+        }
+        $crm = $request->get('crm');
+        $this->stats('activity',$crm);
+        $baselink  = $this->getLink($distribution_channel_id).'activity/crm?'.http_build_query($params);
+        if(isset($params['token']) && !empty($params['token'])){
+            return redirect()->to($baselink.'activity/crm?'.http_build_query($params));
+        }
+        return redirect()->to($baselink);
+    }
+
     public function guidePersonalAccount(Request $request,$channel_id){
         $uid = $request->get('uid');
         if($uid){

+ 25 - 0
app/Http/Controllers/Wap/Web/ActivityController.php

@@ -108,4 +108,29 @@ class ActivityController extends BaseController
         $default_url = env('H5_SCHEME', 'https') . '://site' . $encode_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/';
         return redirect()->to($default_url);
     }
+
+    public function crmActivity(Request $request){
+        $default_url = env('H5_SCHEME', 'https') . '://site' . $this->en_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/';
+
+        $token = $request->input('token');
+        if(!$token){
+            return redirect()->to($default_url);
+        }
+        $activity_info = ActivityService::getByToken($token);
+        if(!$activity_info){
+            return redirect()->to($default_url);
+        }
+        $img = \GuzzleHttp\json_decode($activity_info->setting,1);
+        $param = [
+            'uid' => $this->uid,
+            'distribution_channel_id' => $this->distribution_channel_id,
+            'product_id' => $activity_info->product_id,
+            'activity_id' => $activity_info->id,
+            'fromtype' => 'crm',
+            'pay_redirect_url' => '/person',
+            'limit' => 100,
+        ];
+        $url = env('CREATE_PAY_URL') . '?' . http_build_query($param);
+        return view('crm.crmActivity', ['url' => $url,'img'=>$img['button']]);
+    }
 }

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

@@ -53,6 +53,7 @@ Route::group(['domain'=>env('FRIEND_LINK_DOMAIN'),'namespace'=>'App\Http\Control
     Route::get('freecurrency','User\CoflController@freeCurrencyView');
     Route::get('freethrhcurrency','User\CoflController@freeCurrencyView');
     Route::post('freecurrency','User\CoflController@freeCurrencyPost');
+    Route::get('activity','User\CoflController@longActivity');
 });
 
 Route::group(['domain'=>env('WAP_DOMAIN'),'namespace'=>'App\Http\Controllers\Wap','middleware'=>'EnableCross'],function(){
@@ -244,6 +245,7 @@ Route::group(['domain'=>env('WAP_DOMAIN'),'namespace'=>'App\Http\Controllers\Wap
 
         Route::get('activity/channel','Web\ActivityController@channelCustomActivity');
         Route::get('activity/common','Web\ActivityController@commonActivity');
+        Route::get('activity/crm','Web\ActivityController@crmActivity');
 
         Route::get('welfare/giving','Web\WelfareController@giving');
 

+ 121 - 0
resources/views/crm/crmActivity.blade.php

@@ -0,0 +1,121 @@
+<!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" />
+    <title>谷雨活动</title>
+    <style>
+        html,
+        body {
+            margin: 0 auto;
+            padding: 0;
+            max-width: 450px;
+            font-size: 100px;
+        }
+
+        html {
+            background: #ffe69d;
+        }
+
+        p {
+            margin: 0;
+        }
+
+        .main_box {
+            font-size: 0;
+            position: relative;
+        }
+
+        .main_box img {
+            width: 100%;
+        }
+
+        .time {
+            font-size: 0.14rem;
+            font-weight: bold;
+            text-align: center;
+            color: #fff;
+        }
+
+        .recharge-item {
+            font-size: 0;
+            width: 90%;
+            margin: 0.3rem auto;
+            position: absolute;
+            top: 60%;
+            left: 50%;
+            transform: translateX(-50%);
+        }
+
+        .recharge_box_one {
+            width: 95%;
+            margin: 0 auto;
+        }
+
+        .rule-box {
+            font-size: 0;
+            margin: 0rem auto 0;
+            text-align: center;
+            position: relative;
+            top: -0.25rem;
+        }
+
+        .rule-box img {
+            width: 80%;
+        }
+
+        .rule-texts {
+            font-size: 0.14rem;
+            color: #000;
+            margin-top: 0.1rem;
+            text-align: left;
+        }
+
+        .rule-texts .rule {
+            line-height: 2;
+        }
+
+        .rule-box .copyright {
+            font-size: 0.15rem;
+            margin-top: 0.15rem;
+            text-align: center;
+            color: #000;
+        }
+
+        .main_box img,
+        a {
+            -webkit-tap-highlight-color: transparent;
+        }
+
+        .recharge-box {
+            font-size: 0;
+            position: absolute;
+            top: 41%;
+            left: 50%;
+            -webkit-transform: translateX(-50%);
+            -ms-transform: translateX(-50%);
+            transform: translateX(-50%);
+        }
+
+        .recharge-item .pay{
+            display: block;
+
+        }
+    </style>
+</head>
+
+<body>
+<main class="main_box">
+    <img src="https://cdn-novel.iycdm.com/h5/activity-crm/bg.jpg" alt="" />
+    <div class="recharge-item">
+        <div class="rule-box">
+            <a href="{{$url}}" class="pay"><img src="{{$img}}" alt="" /></a>
+        </div>
+    </div>
+</main>
+</body>
+</html>