linwu 2 éve
szülő
commit
b6d592400d

+ 28 - 1
app/love/controller/LotteryController.php

@@ -32,6 +32,13 @@ class LotteryController extends HomeBaseController
     //抽奖页
     public function index()
     {
+        //验证
+        $user_id = cmf_get_current_user_id();
+        $user    = UserModel::get($user_id);
+        if ($user['is_marry'] == 2 || $user['sex'] == 1) {
+            $this->redirect('/');
+        }
+
         $prize       = LotteryPrizeModel::all();
         $ids         = [];
         $restaraunts = [];
@@ -70,7 +77,7 @@ class LotteryController extends HomeBaseController
 
         $lottery = LotteryLogModel::where('user_id', $user_id)->find();
         if (!empty($lottery)) {
-            $this->error('一个人只能抽一次奖');
+            $this->error('一个人只能抽一次奖',url('log'));
         }
 
         //奖品列表
@@ -96,6 +103,26 @@ class LotteryController extends HomeBaseController
         $this->success('恭喜你,获得' . $prize['name'],'',['id' => $rid]);
     }
 
+    /**
+     * 中奖记录
+     */
+    public function log()
+    {
+        //奖品
+        $user_id = cmf_get_current_user_id();
+        $lottery = LotteryLogModel::with('lottery')->where('user_id',$user_id)->find();
+        if (empty($lottery) || $lottery['status'] == 1) {
+            $this->redirect('/');
+        }
+        $lottery['lottery']['image'] = cmf_get_image_url($lottery['lottery']['image']);
+        $this->assign('lottery',$lottery);
+
+        return $this->fetch();
+    }
+
+    /**
+     * 获取奖品
+     */
     private function _get_rand($proArr)
     {
         $result = '';

+ 5 - 0
app/love/controller/RegisterController.php

@@ -48,6 +48,11 @@ class RegisterController extends HomeBaseController
         return $this->fetch();
     }
 
+    public function marry()
+    {
+        return $this->fetch();
+    }
+
     public function audit()
     {
         return $this->fetch();

+ 1 - 1
app/love/model/LotteryLogModel.php

@@ -22,6 +22,6 @@ class LotteryLogModel extends Model
 
     public function lottery()
     {
-        return $this->hasOne(LotteryModel::class,'id','lottery_id');
+        return $this->hasOne(LotteryPrizeModel::class,'id','prize_id');
     }
 }

+ 2 - 0
public/themes/admin_simpleboot3/love/admin_active/apply_list.html

@@ -21,6 +21,7 @@
             <thead>
             <tr>
                 <th>{:lang('USERNAME')}</th>
+                <th>性别</th>
                 <th>{:lang('AVATAR')}</th>
                 <th>报名时间</th>
                 <th>审核</th>
@@ -31,6 +32,7 @@
             <foreach name="list" item="vo">
                 <tr>
                     <td>{$vo['user']['username']}</td>
+                    <td>{$vo['user']['sex'] == 1 ? '男' : '女'}</td>
                     <td><img width="25" height="25" src="{:url('user/public/avatar',array('id'=>$vo['user']['id']))}"/></td>
                     <td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
                     <td>

+ 4 - 0
public/themes/simpleboot3/love/lottery/index.html

@@ -122,6 +122,7 @@
                     duration: 8000,
                     callback: function () {
                         alert(txt);//欢乐转盘弹出框
+                        location.href = "{:url('log')}";
                         turnplate.bRotate = !turnplate.bRotate;
                     }
                 });
@@ -144,6 +145,9 @@
                         rotateFn(item, json.msg);
                     } else {
                         alert(json.msg);
+                        if (json.url) {
+                            location.href = json.url;
+                        }
                     }
                 }, 'json');
 

+ 58 - 0
public/themes/simpleboot3/love/lottery/log.html

@@ -0,0 +1,58 @@
+<extend name="public@base"/>
+<block name="css">
+    <style>
+        .block {background:white;}
+        .block h2{
+            margin: 0;
+            padding: 32px 16px 16px;
+            color: rgba(69, 90, 100, 0.6);
+            font-weight: normal;
+            font-size: 14px;
+            line-height: 16px;
+        }
+    </style>
+</block>
+<block name="body">
+    <van-nav-bar class="bg-pink">
+        <template #title>
+            <span style="color:white;">奖品</span>
+        </template>
+    </van-nav-bar>
+    <div class="block">
+        <h2>中奖信息</h2>
+        <van-card
+                num="1"
+                :title="lottery.prize_name"
+                :thumb="lottery.lottery.image"
+        ></van-card>
+    </div>
+    <div class="block">
+        <h2>领奖方式</h2>
+        <van-cell-group>
+            <van-cell title="时间:法定上班期间。"></van-cell>
+            <van-cell title="地点:晋江(国际)人才港。"></van-cell>
+            <van-cell title="所需材料:结婚证,手机打开本页面。"></van-cell>
+            <van-cell title="联系电话:0595-88223456" ></van-cell>
+        </van-cell-group>
+    </div>
+</block>
+<block name="script">
+    <script>
+        new Vue({
+            el: '#app',
+            data() {
+                return {
+                    lottery: {$lottery},
+                };
+            },
+            methods: {
+                onBack() {
+                    history.back();
+                },
+            },
+            computed: {
+
+            }
+        });
+    </script>
+</block>

+ 1 - 1
public/themes/simpleboot3/love/register/marry.html

@@ -9,7 +9,7 @@
             <span>系统通知</span>
         </template>
     </van-nav-bar>
-    <h1 style="text-align:center;margin-top:20px;" class="text-pink">您已结婚,无法再进入本平台!如需抽奖和领奖,请登录女生的号操作!</h1>
+    <h1 style="text-align:center;margin-top:20px;" class="text-pink">您已结婚,无法再进入本平台!如需抽奖和领奖,请登录女生的号操作!</h1>
 </block>
 <block name="script">
     <script>