zz 6 роки тому
батько
коміт
63327c86fa

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

@@ -136,4 +136,70 @@ class ActivityController extends BaseController
         $fee = $product_info->price*100+$product_info->given;
         return view('crm.crmActivity', ['url' => $url,'img'=>$img['button'],'fee'=>$fee]);
     }
+
+    public function huaweiActivity(Request $request){
+        $encode_distribution_channel_id = encodeDistributionChannelId($this->distribution_channel_id);
+        $token = $request->input('token');
+        $activity_info = ActivityService::getByToken($token);
+        if ($activity_info && isset($activity_info->setting) && empty(!$activity_info->setting)) {
+            $imgs = json_decode($activity_info->setting, 1);
+            $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);
+
+            $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);
+            }
+            if (time() > strtotime($activity_info->start_time) && time() < strtotime($activity_info->end_time)) {
+                Redis::sadd($uv_key, $this->uid);
+                Redis::hincrby($pv_key, date('Y-m-d'), 1);
+                $products = explode(',',$activity_info->setting);
+                $url = [];
+                foreach ($products as $v){
+                    $param = [
+                        'uid' => $this->uid,
+                        'distribution_channel_id' => $this->distribution_channel_id,
+                        'product_id' => $v,
+                        '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.activity.huaweiActivity', ['url' => $url, 'code' => 0, 'img' => $imgs]);
+            } else if (time() <= strtotime($activity_info->start_time)) {
+                return view('pay.activity.huaweiActivity', ['url' => [], 'code' => 1, 'img' => $imgs]);
+            } else {
+                return view('pay.activity.huaweiActivity', ['url' => [], 'code' => 2, 'img' => $imgs]);
+            }
+        }
+        $default_url = env('H5_SCHEME', 'https') . '://site' . $encode_distribution_channel_id . '.' . env('CUSTOM_HOST') . '.com/';
+        return redirect()->to($default_url);
+    }
+
+    public function huaweiLotteryView(){
+        return view('pay.activity.huaweiLottery', ['count'=>10,'time_diff'=>6554]);
+    }
+
+    public function huaweiLottery(){
+        $code = random_int(1,1000);
+        $count = random_int(6,10);
+        if($code <=20){
+            // 100书币
+            $point = 20+45*7;
+        }elseif($code <= 200){
+            $point = 20+45;
+        }elseif($code <= 700){
+            $point =20+45*3;
+        }else{
+            $point =20+45*2;
+        }
+        $rotate = $point+360*$count;
+        return response()->success(compact('rotate'));
+    }
 }

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

@@ -192,6 +192,8 @@ Route::group(['domain'=>env('WAP_DOMAIN'),'namespace'=>'App\Http\Controllers\Wap
         Route::get('complaints/getComplaintTags','Other\ComplaintsController@getComplaintTags');
         Route::post('complaints/add','Other\ComplaintsController@Complaints');
 
+        Route::post('activity/huaweiLottery','Web\ActivityController@huaweiLottery');
+
     });
 
     //授权回掉
@@ -247,6 +249,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('activity/huaweiLottery','Web\ActivityController@huaweiLotteryView');
 
         Route::get('welfare/giving','Web\WelfareController@giving');
 

+ 222 - 0
resources/views/pay/activity/huaweiActivity.blade.php

