瀏覽代碼

轮播信息更改

linwu 1 年之前
父節點
當前提交
affc10ae5b
共有 2 個文件被更改,包括 18 次插入12 次删除
  1. 10 8
      app/portal/controller/IndexController.php
  2. 8 4
      public/themes/simpleboot3/portal/index.html

+ 10 - 8
app/portal/controller/IndexController.php

@@ -24,10 +24,10 @@ class IndexController extends LoveBaseController
 {
     public function index()
     {
-        $user_id   = cmf_get_current_user_id();
-        $user      = UserModel::get($user_id);
-        $matting   = UserMatingModel::where('user_id', $user_id)->find();
-        $where     = [
+        $user_id = cmf_get_current_user_id();
+        $user    = UserModel::get($user_id);
+        $matting = UserMatingModel::where('user_id', $user_id)->find();
+        $where   = [
             ['user_type', '=', 2],
             ['check_status', '=', 2],
             ['is_complete', '=', 1],
@@ -44,13 +44,13 @@ class IndexController extends LoveBaseController
         if (!empty($matting['min_age'])) {
             $age_end = strtotime("-{$matting['min_age']} year");
         }
-        $where[]  = ['birthday', 'between', [$age_start, $age_end]];
+        $where[] = ['birthday', 'between', [$age_start, $age_end]];
         //身高
         $max_high = 200;
         if (!empty($matting['max_high'])) {
             $max_high = $matting['max_high'];
         }
-        $where[]    = ['high', 'between', [$matting['min_high'], $max_high]];
+        $where[] = ['high', 'between', [$matting['min_high'], $max_high]];
         //体重
         $max_weight = 200;
         if (!empty($matting['max_weight'])) {
@@ -83,14 +83,16 @@ class IndexController extends LoveBaseController
         $this->assign('unread_num', $unread_num + $invite_num);
 
         //配对播报
-        $select = UserSelectLogModel::with(['user1','user2'])->order('id desc')->limit(3)->select();
+        /*$select = UserSelectLogModel::with(['user1','user2'])->order('id desc')->limit(3)->select();
         if (!empty($select)) {
             foreach ($select as $v) {
                 $v['name1'] = Fun::getEncodeName($v['user1']['realname']);
                 $v['name2'] = Fun::getEncodeName($v['user2']['realname']);
             }
         }
-        $this->assign('select',json_encode($select));
+        $this->assign('select',json_encode($select));*/
+        $select_count = UserSelectLogModel::useGlobalScope(false)->count();
+        $this->assign('select_count', $select_count + 4);
 
         return $this->fetch(':index');
     }

+ 8 - 4
public/themes/simpleboot3/portal/index.html

@@ -28,10 +28,14 @@
         </van-swipe-item>
     </van-swipe>
 
-    <van-swipe style="height: 30px;background:white;" vertical :autoplay="3000" v-if="select.length > 0">
-        <van-swipe-item class="ad" v-for="(p, index) in select" :key="index">
+    <van-swipe style="height: 30px;background:white;" vertical :autoplay="3000">
+        <!--<van-swipe-item class="ad" v-for="(p, index) in select" :key="index">-->
+            <!--<van-icon name="volume-o" color="#FF589B"></van-icon>-->
+            <!--<span class="ad-text">恭喜{{p.name1}}和{{p.name2}}配对成功</span>-->
+        <!--</van-swipe-item>-->
+        <van-swipe-item class="ad">
             <van-icon name="volume-o" color="#FF589B"></van-icon>
-            <span class="ad-text">恭喜{{p.name1}}和{{p.name2}}配对成功</span>
+            <span class="ad-text">累计配对成功数{{select_count}}对</span>
         </van-swipe-item>
         <template #indicator>
             <div class="custom-indicator"></div>
@@ -106,7 +110,7 @@
                     images: {$images},
                     active: 0,
                     list: {$list},
-                    select: {$select},
+                    select_count: {$select_count},
                     unread_num: {$unread_num},
                 };
             },