@@ -0,0 +1,222 @@
+<!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: #fff;
+        }
+
+        a {
+            text-decoration: none;
+            color: currentColor;
+        }
+
+        p {
+            margin: 0;
+        }
+
+        i {
+            font-style: normal;
+        }
+
+        .main_box {
+            font-size: 0;
+            position: relative;
+        }
+
+        .main_box img {
+            width: 100%;
+        }
+
+        .main_box .banner-box {
+            font-size: 0;
+            position: relative;
+        }
+
+        .main_box .banner-box .click-area {
+            position: absolute;
+            bottom: 6%;
+            left: 50%;
+            -webkit-transform: translateX(-50%);
+            transform: translateX(-50%);
+            width: 1rem;
+            height: .35rem;
+        }
+
+        .main_box .activity-time {
+            font-size: 0.12rem;
+            color: #97643e;
+            text-align: center;
+            margin-top: 0.1rem;
+        }
+
+        .main_box .recharge-list__wrap {
+            display: -webkit-box;
+            display: -ms-flexbox;
+            display: flex;
+            -webkit-box-pack: justify;
+            -ms-flex-pack: justify;
+            justify-content: space-between;
+            -webkit-box-align: center;
+            -ms-flex-align: center;
+            align-items: center;
+            -webkit-box-orient: horizontal;
+            -webkit-box-direction: normal;
+            -ms-flex-flow: row wrap;
+            flex-flow: row wrap;
+            width: 90%;
+            margin: 0.14rem auto 0;
+        }
+
+        .main_box .recharge-list__wrap .recharge-item {
+            padding: 0.14rem 0 0.12rem;
+            width: 1.51rem;
+            font-size: 0.12rem;
+            color: #97643e;
+            text-align: center;
+            border: 1px solid #97643e;
+            border-radius: 5px;
+        }
+
+        .main_box .recharge-list__wrap .recharge-item .pay {
+            font-size: 0.25rem;
+            font-weight: bold;
+        }
+
+        .main_box .recharge-list__wrap .recharge-item .get {
+            font-weight: bold;
+            color: #f35a0a;
+        }
+
+        .main_box .recharge-list__wrap .recharge-item.cur {
+            border-color: transparent;
+            background-image: -webkit-gradient(linear, left bottom, left top, from(#e2c18c), to(#f2d8aa));
+            background-image: linear-gradient(0deg, #e2c18c 0%, #f2d8aa 100%);
+            -webkit-box-shadow: 0px 0px 0.18rem 0px rgba(188, 142, 91, 0.5);
+            box-shadow: 0px 0px 0.18rem 0px rgba(188, 142, 91, 0.5);
+            color: #6f4518;
+        }
+
+        .main_box .recharge-list__wrap .recharge-item.cur .get {
+            color: #6f4518;
+        }
+
+        .main_box .recharge-list__wrap .recharge-item:nth-of-type(1), .main_box .recharge-list__wrap .recharge-item:nth-of-type(2) {
+            margin-bottom: 0.15rem;
+        }
+
+        .main_box .to-recharge {
+            width: 90%;
+            margin: .16rem auto 0;
+            display: block;
+            text-align: center;
+            color: #6f4518;
+            font-size: .18rem;
+            line-height: 50px;
+            background-image: -webkit-gradient(linear, right top, left top, from(#e2c18c), to(#f2d8aa));
+            background-image: linear-gradient(-90deg, #e2c18c 0%, #f2d8aa 100%);
+            -webkit-box-shadow: 0px 0px 0.18rem 0px rgba(188, 142, 91, 0.5);
+            box-shadow: 0px 0px 0.18rem 0px rgba(188, 142, 91, 0.5);
+            border-radius: 25px;
+            -webkit-tap-highlight-color: transparent;
+        }
+
+        .rule-box .rule-line {
+            border-top: 1px solid #edc7ab;
+            height: 0px;
+            width: 80%;
+            margin: .23rem auto;
+            position: relative;
+        }
+
+        .rule-box .rule-line::after {
+            content: "活动说明";
+            position: absolute;
+            font-size: .13rem;
+            font-weight: bold;
+            color: #97643e;
+            left: 50%;
+            top: 50%;
+            -webkit-transform: translate(-50%, -50%);
+            transform: translate(-50%, -50%);
+            background: #fff;
+            width: 100px;
+            text-align: center;
+        }
+
+        .rule-box .rule-items {
+            width: 80%;
+            margin: 0 auto;
+            font-size: .12rem;
+            color: #97643e;
+            line-height: 2;
+        }
+        /*# sourceMappingURL=index.css.map */
+    </style>
+</head>
+
+<body>
+<main class="main_box">
+    <div class="banner-box">
+        <img src="https://cdn-novel.iycdm.com/h5/activity-2019-05-30/banner.jpg" alt="抽奖大礼包">
+        <a href="#" class="click-area"></a>
+    </div>
+    <p class="activity-time">活动有效期:{{$enn_time}}</p>
+    <div class="recharge-list__wrap">
+        <div class="recharge-item cur" data-href="{{isset($url[0])? $url[0]:''}}">
+            <p class="pay">30元</p>
+            <span class="send">3000书币</span>
+            <p class="get">获得1次抽奖机会</p>
+        </div>
+        <div class="recharge-item" data-href="{{isset($url[1])? $url[1]:''}}">
+            <p class="pay">50元</p>
+            <span class="send">5000+4000书币</span>
+            <p class="get">获得2次抽奖机会</p>
+        </div>
+        <div class="recharge-item" data-href="{{isset($url[2])? $url[2]:''}}">
+            <p class="pay">100元</p>
+            <span class="send">10000+9000书币</span>
+            <p class="get">获得4次抽奖机会</p>
+        </div>
+        <div class="recharge-item" data-href="{{isset($url[3])? $url[3]:''}}">
+            <p class="pay">200元</p>
+            <span class="send">20000+20000书币</span>
+            <p class="get">获得8次抽奖机会</p>
+        </div>
+    </div>
+    <a href="{{isset($url[0])? $url[0]:'#'}}" class="to-recharge" id="pay">充值后即可参与抽奖</a>
+</main>
+<div class="rule-box">
+    <p class="rule-line"></p>
+    <div class="rule-items">
+        <p class="item">1、充值成功即获得抽奖机会;</p>
+        <p class="item">2、此充值未书币充值,1元=100书币;</p>
+        <p class="item">3、书币为虚拟物品,一经充值不得退款;</p>
+        <p class="item">4、活动期间不限充值次数;</p>
+    </div>
+</div>
+</body>
+<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
+<script>
+    $(".recharge-list__wrap").delegate(".recharge-item", "click", function() {
+        $(".recharge-item").removeClass("cur");
+        $(this).addClass("cur");
+        $('#pay').setAttribute('href',$(this).data('href'))
+    })
+</script>
+</html>

+ 580 - 0
resources/views/pay/activity/huaweiLottery.blade.php

@@ -0,0 +1,580 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8" />
+    <meta
+            name="viewport"
+            content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
+    />
+    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
+    <title>抽大奖</title>
+    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
+    <style>
+        html,
+        body {
+            height: 100%;
+            width: 100%;
+            font-family: -apple-system-font, BlinkMacSystemFont, "Helvetica Neue",
+            "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei",
+            Arial, sans-serif;
+            padding: 0;
+            margin: 0;
+            background-color: #ba3d26;
+            font-size: 100px;
+        }
+
+        .bg {
+            width: 100%;
+        }
+
+        .index .slider #slider {
+            width: 100%;
+            height: 0.3rem;
+            position: absolute;
+            top: 19%;
+            left: 0;
+            right: 0;
+            overflow: hidden;
+            font-size: 0.14rem;
+            text-align: center;
+            line-height: 0.3rem;
+            color: #590700;
+        }
+
+        .index .slider #slider .slider-img {
+            background: #ffffff;
+            width: 3rem;
+            height: 100%;
+            position: absolute;
+            -webkit-transform: translateX(-50%);
+            transform: translateX(-50%);
+            left: 50%;
+            top: 0;
+            z-index: -1;
+            border-radius: 15px;
+            opacity: 0.72;
+        }
+
+        .index .slider #slider .slider-img.active {
+            z-index: auto;
+        }
+
+        .index .slider #slider .slider-nav-list {
+            position: absolute;
+            bottom: 5%;
+            left: 50%;
+            transform: translateX(-50%);
+            -webkit-transform: translateX(-50%);
+            list-style: none;
+            margin: 0;
+            padding: 0;
+        }
+
+        .index .slider #slider .slider-nav-list .nav-item {
+            width: 8px;
+            height: 8px;
+            border-radius: 50%;
+            background: #fff;
+            display: inline-block;
+            margin: 0 8px;
+            cursor: pointer;
+            -webkit-transition: all 0.5s linear;
+            transition: all 0.5s linear;
+        }
+
+        .index .slider #slider .slider-nav-list .nav-item.active {
+            margin-bottom: -1px;
+            width: 10px;
+            height: 10px;
+            background: #ff9800;
+        }
+
+        .index .time {
+            position: absolute;
+            top: 26.5%;
+            width: 50%;
+            left: 50%;
+            -webkit-transform: translate(-50%);
+            transform: translate(-50%);
+            display: -webkit-box;
+            display: -ms-flexbox;
+            display: flex;
+            -webkit-box-pack: justify;
+            -ms-flex-pack: justify;
+            justify-content: space-between;
+            font-size: 0.12rem;
+            font-weight: bold;
+        }
+
+        .index .time div {
+            color: #ffffff;
+            padding: 0.05rem 0;
+        }
+
+        .index .time span {
+            background-color: #ffffff;
+            color: #c13b22;
+            padding: 0.05rem;
+            border-radius: 0.05rem;
+        }
+
+        .index .zp_out {
+            position: absolute;
+            top: 34.3%;
+            left: 50%;
+            -webkit-transform: translate(-50%);
+            transform: translate(-50%);
+        }
+
+        .index .zp_out .zp {
+            width: 2.4rem;
+            -webkit-transition: -webkit-transform 5s ease;
+            transition: -webkit-transform 5s ease;
+            transition: transform 5s ease;
+            transition: transform 5s ease, -webkit-transform 5s ease;
+        }
+
+        .index .zz {
+            position: absolute;
+            top: 43%;
+            left: 50%;
+            -webkit-transform: translate(-50%);
+            transform: translate(-50%);
+            font-size: 0.16rem;
+        }
+
+        .index .zz img {
+            width: 1rem;
+        }
+
+        .index .zz span {
+            position: absolute;
+            top: 38%;
+            left: 53%;
+            -webkit-transform: translate(-50%);
+            transform: translate(-50%);
+            width: 0.4rem;
+            color: white;
+        }
+
+        .index .button {
+            font-size: 0.25rem;
+            color: #9b1800;
+            position: absolute;
+            top: 76%;
+            left: 50%;
+            -webkit-transform: translate(-50%);
+            transform: translate(-50%);
+        }
+
+        .index .button img {
+            width: 3rem;
+            height: 0.5rem;
+        }
+
+        .index .button div {
+            position: absolute;
+            text-align: center;
+            font-weight: bold;
+            line-height: 0.5rem;
+            width: 3rem;
+            top: 0;
+            left: 50%;
+            -webkit-transform: translate(-50%);
+            transform: translate(-50%);
+        }
+
+        .index .remaining {
+            display: -webkit-box;
+            display: -ms-flexbox;
+            display: flex;
+            position: absolute;
+            top: 84.5%;
+            left: 50%;
+            -webkit-transform: translate(-50%);
+            transform: translate(-50%);
+            font-size: 0.15rem;
+            color: #ffd264;
+            white-space: nowrap;
+        }
+
+        .index .remaining .rmb {
+            background-color: #ffd264;
+            padding: 0.03rem 0.05rem;
+            border-radius: 100px;
+            color: #ba3d26;
+            margin-right: 0.1rem;
+        }
+
+        .index .remaining .remaining-rmb {
+            line-height: 0.25rem;
+        }
+
+        .index .rule {
+            position: absolute;
+            top: 92%;
+            padding: 0 0.37rem;
+        }
+
+        .index .rule .rule_title {
+            display: -webkit-box;
+            display: -ms-flexbox;
+            display: flex;
+            -webkit-box-pack: justify;
+            -ms-flex-pack: justify;
+            justify-content: space-between;
+            padding: 0 0.4rem;
+            font-size: 0.15rem;
+            color: #fabbaf;
+        }
+
+        .index .rule .rule_title div {
+            padding: 0 0.1rem;
+        }
+
+        .index .rule .rule_title .rule_title_active {
+            padding-bottom: 0.1rem;
+            border-bottom: 0.02rem solid #fabbaf;
+        }
+
+        .index .rule .rule_content {
+            font-size: 0.12rem;
+            color: #fabbaf;
+        }
+
+        .dialog {
+            position: fixed;
+            top: 0;
+            bottom: 0;
+            left: 0;
+            right: 0;
+            background: rgba(0, 0, 0, 0.6);
+            z-index: 9999;
+        }
+
+        .dialog .content {
+            position: fixed;
+            width: 90%;
+            height: 3.5rem;
+            top: 45%;
+            left: 50%;
+            -webkit-transform: translate(-50%, -50%);
+            transform: translate(-50%, -50%);
+            background: top/cover url(https://cdn-novel.iycdm.com/h5/activity-2019-05-30/get.png) no-repeat;
+            font-size: 0;
+            border-radius: 6px;
+        }
+
+        .dialog .content .dialog_button {
+            width: 3rem;
+            height: 0.5rem;
+            position: relative;
+            top: 2.6rem;
+            left: 50%;
+            -webkit-transform: translate(-50%);
+            transform: translate(-50%);
+        }
+
+        .dialog .content .dialog_close {
+            position: relative;
+            top: 3.3rem;
+            left: 50%;
+            -webkit-transform: translate(-50%);
+            transform: translate(-50%);
+            width: 0.3rem;
+        }
+
+        .wei-dialog {
+            position: fixed;
+            top: 0;
+            bottom: 0;
+            left: 0;
+            right: 0;
+            background: rgba(0, 0, 0, 0.6);
+            z-index: 9999;
+        }
+
+        .wei-dialog .content {
+            position: fixed;
+            width: 90%;
+            height: 2.4rem;
+            top: 50%;
+            left: 50%;
+            -webkit-transform: translate(-50%, -50%);
+            transform: translate(-50%, -50%);
+            background: top/cover url(https://cdn-novel.iycdm.com/h5/activity-2019-05-30/failure.png) no-repeat;
+            font-size: 0;
+            border-radius: 6px;
+        }
+
+        .wei-dialog .content .wei-dialog_button {
+            width: 3rem;
+            height: 0.5rem;
+            position: relative;
+            top: 1.55rem;
+            left: 50%;
+            -webkit-transform: translate(-50%);
+            transform: translate(-50%);
+        }
+
+        .wei-dialog .content .wei-dialog_close {
+            position: relative;
+            top: 2.5rem;
+            left: 50%;
+            -webkit-transform: translate(-50%);
+            transform: translate(-50%);
+            width: 0.3rem;
+        }
+        /*# sourceMappingURL=index.css.map */
+    </style>
+</head>
+
+<body>
+<main class="main_box">
+    <img src="https://cdn-novel.iycdm.com/h5/activity-2019-05-30/bg.jpg" class="bg" />
+    <div class="index">
+        <div class="slider">
+            <div id="slider">
+                <div class="slider-img active">1</div>
+                <div class="slider-img">2</div>
+                <div class="slider-img">3</div>
+                <!-- <ul class="slider-nav-list">
+                  <li class="nav-item active"></li>
+                  <li class="nav-item"></li>
+                  <li class="nav-item"></li>
+                </ul> -->
+            </div>
+        </div>
+        <div class="time">
+            <span>活动倒计时</span>
+            <span id="hour">00</span>
+            <div>:</div>
+            <span id="minute">00</span>
+            <div>:</div>
+            <span id="second">00</span>
+        </div>
+        <div class="zp_out">
+            <img src="https://cdn-novel.iycdm.com/h5/activity-2019-05-30/plate.png" class="zp" />
+        </div>
+        <div class="zz">
+            <img src="https://cdn-novel.iycdm.com/h5/activity-2019-05-30/point.png" />
+            <span>剩余{{$count}} 次</span>
+        </div>
+        <div class="button">
+            <img src="https://cdn-novel.iycdm.com/h5/activity-2019-05-30/button.png" />
+            <div>充值后才可抽奖</div>
+        </div>
+        <div class="remaining">
+            <div class="rmb">¥</div>
+            <div class="remaining-rmb">奖金池剩余:26235623书币</div>
+        </div>
+        <div class="rule">
+            <div class="rule_title">
+                <div class="rule_title_bt rule_title_active">活动规则</div>
+                <div class="rule_title_bt">中奖记录</div>
+            </div>
+            <div class="rule_content">
+                <p>1、书币奖品实时到账;</p>
+                <p>
+                    2、抽到实物奖品用户需先填手机号和身份证信息,客服
+                    确认信息后将会在7个工作日寄出;
+                </p>
+                <p>
+                    3、抽奖机会必须在活动充值页面成功充值后获得,其余
+                    充值页面充值不会获得抽奖机会;
+                </p>
+            </div>
+        </div>
+    </div>
+    <div class="dialog" style="display:none">
+        <div class="content">
+            <div class="dialog_button"></div>
+            <img src="https://cdn-novel.iycdm.com/h5/activity-2019-05-30/close.png" class="dialog_close" />
+        </div>
+    </div>
+    <div class="wei-dialog" style="display:none">
+        <div class="content">
+            <div class="wei-dialog_button"></div>
+            <img src="https://cdn-novel.iycdm.com/h5/activity-2019-05-30/close.png" class="wei-dialog_close" />
+        </div>
+    </div>
+</main>
+</body>
+<script>
+    //轮播
+    function carousel() {
+        var interval = 3000; //间隔多久轮换一次
+        var duration = 3000; //轮换动画的持续时间
+        var cur = 0; //当前图片的下标
+        var next = 1; //下一个图片的下标
+
+        //   var li_list = $(".nav-item");
+        var img_list = $(".slider-img");
+        setInterval(function() {
+            sliderImg();
+        }, interval);
+
+        function sliderImg() {
+            //轮换导航
+            // li_list
+            //   .eq(next)
+            //   .addClass("active")
+            //   .siblings()
+            //   .removeClass("active");
+            //轮换图片
+            img_list.eq(cur).animate(
+                    {
+                        left: "-150%"
+                    },
+                    duration,
+                    function() {
+                        $(this).removeClass("active");
+                    }
+            );
+
+            img_list
+                    .eq(next)
+                    .addClass("active")
+                    .css("left", "150%")
+                    .animate({ left: "50%" }, duration);
+
+            cur = next;
+            next++;
+            if (next >= img_list.length) {
+                next = 0;
+            }
+        }
+    }
+    carousel();
+
+    var time_diff = {{$time_diff}}
+    time_diff = parseInt(time_diff);
+    var oHour = document.querySelector('#hour');
+    var oMinute = document.querySelector('#minute');
+    var oSecond = document.querySelector('#second');
+    function times() {
+        time_diff--;
+        day = Math.floor(time_diff/86400);
+        hour = Math.floor((time_diff-day*86400)/3600)+day*24;
+        minute = Math.floor((time_diff - day * 86400 - hour * 3600) / 60);
+        second = time_diff - day * 86400 - hour * 3600 - minute * 60;
+        oHour.innerHTML = hour<10?'0'+hour:hour;
+        oMinute.innerHTML = minute<10?'0'+minute:minute;
+        oSecond.innerHTML = second<10?'0'+second:second;
+    }
+
+    times();
+
+    var timeInterval = setInterval(function () {
+        if(time_diff<=0){
+            clearInterval(timeInterval);
+            over();
+        }else{
+            times()
+        }
+    },1000)
+
+    //活动规则点击
+    $(function() {
+        $(".rule_title_bt").click(function(event) {
+            $(this)
+                    .addClass("rule_title_bt")
+                    .addClass("rule_title_active");
+            $(this)
+                    .siblings()
+                    .removeClass("rule_title_active");
+        });
+    });
+
+    var lasttime; //第一次点击时间
+    var rotatesize = 0; //旋转角度
+    var count = {{$count}}
+        count = parseInt(count);
+    //活动规则点击
+    var canClick = true;
+    $(function() {
+        $(".button").click(function(event) {
+            if(count <=0){
+                return ;
+            }
+            if(!canClick) return ;
+            canClick = false;
+            $.ajax({
+                'url':'/api/activity/huaweiLottery',
+                'type':'post',
+                 'success':function(res){
+                     if (lasttime && Date.parse(new Date()) - lasttime <= 5000) {
+                         //旋转时间5S在样式中修改后再修改间隔时间
+                         console.log("还在旋转");
+                         return;
+                     } else {
+                         lasttime = Date.parse(new Date());
+                         //点击时间赋值
+                         var m = res.data.rotate;
+                         //获取旋转角度  逆时针旋转
+                         $(".zp").css({ transform: "rotate(" + m + "deg)" });
+                         //旋转
+                         setTimeout(() => {
+                             document.querySelector(".dialog").style.display = "";
+                            //旋转完毕后弹窗
+                            console.log('over')
+                         canClick = true;
+                     }, 5000);
+                     }
+                 }
+            })
+
+        });
+    });
+    //获取旋转角度(随机数)
+    function getnub(x, y) {
+        /*//角度需大于x小于y
+        var m = Math.ceil(Math.random() * 10000);
+        var n = rotatesize + m;
+        var angle = n % 360;
+        if (m < 5000 || (angle < x + 10 || angle > y - 10)) {
+            return this.getnub(x, y);
+        } else {
+            rotatesize = n;
+            return n;
+        }*/
+    }
+
+    function resetPoint() {
+        $(".zp").css({transition:"none", transform: "rotate(0deg)" });
+        setTimeout(()=>{
+            $(".zp").css({transition:"transform 5s ease, -webkit-transform 5s ease"});
+        },200);
+    }
+    //奖励弹窗点击关闭
+    $(function() {
+        $(".dialog_button").click(function(event) {
+            document.querySelector(".dialog").style.display = "none";
+            //transition: transform 5s ease, -webkit-transform 5s ease;
+            resetPoint()
+        });
+    });
+
+    $(function() {
+        $(".dialog_close").click(function(event) {
+            document.querySelector(".dialog").style.display = "none";
+            resetPoint()
+
+        });
+    });
+
+    $(function() {
+        $(".wei-dialog_button").click(function(event) {
+            document.querySelector(".wei-dialog").style.display = "none";
+            resetPoint()
+        });
+    });
+    $(function() {
+        $(".wei-dialog_close").click(function(event) {
+            document.querySelector(".wei-dialog").style.display = "none";
+            resetPoint()
+        });
+    });
+
+</script>
+</html>